From 28918ab73e73253dee946b28f39edb51375f59d8 Mon Sep 17 00:00:00 2001 From: Fanny Jiang Date: Thu, 9 Jan 2025 12:17:36 -0500 Subject: [PATCH] re-enable rc e2e --- Makefile | 2 +- test/e2e/common.go | 40 +-- test/e2e/kind_test.go | 325 +----------------- test/e2e/main.go | 3 - .../manifests/autodiscovery-annotation.yaml | 35 -- .../manifests/datadog-agent-ccr-enabled.yaml | 19 - test/e2e/manifests/datadog-agent-logs.yaml | 20 -- test/e2e/manifests/datadog-agent-minimum.yaml | 52 ++- test/e2e/provisioners/kind.go | 4 +- test/e2e/rc_updater_test.go | 3 - test/e2e/tests/k8s_suite/kind_local_test.go | 4 + 11 files changed, 64 insertions(+), 443 deletions(-) delete mode 100644 test/e2e/manifests/autodiscovery-annotation.yaml delete mode 100644 test/e2e/manifests/datadog-agent-ccr-enabled.yaml delete mode 100644 test/e2e/manifests/datadog-agent-logs.yaml diff --git a/Makefile b/Makefile index e7a0a65ab..e4bbc2b68 100644 --- a/Makefile +++ b/Makefile @@ -212,7 +212,7 @@ integration-tests-v2: $(ENVTEST) ## Run tests with reconciler V2 e2e-tests: manifests $(KUSTOMIZE) ## Run E2E tests and destroy environment stacks after tests complete. To run locally, complete pre-reqs (see docs/how-to-contribute.md) and prepend command with `aws-vault exec sso-agent-sandbox-account-admin --`. E.g. `aws-vault exec sso-agent-sandbox-account-admin -- make e2e-tests`. cd test/e2e && go get github.com/DataDog/datadog-agent/test/new-e2e@9ebd4d1cebbe1c9141e3a6b54176fdea8a79dd91 cd $(ROOT) - KUBEBUILDER_ASSETS="$(ROOT)/bin/$(PLATFORM)/" go test -C test/e2e ./... -run TestAWSKindSuite -tags=!e2e -count=1 -v -timeout=0s -coverprofile cover_e2e.out + KUBEBUILDER_ASSETS="$(ROOT)/bin/$(PLATFORM)/" go test -C test/e2e ./... -count=1 -v -timeout=0s -coverprofile cover_e2e.out .PHONY: e2e-tests-keep-stacks e2e-tests-keep-stacks: manifests $(KUSTOMIZE) ## Run E2E tests and keep environment stacks running. To run locally, complete pre-reqs (see docs/how-to-contribute.md) and prepend command with `aws-vault exec sso-agent-sandbox-account-admin --`. E.g. `aws-vault exec sso-agent-sandbox-account-admin -- make e2e-tests-keep-stacks`. diff --git a/test/e2e/common.go b/test/e2e/common.go index eea60a157..3823028a7 100644 --- a/test/e2e/common.go +++ b/test/e2e/common.go @@ -3,17 +3,12 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. -//go:build e2e -// +build e2e - package e2e import ( - "encoding/json" "fmt" "os" "path/filepath" - "regexp" "testing" "time" @@ -56,24 +51,19 @@ alias kl="kubectl logs" alias kx="kubectl exec" ' >> /home/ubuntu/.bashrc ` - defaultMgrImageName = "gcr.io/datadoghq/operator" - defaultMgrImgTag = "latest" - defaultMgrFileName = "e2e-manager.yaml" - nodeAgentSelector = "agent.datadoghq.com/component=agent" - clusterAgentSelector = "agent.datadoghq.com/component=cluster-agent" - clusterCheckRunnerSelector = "agent.datadoghq.com/component=cluster-checks-runner" + defaultMgrImageName = "gcr.io/datadoghq/operator" + defaultMgrImgTag = "latest" + nodeAgentSelector = "agent.datadoghq.com/component=agent" ) var ( - namespaceName = "system" + namespaceName = "e2e-operator" k8sVersion = getEnv("K8S_VERSION", "1.26") imgPullPassword = getEnv("IMAGE_PULL_PASSWORD", "") kubeConfigPath string - kubectlOptions *k8s.KubectlOptions - tmpDir string - ddaMinimalPath = filepath.Join(manifestsPath, "datadog-agent-minimum.yaml") + tmpDir string ) // getAbsPath Return absolute path for given path @@ -211,23 +201,3 @@ func updateKustomization(kustomizeDirPath string, kustomizeResourcePaths []strin return nil } - -func parseCollectorJson(collectorOutput string) map[string]interface{} { - var jsonString string - var jsonObject map[string]interface{} - - re := regexp.MustCompile(`(\{.*\})`) - match := re.FindStringSubmatch(collectorOutput) - if len(match) > 0 { - jsonString = match[0] - } else { - return map[string]interface{}{} - } - - // Parse collector JSON - err := json.Unmarshal([]byte(jsonString), &jsonObject) - if err != nil { - return map[string]interface{}{} - } - return jsonObject -} diff --git a/test/e2e/kind_test.go b/test/e2e/kind_test.go index 4b09317cf..0cf03c372 100644 --- a/test/e2e/kind_test.go +++ b/test/e2e/kind_test.go @@ -3,89 +3,31 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. -//go:build e2e -// +build e2e - package e2e import ( - "context" "fmt" - "github.com/DataDog/datadog-agent/test/new-e2e/pkg/provisioners" - "path/filepath" - "strconv" - "strings" - "testing" - "time" - "github.com/DataDog/datadog-agent/test/new-e2e/pkg/components" - "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/provisioners" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner" - "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner/parameters" - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" - "github.com/DataDog/datadog-api-client-go/v2/api/datadogV1" "github.com/DataDog/test-infra-definitions/common/utils" localKubernetes "github.com/DataDog/test-infra-definitions/components/kubernetes" resAws "github.com/DataDog/test-infra-definitions/resources/aws" "github.com/DataDog/test-infra-definitions/scenarios/aws/ec2" - "github.com/gruntwork-io/terratest/modules/k8s" "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes" corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1" "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/kustomize" metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1" "github.com/pulumi/pulumi/sdk/v3/go/auto" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - "github.com/stretchr/testify/assert" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "path/filepath" + "strings" ) type kindEnv struct { Kind *components.KubernetesCluster } -type kindSuite struct { - e2e.BaseSuite[kindEnv] - datadogClient -} - -type datadogClient struct { - ctx context.Context - metricsApi *datadogV1.MetricsApi - logsApi *datadogV1.LogsApi -} - -func (suite *kindSuite) SetupSuite() { - apiKey, err := runner.GetProfile().SecretStore().Get(parameters.APIKey) - suite.Require().NoError(err) - appKey, err := runner.GetProfile().SecretStore().Get(parameters.APPKey) - suite.Require().NoError(err) - suite.datadogClient.ctx = context.WithValue( - context.Background(), - datadog.ContextAPIKeys, - map[string]datadog.APIKey{ - "apiKeyAuth": { - Key: apiKey, - }, - "appKeyAuth": { - Key: appKey, - }, - }, - ) - configuration := datadog.NewConfiguration() - client := datadog.NewAPIClient(configuration) - suite.datadogClient.metricsApi = datadogV1.NewMetricsApi(client) - suite.datadogClient.logsApi = datadogV1.NewLogsApi(client) -} - -func TestKindSuite(t *testing.T) { - e2eParams := []e2e.SuiteOption{ - e2e.WithStackName(fmt.Sprintf("operator-kind-%s", k8sVersion)), - e2e.WithProvisioner(kindProvisioner(k8sVersion, nil)), - } - - e2e.Run[kindEnv](t, &kindSuite{}, e2eParams...) -} - // kindProvisioner Pulumi E2E provisioner to deploy the Operator binary with kustomize and deploy DDA manifest func kindProvisioner(k8sVersion string, extraKustomizeResources []string) provisioners.Provisioner { return provisioners.NewTypedPulumiProvisioner[kindEnv]("kind-operator", func(ctx *pulumi.Context, env *kindEnv) error { @@ -205,264 +147,3 @@ func kindProvisioner(k8sVersion string, extraKustomizeResources []string) provis "ddinfra:kubernetesVersion": auto.ConfigValue{Value: k8sVersion}, }) } - -func (s *kindSuite) TestKindRun() { - var ddaConfigPath string - - // Get E2E kubernetes context and set up terratest kubectlOptions - cleanUpContext, err := contextConfig(s.Env().Kind.ClusterOutput.KubeConfig) - s.Assert().NoError(err, "Error retrieving E2E kubeconfig.") - defer cleanUpContext() - - kubectlOptions = k8s.NewKubectlOptions("", kubeConfigPath, namespaceName) - - s.T().Run("Operator deploys to kind cluster", func(t *testing.T) { - verifyOperator(t, kubectlOptions) - }) - - s.T().Run("Minimal DDA deploys agent resources", func(t *testing.T) { - // Install DDA - ddaConfigPath, err = getAbsPath(ddaMinimalPath) - assert.NoError(t, err) - k8s.KubectlApply(t, kubectlOptions, ddaConfigPath) - verifyAgentPods(t, kubectlOptions, nodeAgentSelector+",agent.datadoghq.com/e2e-test=datadog-agent-minimum") - verifyNumPodsForSelector(t, kubectlOptions, 1, clusterAgentSelector+",agent.datadoghq.com/e2e-test=datadog-agent-minimum") - }) - - s.T().Run("Autodiscovery works", func(t *testing.T) { - // Add nginx with annotations - var nginxConfigPath string - nginxConfigPath, err = getAbsPath(filepath.Join(manifestsPath, "autodiscovery-annotation.yaml")) - assert.NoError(t, err) - k8s.KubectlApply(t, kubectlOptions, nginxConfigPath) - - verifyNumPodsForSelector(t, kubectlOptions, 1, "agent.datadoghq.com/e2e-test=datadog-agent-autodiscovery-annotated") - - // check agent pods for http check - s.EventuallyWithTf(func(c *assert.CollectT) { - agentPods, err := k8s.ListPodsE(t, kubectlOptions, v1.ListOptions{ - LabelSelector: nodeAgentSelector + ",agent.datadoghq.com/e2e-test=datadog-agent-minimum", - FieldSelector: "status.phase=Running", - }) - assert.NoError(c, err) - - for _, pod := range agentPods { - k8s.WaitUntilPodAvailable(t, kubectlOptions, pod.Name, 9, 15*time.Second) - - output, err := k8s.RunKubectlAndGetOutputE(t, kubectlOptions, "exec", "-it", pod.Name, "--", "agent", "status", "-j") - assert.NoError(c, err) - - verifyCheck(c, output, "http_check") - } - }, 300*time.Second, 30*time.Second, "could not validate http check on agent pod") - - s.EventuallyWithTf(func(c *assert.CollectT) { - verifyHTTPCheck(s, c) - }, 300*time.Second, 30*time.Second, "could not validate http.can_connect check with api client") - }) - - s.T().Run("Kubelet check works", func(t *testing.T) { - s.EventuallyWithTf(func(c *assert.CollectT) { - agentPods, err := k8s.ListPodsE(t, kubectlOptions, v1.ListOptions{ - LabelSelector: nodeAgentSelector + ",agent.datadoghq.com/e2e-test=datadog-agent-minimum", - FieldSelector: "status.phase=Running", - }) - assert.NoError(c, err) - - for _, pod := range agentPods { - k8s.WaitUntilPodAvailable(t, kubectlOptions, pod.Name, 9, 15*time.Second) - - output, err := k8s.RunKubectlAndGetOutputE(t, kubectlOptions, "exec", "-it", pod.Name, "--", "agent", "status", "collector", "-j") - assert.NoError(c, err) - - verifyCheck(c, output, "kubelet") - } - }, 300*time.Second, 30*time.Second, "could not validate kubelet check on agent pod") - - metricQuery := fmt.Sprintf("exclude_null(avg:kubernetes.cpu.usage.total{kube_cluster_name:%s, container_id:*})", s.Env().Kind.ClusterName) - s.EventuallyWithTf(func(c *assert.CollectT) { - resp, _, err := s.datadogClient.metricsApi.QueryMetrics(s.datadogClient.ctx, time.Now().Add(-time.Minute*5).Unix(), time.Now().Add(time.Minute*5).Unix(), metricQuery) - - assert.Truef(c, len(resp.Series) > 0, "expected metric series for query `%s` to not be empty: %s", metricQuery, err) - }, 600*time.Second, 30*time.Second, fmt.Sprintf("metric series has not changed to not empty with query %s", metricQuery)) - }) - - s.T().Run("KSM Check Works (cluster check)", func(t *testing.T) { - s.EventuallyWithTf(func(c *assert.CollectT) { - clusterAgentPods, err := k8s.ListPodsE(t, kubectlOptions, v1.ListOptions{ - LabelSelector: clusterAgentSelector + ",agent.datadoghq.com/e2e-test=datadog-agent-minimum", - FieldSelector: "status.phase=Running", - }) - assert.NoError(t, err) - - for _, pod := range clusterAgentPods { - k8s.WaitUntilPodAvailable(t, kubectlOptions, pod.Name, 9, 15*time.Second) - output, err := k8s.RunKubectlAndGetOutputE(t, kubectlOptions, "exec", "-it", pod.Name, "--", "agent", "status", "collector", "-j") - assert.NoError(t, err) - - verifyCheck(c, output, "kubernetes_state_core") - } - }, 300*time.Second, 30*time.Second, "could not validate kubernetes_state_core check on cluster agent pod") - - s.EventuallyWithTf(func(c *assert.CollectT) { - verifyKSMCheck(s, c) - }, 300*time.Second, 30*time.Second, "could not validate kubernetes_state_core check with api client") - }) - - s.T().Run("KSM Check Works (cluster check runner)", func(t *testing.T) { - // Update DDA - ddaConfigPath, err = getAbsPath(filepath.Join(manifestsPath, "datadog-agent-ccr-enabled.yaml")) - assert.NoError(t, err) - k8s.KubectlApply(t, kubectlOptions, ddaConfigPath) - verifyAgentPods(t, kubectlOptions, nodeAgentSelector+",agent.datadoghq.com/e2e-test=datadog-agent-ccr-enabled") - verifyNumPodsForSelector(t, kubectlOptions, 1, clusterAgentSelector+",agent.datadoghq.com/e2e-test=datadog-agent-ccr-enabled") - verifyNumPodsForSelector(t, kubectlOptions, 1, clusterCheckRunnerSelector+",agent.datadoghq.com/e2e-test=datadog-agent-ccr-enabled") - - s.EventuallyWithTf(func(c *assert.CollectT) { - ccrPods, err := k8s.ListPodsE(t, kubectlOptions, v1.ListOptions{ - LabelSelector: clusterCheckRunnerSelector + ",agent.datadoghq.com/e2e-test=datadog-agent-ccr-enabled", - FieldSelector: "status.phase=Running", - }) - assert.NoError(c, err) - - for _, ccr := range ccrPods { - k8s.WaitUntilPodAvailable(t, kubectlOptions, ccr.Name, 9, 15*time.Second) - output, err := k8s.RunKubectlAndGetOutputE(t, kubectlOptions, "exec", "-it", ccr.Name, "--", "agent", "status", "collector", "-j") - assert.NoError(c, err) - - verifyCheck(c, output, "kubernetes_state_core") - } - }, 300*time.Second, 30*time.Second, "could not validate kubernetes_state_core check on cluster check runners pod") - - s.EventuallyWithTf(func(c *assert.CollectT) { - verifyKSMCheck(s, c) - }, 300*time.Second, 30*time.Second, "could not validate kubernetes_state_core check with api client") - }) - - s.T().Run("Logs collection works", func(t *testing.T) { - // Update DDA - ddaConfigPath, err = getAbsPath(filepath.Join(manifestsPath, "datadog-agent-logs.yaml")) - assert.NoError(t, err) - - k8s.KubectlApply(t, kubectlOptions, ddaConfigPath) - verifyAgentPods(t, kubectlOptions, nodeAgentSelector+",agent.datadoghq.com/e2e-test=datadog-agent-logs") - - // Verify logs collection on agent pod - s.EventuallyWithTf(func(c *assert.CollectT) { - agentPods, err := k8s.ListPodsE(t, kubectlOptions, v1.ListOptions{ - LabelSelector: nodeAgentSelector + ",agent.datadoghq.com/e2e-test=datadog-agent-logs", - FieldSelector: "status.phase=Running", - }) - assert.NoError(c, err) - - for _, pod := range agentPods { - k8s.WaitUntilPodAvailable(t, kubectlOptions, pod.Name, 9, 15*time.Second) - - output, err := k8s.RunKubectlAndGetOutputE(t, kubectlOptions, "exec", "-it", pod.Name, "--", "agent", "status", "logs agent", "-j") - assert.NoError(c, err) - - verifyAgentPodLogs(c, output) - } - }, 300*time.Second, 30*time.Second, "could not validate log check on agent pod") - - s.EventuallyWithTf(func(c *assert.CollectT) { - verifyAPILogs(s, c) - }, 300*time.Second, 30*time.Second, "could not valid logs collection with api client") - - }) - - s.T().Run("Cleanup DDA", func(t *testing.T) { - deleteDda(t, kubectlOptions, ddaConfigPath) - }) -} - -func verifyAgentPodLogs(c *assert.CollectT, collectorOutput string) { - var agentLogs []interface{} - logsJson := parseCollectorJson(collectorOutput) - - tailedIntegrations := 0 - if logsJson != nil { - agentLogs = logsJson["logsStats"].(map[string]interface{})["integrations"].([]interface{}) - for _, log := range agentLogs { - if integration, ok := log.(map[string]interface{})["sources"].([]interface{})[0].(map[string]interface{}); ok { - message, exists := integration["messages"].([]interface{})[0].(string) - if exists && len(message) > 0 { - num, _ := strconv.Atoi(string(message[0])) - if num > 0 && strings.Contains(message, "files tailed") { - tailedIntegrations++ - } - } - } else { - assert.True(c, ok, "Failed to get sources from logs. Possible causes: missing 'sources' field, empty array, or incorrect data format.") - } - } - } - totalIntegrations := len(agentLogs) - assert.True(c, tailedIntegrations >= totalIntegrations*80/100, "Expected at least 80%% of integrations to be tailed, got %d/%d", tailedIntegrations, totalIntegrations) -} - -func verifyCheck(c *assert.CollectT, collectorOutput string, checkName string) { - var runningChecks map[string]interface{} - - checksJson := parseCollectorJson(collectorOutput) - if checksJson != nil { - runningChecks = checksJson["runnerStats"].(map[string]interface{})["Checks"].(map[string]interface{}) - if check, found := runningChecks[checkName].(map[string]interface{}); found { - for _, instance := range check { - assert.EqualValues(c, checkName, instance.(map[string]interface{})["CheckName"].(string)) - - lastError, exists := instance.(map[string]interface{})["LastError"].(string) - assert.True(c, exists) - assert.Empty(c, lastError) - - totalErrors, exists := instance.(map[string]interface{})["TotalErrors"].(float64) - assert.True(c, exists) - assert.Zero(c, totalErrors) - - totalMetricSamples, exists := instance.(map[string]interface{})["TotalMetricSamples"].(float64) - assert.True(c, exists) - assert.Greater(c, totalMetricSamples, float64(0)) - } - } else { - assert.True(c, found, fmt.Sprintf("Check %s not found or not yet running.", checkName)) - } - } -} - -func verifyAPILogs(s *kindSuite, c *assert.CollectT) { - logQuery := fmt.Sprintf("kube_cluster_name:%s", s.Env().Kind.ClusterName) - requestBody := datadogV1.LogsListRequest{ - Query: &logQuery, - Time: datadogV1.LogsListRequestTime{ - From: time.Now().AddDate(0, 0, -1), // One day ago - To: time.Now(), - }, - Limit: datadog.PtrInt32(100), - } - - resp, _, err := s.datadogClient.logsApi.ListLogs(s.datadogClient.ctx, requestBody) - - assert.NoError(c, err, "failed to query logs: %v", err) - assert.True(c, len(resp.Logs) > 0, fmt.Sprintf("expected logs to not be empty: %s", err)) -} - -func verifyKSMCheck(s *kindSuite, c *assert.CollectT) { - metricQuery := fmt.Sprintf("exclude_null(avg:kubernetes_state.container.running{kube_cluster_name:%s, kube_container_name:*})", s.Env().Kind.ClusterName) - - resp, _, err := s.datadogClient.metricsApi.QueryMetrics(s.datadogClient.ctx, time.Now().AddDate(0, 0, -1).Unix(), time.Now().Unix(), metricQuery) - - assert.True(c, len(resp.Series) > 0, fmt.Sprintf("expected metric series to not be empty: %s", err)) -} - -func verifyHTTPCheck(s *kindSuite, c *assert.CollectT) { - metricQuery := fmt.Sprintf("exclude_null(avg:network.http.can_connect{kube_cluster_name:%s})", s.Env().Kind.ClusterName) - - resp, _, err := s.datadogClient.metricsApi.QueryMetrics(s.datadogClient.ctx, time.Now().AddDate(0, 0, -1).Unix(), time.Now().Unix(), metricQuery) - assert.EqualValues(c, *resp.Status, "ok") - for _, series := range resp.Series { - for _, point := range series.Pointlist { - assert.Equal(c, int(*point[1]), 1) - } - } - assert.True(c, len(resp.Series) > 0, fmt.Sprintf("expected metric series to not be empty: %s", err)) -} diff --git a/test/e2e/main.go b/test/e2e/main.go index 789b1aaf1..90dd37bc5 100644 --- a/test/e2e/main.go +++ b/test/e2e/main.go @@ -3,9 +3,6 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. -//go:build e2e -// +build e2e - package e2e import ( diff --git a/test/e2e/manifests/autodiscovery-annotation.yaml b/test/e2e/manifests/autodiscovery-annotation.yaml deleted file mode 100644 index 54ad98f45..000000000 --- a/test/e2e/manifests/autodiscovery-annotation.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx-deployment - labels: - app: nginx - namespace: e2e-operator -spec: - replicas: 1 - selector: - matchLabels: - app: nginx - e2e: autodiscovery - template: - metadata: - annotations: - ad.datadoghq.com/nginx.check_names: '["http_check"]' - ad.datadoghq.com/nginx.init_configs: '[{}]' - ad.datadoghq.com/nginx.instances: | - [ - { - "name": "http_custom_identifier", - "url": "http://www.google.com" - } - ] - ad.datadoghq.com/tolerate-unready: "true" - labels: - app: nginx - e2e: autodiscovery - spec: - containers: - - name: nginx - image: nginx:1.14.2 - ports: - - containerPort: 80 diff --git a/test/e2e/manifests/datadog-agent-ccr-enabled.yaml b/test/e2e/manifests/datadog-agent-ccr-enabled.yaml deleted file mode 100644 index eedf8b6fd..000000000 --- a/test/e2e/manifests/datadog-agent-ccr-enabled.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: datadoghq.com/v2alpha1 -kind: DatadogAgent -metadata: - name: datadog-ccr-enabled - namespace: e2e-operator - labels: - agent.datadoghq.com/e2e-test: datadog-agent-ccr-enabled -spec: - global: - kubelet: - tlsVerify: false - features: - clusterChecks: - enabled: true - useClusterChecksRunners: true - liveContainerCollection: - enabled: true - logCollection: - enabled: true diff --git a/test/e2e/manifests/datadog-agent-logs.yaml b/test/e2e/manifests/datadog-agent-logs.yaml deleted file mode 100644 index 2e8ffc771..000000000 --- a/test/e2e/manifests/datadog-agent-logs.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: datadoghq.com/v2alpha1 -kind: DatadogAgent -metadata: - name: datadog-agent-logs - namespace: e2e-operator - labels: - agent.datadoghq.com/e2e-test: datadog-agent-logs -spec: - global: - kubelet: - tlsVerify: false - features: - clusterChecks: - enabled: true - useClusterChecksRunners: false - logCollection: - enabled: true - containerCollectAll: true - liveContainerCollection: - enabled: true diff --git a/test/e2e/manifests/datadog-agent-minimum.yaml b/test/e2e/manifests/datadog-agent-minimum.yaml index cb73cd537..60d4fb027 100644 --- a/test/e2e/manifests/datadog-agent-minimum.yaml +++ b/test/e2e/manifests/datadog-agent-minimum.yaml @@ -1,10 +1,56 @@ apiVersion: datadoghq.com/v2alpha1 kind: DatadogAgent metadata: - namespace: e2e-operator - labels: - agent.datadoghq.com/e2e-test: datadog-agent-minimum + name: datadog spec: global: + credentials: + apiSecret: + keyName: api-key + secretName: datadog-secret + appSecret: + keyName: app-key + secretName: datadog-secret kubelet: tlsVerify: false + features: + clusterChecks: + enabled: true + useClusterChecksRunners: false + logCollection: + enabled: true + liveContainerCollection: + enabled: true + override: + nodeAgent: + labels: + agent.datadoghq.com/e2e-test: datadog-agent-minimum + containers: + agent: + env: + - name: DD_SKIP_SSL_VALIDATION + value: "true" + env: + - name: DD_CLUSTER_NAME + valueFrom: + configMapKeyRef: + name: datadog-cluster-name + key: DD_CLUSTER_NAME + clusterAgent: + labels: + agent.datadoghq.com/e2e-test: datadog-agent-minimum + env: + - name: DD_CLUSTER_NAME + valueFrom: + configMapKeyRef: + name: datadog-cluster-name + key: DD_CLUSTER_NAME + clusterChecksRunner: + labels: + agent.datadoghq.com/e2e-test: datadog-agent-minimum + env: + - name: DD_CLUSTER_NAME + valueFrom: + configMapKeyRef: + name: datadog-cluster-name + key: DD_CLUSTER_NAME \ No newline at end of file diff --git a/test/e2e/provisioners/kind.go b/test/e2e/provisioners/kind.go index d404478e8..64f3680cd 100644 --- a/test/e2e/provisioners/kind.go +++ b/test/e2e/provisioners/kind.go @@ -7,16 +7,16 @@ package provisioners import ( "fmt" - "github.com/DataDog/test-infra-definitions/scenarios/aws/ec2" "os" "strings" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/provisioners" awskubernetes "github.com/DataDog/datadog-agent/test/new-e2e/pkg/provisioners/aws/kubernetes" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/optional" + "github.com/DataDog/test-infra-definitions/scenarios/aws/ec2" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner" - "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/optional" "github.com/DataDog/datadog-operator/test/e2e/common" "github.com/DataDog/test-infra-definitions/common/config" "github.com/DataDog/test-infra-definitions/components/datadog/agent" diff --git a/test/e2e/rc_updater_test.go b/test/e2e/rc_updater_test.go index 10501e52a..5d82815ce 100644 --- a/test/e2e/rc_updater_test.go +++ b/test/e2e/rc_updater_test.go @@ -3,9 +3,6 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. -//go:build e2e -// +build e2e - package e2e import ( diff --git a/test/e2e/tests/k8s_suite/kind_local_test.go b/test/e2e/tests/k8s_suite/kind_local_test.go index b3c5e4494..ae678b254 100644 --- a/test/e2e/tests/k8s_suite/kind_local_test.go +++ b/test/e2e/tests/k8s_suite/kind_local_test.go @@ -11,6 +11,7 @@ import ( "github.com/DataDog/datadog-operator/test/e2e/common" "github.com/DataDog/datadog-operator/test/e2e/provisioners" "github.com/DataDog/test-infra-definitions/components/datadog/operatorparams" + "os" "strings" "testing" ) @@ -26,6 +27,9 @@ func (s *localKindSuite) SetupSuite() { } func TestLocalKindSuite(t *testing.T) { + if strings.ToLower(os.Getenv("GITLAB_CI")) == "true" { + t.Skip("Skipping LocalKindSuite test in CI") + } operatorOptions := []operatorparams.Option{ operatorparams.WithNamespace(common.NamespaceName), operatorparams.WithOperatorFullImagePath(common.OperatorImageName),