Skip to content

Improve Kubernetes module testing code #11624

@sayden

Description

@sayden

Kubernetes module has few metricsets with a quite complex code that probably can be improved, make it more clear or test more code. "Offending" metricsets are:

  • state_deployment
  • state_pod
  • state_replicaset
  • state_statefulset

Ideally, all of them should work in a similar way, like state_container does with this small snippet:

func TestEventMapping(t *testing.T) {
	ptest.TestMetricSet(t, "kubernetes", "state_container",
		ptest.TestCases{
			{
				MetricsFile:  "../_meta/test/kube-state-metrics",
				ExpectedFile: "./_meta/test/kube-state-metrics.expected",
			},
			{
				MetricsFile:  "../_meta/test/kube-state-metrics.v1.3.0",
				ExpectedFile: "./_meta/test/kube-state-metrics.v1.3.0.expected",
			},
		},
	)
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions