diff --git a/tests/integration/helm_opentelemetry_operator_enabled_test.go b/tests/integration/helm_opentelemetry_operator_enabled_test.go index e4a8ec3d50..7b1d105169 100644 --- a/tests/integration/helm_opentelemetry_operator_enabled_test.go +++ b/tests/integration/helm_opentelemetry_operator_enabled_test.go @@ -8,7 +8,6 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/e2e-framework/klient/k8s" "sigs.k8s.io/e2e-framework/klient/k8s/resources" "sigs.k8s.io/e2e-framework/klient/wait" @@ -16,7 +15,6 @@ import ( "sigs.k8s.io/e2e-framework/pkg/envconf" "sigs.k8s.io/e2e-framework/pkg/features" - terrak8s "github.com/gruntwork-io/terratest/modules/k8s" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -30,155 +28,6 @@ func Test_Helm_OpenTelemetry_Operator_Enabled(t *testing.T) { waitDuration = time.Minute * 2 ) - featInstall := features.New("installation"). - Assess("sumologic secret is created", - func(ctx context.Context, t *testing.T, envConf *envconf.Config) context.Context { - terrak8s.WaitUntilSecretAvailable(t, ctxopts.KubectlOptions(ctx), "sumologic", 60, tickDuration) - secret := terrak8s.GetSecret(t, ctxopts.KubectlOptions(ctx), "sumologic") - // Apart from 10 default entries it also has 1 for traces - require.Len(t, secret.Data, 11) - return ctx - }). - Assess("fluentd logs statefulset is ready", - stepfuncs.WaitUntilStatefulSetIsReady( - waitDuration, - tickDuration, - stepfuncs.WithNameF( - stepfuncs.ReleaseFormatter("%s-sumologic-fluentd-logs"), - ), - stepfuncs.WithLabelsF( - stepfuncs.LabelFormatterKV{ - K: "app", - V: stepfuncs.ReleaseFormatter("%s-sumologic-fluentd-logs"), - }, - ), - ), - ). - Assess("fluentd logs buffers PVCs are created", - func(ctx context.Context, t *testing.T, envConf *envconf.Config) context.Context { - namespace := ctxopts.Namespace(ctx) - releaseName := ctxopts.HelmRelease(ctx) - kubectlOptions := ctxopts.KubectlOptions(ctx) - - t.Logf("kubeconfig: %s", kubectlOptions.ConfigPath) - cl, err := terrak8s.GetKubernetesClientFromOptionsE(t, kubectlOptions) - require.NoError(t, err) - - assert.Eventually(t, func() bool { - pvcs, err := cl.CoreV1().PersistentVolumeClaims(namespace). - List(ctx, metav1.ListOptions{ - LabelSelector: fmt.Sprintf("app=%s-sumologic-fluentd-logs", releaseName), - }) - if !assert.NoError(t, err) { - return false - } - - return err == nil && len(pvcs.Items) == 1 - }, waitDuration, tickDuration) - return ctx - }). - Assess("fluentd metrics statefulset is ready", - stepfuncs.WaitUntilStatefulSetIsReady( - waitDuration, - tickDuration, - stepfuncs.WithNameF( - stepfuncs.ReleaseFormatter("%s-sumologic-fluentd-metrics"), - ), - stepfuncs.WithLabelsF( - stepfuncs.LabelFormatterKV{ - K: "app", - V: stepfuncs.ReleaseFormatter("%s-sumologic-fluentd-metrics"), - }, - ), - ), - ). - Assess("fluentd metrics buffers PVCs are created", - func(ctx context.Context, t *testing.T, envConf *envconf.Config) context.Context { - namespace := ctxopts.Namespace(ctx) - releaseName := ctxopts.HelmRelease(ctx) - kubectlOptions := ctxopts.KubectlOptions(ctx) - - t.Logf("kubeconfig: %s", kubectlOptions.ConfigPath) - cl, err := terrak8s.GetKubernetesClientFromOptionsE(t, kubectlOptions) - require.NoError(t, err) - - assert.Eventually(t, func() bool { - pvcs, err := cl.CoreV1().PersistentVolumeClaims(namespace). - List(ctx, metav1.ListOptions{ - LabelSelector: fmt.Sprintf("app=%s-sumologic-fluentd-metrics", releaseName), - }) - if !assert.NoError(t, err) { - return false - } - - return err == nil && len(pvcs.Items) == 1 - }, waitDuration, tickDuration) - return ctx - }). - Assess("fluentd events statefulset is ready", - stepfuncs.WaitUntilStatefulSetIsReady( - waitDuration, - tickDuration, - stepfuncs.WithNameF( - stepfuncs.ReleaseFormatter("%s-sumologic-fluentd-events"), - ), - stepfuncs.WithLabelsF( - stepfuncs.LabelFormatterKV{ - K: "app", - V: stepfuncs.ReleaseFormatter("%s-sumologic-fluentd-events"), - }, - ), - ), - ). - Assess("fluentd events buffers PVCs are created", - func(ctx context.Context, t *testing.T, envConf *envconf.Config) context.Context { - namespace := ctxopts.Namespace(ctx) - releaseName := ctxopts.HelmRelease(ctx) - kubectlOptions := ctxopts.KubectlOptions(ctx) - - t.Logf("kubeconfig: %s", kubectlOptions.ConfigPath) - cl, err := terrak8s.GetKubernetesClientFromOptionsE(t, kubectlOptions) - require.NoError(t, err) - - assert.Eventually(t, func() bool { - pvcs, err := cl.CoreV1().PersistentVolumeClaims(namespace). - List(ctx, metav1.ListOptions{ - LabelSelector: fmt.Sprintf("app=%s-sumologic-fluentd-events", releaseName), - }) - if !assert.NoError(t, err) { - return false - } - - return err == nil && len(pvcs.Items) == 1 - }, waitDuration, tickDuration) - return ctx - }). - Assess("prometheus pods are available", - stepfuncs.WaitUntilPodsAvailable( - metav1.ListOptions{ - LabelSelector: "app=prometheus", - }, - 1, - waitDuration, - tickDuration, - ), - ). - Assess("fluent-bit daemonset is running", - func(ctx context.Context, t *testing.T, envConf *envconf.Config) context.Context { - var daemonsets []appsv1.DaemonSet - require.Eventually(t, func() bool { - daemonsets = terrak8s.ListDaemonSets(t, ctxopts.KubectlOptions(ctx), metav1.ListOptions{ - LabelSelector: "app.kubernetes.io/name=fluent-bit", - }) - - return len(daemonsets) == 1 - }, waitDuration, tickDuration) - - require.EqualValues(t, 0, daemonsets[0].Status.NumberUnavailable) - return ctx - }). - Feature() - featTraces := features.New("traces"). // TODO: Rewrite into similar step func as WaitUntilStatefulSetIsReady but for deployments Assess("otelcol deployment is ready", func(ctx context.Context, t *testing.T, envConf *envconf.Config) context.Context { @@ -274,5 +123,5 @@ func Test_Helm_OpenTelemetry_Operator_Enabled(t *testing.T) { }). Feature() - testenv.Test(t, featInstall, featTraces, featOpenTelemetryOperator) + testenv.Test(t, featTraces, featOpenTelemetryOperator) }