mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 03:38:43 +00:00
*: Add unit tests for ListOptions functions
This commit is contained in:
parent
2c4b284313
commit
0bad38a1fd
2 changed files with 54 additions and 0 deletions
pkg
27
pkg/alertmanager/operator_test.go
Normal file
27
pkg/alertmanager/operator_test.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2017 The prometheus-operator Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package alertmanager
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestListOptions(t *testing.T) {
|
||||
expected := "app=alertmanager,alertmanager=test"
|
||||
o := ListOptions("test")
|
||||
if o.LabelSelector != expected {
|
||||
t.Fatal("LabelSelector not computed correctly")
|
||||
}
|
||||
}
|
27
pkg/prometheus/operator_test.go
Normal file
27
pkg/prometheus/operator_test.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2017 The prometheus-operator Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package prometheus
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestListOptions(t *testing.T) {
|
||||
expected := "app=prometheus,prometheus=test"
|
||||
o := ListOptions("test")
|
||||
if o.LabelSelector != expected {
|
||||
t.Fatal("LabelSelector not computed correctly")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue