Skip to content

Commit

Permalink
update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ting committed Jun 3, 2024
1 parent e76c583 commit f68240c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions core/emetric/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestCounterVec(t *testing.T) {
name := "test"
label := []string{"hello", "world"}
labels := []string{"hello", "world"}

mockCounterVec := &prometheus.CounterVec{}
vec := func(opts prometheus.GaugeOpts, labels []string) *prometheus.CounterVec {
Expand All @@ -21,12 +21,11 @@ func TestCounterVec(t *testing.T) {
Help: "test",
ConstLabels: map[string]string{"hello": "world"},
}
labels = []string{"hello", "world"}
assert.Equal(t, "ego", opts.Namespace)
assert.Equal(t, name, opts.Name)
assert.Equal(t, name, opts.Help)
return mockCounterVec
}
out := NewCounterVec(name, label)
out := NewCounterVec(name, labels)
reflect.DeepEqual(vec, out.CounterVec)
}
5 changes: 2 additions & 3 deletions core/emetric/gauge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestNewGaugeVec(t *testing.T) {
name := "test_"
label := []string{"hello_", "world_"}
labels := []string{"hello_", "world_"}

mockGaugeVec := &prometheus.GaugeVec{}
vec := func(opts prometheus.GaugeOpts, labels []string) *prometheus.GaugeVec {
Expand All @@ -21,12 +21,11 @@ func TestNewGaugeVec(t *testing.T) {
Help: "test_",
ConstLabels: map[string]string{"hello": "world"},
}
labels = []string{"hello_", "world_"}
assert.Equal(t, DefaultNamespace, opts.Namespace)
assert.Equal(t, name, opts.Name)
assert.Equal(t, name, opts.Help)
return mockGaugeVec
}
out := NewGaugeVec(name, label)
out := NewGaugeVec(name, labels)
reflect.DeepEqual(vec, out.GaugeVec)
}

0 comments on commit f68240c

Please sign in to comment.