Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] [k8s] fix k8s e2e tests #33548

Merged
merged 5 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/k8stest/k8s_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func CreateCollectorObjects(t *testing.T, client *K8sClient, testID string, mani
manifestFiles, err := os.ReadDir(manifestsDir)
require.NoErrorf(t, err, "failed to read collector manifests directory %s", manifestsDir)
host := HostEndpoint(t)
if host == "" {
require.Fail(t, "host endpoint cannot be empty")
}
var podNamespace string
var podLabels map[string]any
createdObjs := make([]*unstructured.Unstructured, 0, len(manifestFiles))
Expand Down
4 changes: 3 additions & 1 deletion internal/k8stest/k8s_data_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ func HostEndpoint(t *testing.T) string {
network, err := client.NetworkInspect(ctx, "kind", types.NetworkInspectOptions{})
require.NoError(t, err)
for _, ipam := range network.IPAM.Config {
return ipam.Gateway
if ipam.Gateway != "" {
return ipam.Gateway
}
}
require.Fail(t, "failed to find host endpoint")
return ""
Expand Down
3 changes: 0 additions & 3 deletions processor/k8sattributesprocessor/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func newExpectedValue(mode int, value string) *expectedValue {
// make docker-otelcontribcol
// KUBECONFIG=/tmp/kube-config-otelcol-e2e-testing kind load docker-image otelcontribcol:latest
func TestE2E_ClusterRBAC(t *testing.T) {
t.Skip("skipping flaky test, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33520")

testDir := filepath.Join("testdata", "e2e", "clusterrbac")

Expand Down Expand Up @@ -422,7 +421,6 @@ func TestE2E_ClusterRBAC(t *testing.T) {

// Test with `filter::namespace` set and only role binding to collector's SA. We can't get node and namespace labels/annotations.
func TestE2E_NamespacedRBAC(t *testing.T) {
t.Skip("skipping flaky test, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33520")

testDir := filepath.Join("testdata", "e2e", "namespacedrbac")

Expand Down Expand Up @@ -563,7 +561,6 @@ func TestE2E_NamespacedRBAC(t *testing.T) {
// Test with `filter::namespace` set, role binding for namespace-scoped objects (pod, replicaset) and clusterrole
// binding for node and namespace objects.
func TestE2E_MixRBAC(t *testing.T) {
t.Skip("skipping flaky test, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33520")

testDir := filepath.Join("testdata", "e2e", "mixrbac")

Expand Down
1 change: 0 additions & 1 deletion receiver/k8sclusterreceiver/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const testKubeConfig = "/tmp/kube-config-otelcol-e2e-testing"
// make docker-otelcontribcol
// KUBECONFIG=/tmp/kube-config-otelcol-e2e-testing kind load docker-image otelcontribcol:latest
func TestE2E(t *testing.T) {
t.Skip("skipping flaky test, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33520")

var expected pmetric.Metrics
expectedFile := filepath.Join("testdata", "e2e", "expected.yaml")
Expand Down
8 changes: 4 additions & 4 deletions receiver/k8sclusterreceiver/testdata/e2e/expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ resourceMetrics:
stringValue: 1a5b9c371c8a7c5d8b0e56a82395aeee88523b1e2d96f17b4a6ae22bf11936bb
- key: container.image.name
value:
stringValue: registry.k8s.io/kube-apiserver
stringValue: registry.k8s.io/kube-apiserver-amd64
- key: container.image.tag
value:
stringValue: v1.25.3
Expand Down Expand Up @@ -865,7 +865,7 @@ resourceMetrics:
stringValue: 2e506922310bbf1ffb8dbbf56c04e540306f272b794d89ffbe776fe5e2fc148e
- key: container.image.name
value:
stringValue: registry.k8s.io/kube-scheduler
stringValue: registry.k8s.io/kube-scheduler-amd64
- key: container.image.tag
value:
stringValue: v1.25.3
Expand Down Expand Up @@ -918,7 +918,7 @@ resourceMetrics:
stringValue: 3baa03c525095d74e7ee24a5c4c42a4680b131f9b8a68f5e2e853ae569d97e4c
- key: container.image.name
value:
stringValue: registry.k8s.io/kube-controller-manager
stringValue: registry.k8s.io/kube-controller-manager-amd64
- key: container.image.tag
value:
stringValue: v1.25.3
Expand Down Expand Up @@ -971,7 +971,7 @@ resourceMetrics:
stringValue: 5cfead143bc88798f93fae8e05586b1191771477030fe89ed7bca288bb82c0aa
- key: container.image.name
value:
stringValue: registry.k8s.io/kube-proxy
stringValue: registry.k8s.io/kube-proxy-amd64
- key: container.image.tag
value:
stringValue: v1.25.3
Expand Down
1 change: 0 additions & 1 deletion receiver/k8sobjectsreceiver/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const (
)

func TestE2E(t *testing.T) {
t.Skip("skipping flaky test, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33520")

k8sClient, err := k8stest.NewK8sClient(testKubeConfig)
require.NoError(t, err)
Expand Down
1 change: 0 additions & 1 deletion receiver/kubeletstatsreceiver/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
const testKubeConfig = "/tmp/kube-config-otelcol-e2e-testing"

func TestE2E(t *testing.T) {
t.Skip("skipping flaky test, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33520")

var expected pmetric.Metrics
expectedFile := filepath.Join("testdata", "e2e", "expected.yaml")
Expand Down