Skip to content

Commit

Permalink
update e2e tests/bump infra ci image
Browse files Browse the repository at this point in the history
  • Loading branch information
fanny-jiang committed Feb 14, 2024
1 parent 29a29da commit e7f2b5d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ stages:

e2e:
stage: e2e
# rules:
# - if: $CI_COMMIT_BRANCH == "main"
rules:
- if: $CI_COMMIT_BRANCH == "main"
# changes:
# paths:
# - charts/**/*.yaml
# - test/**/*
# compare_to: "refs/heads/main"
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/test-infra-definitions/runner:986d192b
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/test-infra-definitions/runner:95dca87f269a
tags: ["arch:amd64"]
before_script:
# Update awscli v2
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ vet:

.PHONY: unit-test
unit-test:
go test -C test ./... -count=1 -skip=E2E
go test -C test ./... -count=1

.PHONY: update-test-baselines
update-test-baselines:
go test -C test ./... -count=1 -skip=E2E -args -updateBaselines=true
go test -C test ./... -count=1 -args -updateBaselines=true

.PHONY: integration-test
integration-test:
go test -C test/integ --tags=integration -skip=E2E -count=1 -v
go test -C test/integ --tags=integration -count=1 -v

# Running E2E tests locally:
## Must be connected to appgate
Expand All @@ -67,14 +67,14 @@ test-e2e: fmt vet e2e-test
# aws-vault exec sso-agent-sandbox-account-admin -- make e2e-test
.PHONY: e2e-test
e2e-test:
E2E_CONFIG_PARAMS=$(E2E_CONFIG_PARAMS) E2E_PROFILE=$(E2E_PROFILE) go test -C test ./... -v -run=E2E -vet=off -timeout 1h -count=1
E2E_CONFIG_PARAMS=$(E2E_CONFIG_PARAMS) E2E_PROFILE=$(E2E_PROFILE) go test -C test/e2e ./... --tags=e2e -v -vet=off -timeout 1h -count=1

# aws-vault exec sso-agent-sandbox-account-admin -- make e2e-test-preserve-stacks
.PHONY: e2e-test-preserve-stacks
e2e-test-preserve-stacks:
E2E_CONFIG_PARAMS=$(E2E_CONFIG_PARAMS) E2E_PROFILE=$(E2E_PROFILE) go test -C test ./... -v -run=E2E -vet=off -timeout 1h -count=1 -args -preserveStacks=true
E2E_CONFIG_PARAMS=$(E2E_CONFIG_PARAMS) E2E_PROFILE=$(E2E_PROFILE) go test -C test/e2e ./... --tags=e2e -v -vet=off -timeout 1h -count=1 -args -preserveStacks=true

# aws-vault exec sso-agent-sandbox-account-admin -- make e2e-test-cleanup-stacks
.PHONY: e2e-test-cleanup-stacks
e2e-test-cleanup-stacks:
E2E_CONFIG_PARAMS=$(E2E_CONFIG_PARAMS) E2E_PROFILE=$(E2E_PROFILE) go test -C test ./... -v -run=E2E -vet=off -timeout 1h -count=1 -args -destroyStacks=true
E2E_CONFIG_PARAMS=$(E2E_CONFIG_PARAMS) E2E_PROFILE=$(E2E_PROFILE) go test -C test/e2e ./... --tags=e2e -v -vet=off -timeout 1h -count=1 -args -destroyStacks=true
23 changes: 15 additions & 8 deletions test/datadog/e2e_eks_test.go → test/e2e/datadog/e2e_eks_test.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
//go:build e2e
// +build e2e

package datadog

import (
"fmt"
"testing"

"github.com/DataDog/datadog-agent/test/new-e2e/runner"
"github.com/DataDog/helm-charts/test/common"
"github.com/pulumi/pulumi/sdk/v3/go/auto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"

"github.com/DataDog/helm-charts/test/common"
)

const namespace = "datadog"
Expand All @@ -30,8 +34,6 @@ func Test_E2E_AgentOnEKS(t *testing.T) {
"ddtestworkload:deploy": auto.ConfigValue{Value: "false"},
"ddinfra:aws/eks/linuxBottlerocketNodeGroup": auto.ConfigValue{Value: "false"},
"ddinfra:aws/eks/windowsNodeGroup": auto.ConfigValue{Value: "false"},
// TODO: remove when upstream eks-pulumi bug is fixed https://github.com/pulumi/pulumi-eks/pull/886
"pulumi:disable-default-providers": auto.ConfigValue{Value: "[]"},
}
stackConfig.Merge(config)

Expand All @@ -48,7 +50,7 @@ func Test_E2E_AgentOnEKS(t *testing.T) {
kc := kubeconfig.Value.(map[string]interface{})
_, restConfig, k8sClient, err = common.NewClientFromKubeconfig(kc)
if err == nil {
verifyPods(t)
t.Run("Verify pods", verifyPods)
}
} else {
err = fmt.Errorf("could not create Kubernetes client, cluster kubeconfig is nil")
Expand Down Expand Up @@ -79,10 +81,15 @@ func verifyPods(t *testing.T) {
RestConfig: restConfig,
}

assertPodStatus(t, podExec, ddaPodList, "agent")
assertPodStatus(t, podExec, dcaPodList, "cluster-agent")
assertPodStatus(t, podExec, ccPodList, "agent")

t.Run("Assert `agent` pod status", func(t *testing.T) {
assertPodStatus(t, podExec, ddaPodList, "agent")
})
t.Run("Assert `cluster-agent` pod status", func(t *testing.T) {
assertPodStatus(t, podExec, dcaPodList, "cluster-agent")
})
t.Run("Assert `cluster-check-runner` pod status", func(t *testing.T) {
assertPodStatus(t, podExec, ccPodList, "agent")
})
}

func assertPodStatus(t *testing.T, podExec common.K8sExec, podList *v1.PodList, containerName string) {
Expand Down
File renamed without changes.

0 comments on commit e7f2b5d

Please sign in to comment.