Skip to content

Commit 95ed52a

Browse files
author
Vincent
authored
Add the missing test suite for the metrics (#5039)
Signed-off-by: Vincent Hou <[email protected]>
1 parent 46681e3 commit 95ed52a

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2021 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package metrics
16+
17+
import (
18+
"testing"
19+
20+
. "github.com/onsi/ginkgo"
21+
. "github.com/onsi/gomega"
22+
)
23+
24+
func TestMetrics(t *testing.T) {
25+
RegisterFailHandler(Fail)
26+
RunSpecs(t, "Metrics Suite")
27+
}

internal/annotations/metrics/metrics_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ var _ = Describe("SDK Label helper functions", func() {
3636
output := parseVersion(version)
3737
Expect(output).To(Equal("v0.18.0+git"))
3838
})
39-
39+
It("should return unknown", func() {
40+
version := "noneSemanticVersion"
41+
output := parseVersion(version)
42+
Expect(output).To(Equal("unknown"))
43+
})
4044
})
4145
})

0 commit comments

Comments
 (0)