mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Clean up unused variable from unit test.
This commit is contained in:
parent
2b304bf5e2
commit
81c6989ccc
@ -99,7 +99,6 @@ func TestRegister(t *testing.T) {
|
|||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
desc string
|
desc string
|
||||||
metrics []*Counter
|
metrics []*Counter
|
||||||
registryVersion *semver.Version
|
|
||||||
expectedErrors []error
|
expectedErrors []error
|
||||||
expectedIsCreatedValues []bool
|
expectedIsCreatedValues []bool
|
||||||
expectedIsDeprecated []bool
|
expectedIsDeprecated []bool
|
||||||
@ -108,7 +107,6 @@ func TestRegister(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "test alpha metric",
|
desc: "test alpha metric",
|
||||||
metrics: []*Counter{alphaCounter},
|
metrics: []*Counter{alphaCounter},
|
||||||
registryVersion: &v115,
|
|
||||||
expectedErrors: []error{nil},
|
expectedErrors: []error{nil},
|
||||||
expectedIsCreatedValues: []bool{true},
|
expectedIsCreatedValues: []bool{true},
|
||||||
expectedIsDeprecated: []bool{false},
|
expectedIsDeprecated: []bool{false},
|
||||||
@ -117,7 +115,6 @@ func TestRegister(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "test registering same metric multiple times",
|
desc: "test registering same metric multiple times",
|
||||||
metrics: []*Counter{alphaCounter, alphaCounter},
|
metrics: []*Counter{alphaCounter, alphaCounter},
|
||||||
registryVersion: &v115,
|
|
||||||
expectedErrors: []error{nil, prometheus.AlreadyRegisteredError{}},
|
expectedErrors: []error{nil, prometheus.AlreadyRegisteredError{}},
|
||||||
expectedIsCreatedValues: []bool{true, true},
|
expectedIsCreatedValues: []bool{true, true},
|
||||||
expectedIsDeprecated: []bool{false, false},
|
expectedIsDeprecated: []bool{false, false},
|
||||||
@ -126,7 +123,6 @@ func TestRegister(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "test alpha deprecated metric",
|
desc: "test alpha deprecated metric",
|
||||||
metrics: []*Counter{alphaDeprecatedCounter},
|
metrics: []*Counter{alphaDeprecatedCounter},
|
||||||
registryVersion: &v115,
|
|
||||||
expectedErrors: []error{nil},
|
expectedErrors: []error{nil},
|
||||||
expectedIsCreatedValues: []bool{true},
|
expectedIsCreatedValues: []bool{true},
|
||||||
expectedIsDeprecated: []bool{true},
|
expectedIsDeprecated: []bool{true},
|
||||||
@ -135,7 +131,6 @@ func TestRegister(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "test alpha hidden metric",
|
desc: "test alpha hidden metric",
|
||||||
metrics: []*Counter{alphaHiddenCounter},
|
metrics: []*Counter{alphaHiddenCounter},
|
||||||
registryVersion: &v115,
|
|
||||||
expectedErrors: []error{nil},
|
expectedErrors: []error{nil},
|
||||||
expectedIsCreatedValues: []bool{false},
|
expectedIsCreatedValues: []bool{false},
|
||||||
expectedIsDeprecated: []bool{true},
|
expectedIsDeprecated: []bool{true},
|
||||||
@ -152,7 +147,7 @@ func TestRegister(t *testing.T) {
|
|||||||
})
|
})
|
||||||
for i, m := range test.metrics {
|
for i, m := range test.metrics {
|
||||||
err := registry.Register(m)
|
err := registry.Register(m)
|
||||||
if err != test.expectedErrors[i] && err.Error() != test.expectedErrors[i].Error() {
|
if err != nil && err.Error() != test.expectedErrors[i].Error() {
|
||||||
t.Errorf("Got unexpected error %v, wanted %v", err, test.expectedErrors[i])
|
t.Errorf("Got unexpected error %v, wanted %v", err, test.expectedErrors[i])
|
||||||
}
|
}
|
||||||
if m.IsCreated() != test.expectedIsCreatedValues[i] {
|
if m.IsCreated() != test.expectedIsCreatedValues[i] {
|
||||||
|
Loading…
Reference in New Issue
Block a user