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

Refactor E2E tests #1577

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ variables:
RH_PARTNER_REGISTRY_USER: "redhat-isv-containers+5e7c8ebc1c86a3163d1a69be-robot"
RH_PARTNER_REGISTRY_KEY_SSM_KEY: redhat_registry_key
RH_PARTNER_API_KEY_SSM_KEY: redhat_api_key
TEST_INFRA_DEFINITIONS_BUILDIMAGES: 3c7d2dc2d3dd
TEST_INFRA_DEFINITIONS_BUILDIMAGES: 10486aec63a8
PUSH_IMAGES_TO_STAGING:
description: "Set PUSH_IMAGE_TO_STAGING to 'true' if you want to push the operator to internal staging registry."

Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,12 @@ integration-tests-v2: $(ENVTEST) ## Run tests with reconciler V2

.PHONY: e2e-tests
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`.
KUBEBUILDER_ASSETS="$(ROOT)/bin/$(PLATFORM)/" go test -C test/e2e --tags=e2e github.com/DataDog/datadog-operator/e2e -v -timeout 1h -coverprofile cover_e2e.out
KUBEBUILDER_ASSETS="$(ROOT)/bin/$(PLATFORM)/" go test -C test/e2e ./... --tags=e2e -run TestLocalKindSuite -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`.
KUBEBUILDER_ASSETS="$(ROOT)/bin/$(PLATFORM)/" go test -C test/e2e --tags=e2e github.com/DataDog/datadog-operator/e2e -v -timeout 1h -coverprofile cover_e2e_keep_stacks.out -args -keep-stacks=true
KUBEBUILDER_ASSETS="$(ROOT)/bin/$(PLATFORM)/" go test -C test/e2e ./... --tags=e2e -run TestLocalKindSuite -v -timeout 0s -coverprofile cover_e2e_keep_stacks.out -args -keep-stacks=true

.PHONY: bundle
bundle: bin/$(PLATFORM)/operator-sdk bin/$(PLATFORM)/yq $(KUSTOMIZE) manifests ## Generate bundle manifests and metadata, then validate generated files.
Expand Down
72 changes: 36 additions & 36 deletions config/e2e/e2e-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ kind: Namespace
metadata:
labels:
app.kubernetes.io/name: datadog-operator
name: system
name: e2e-operator
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: manager
namespace: system
namespace: e2e-operator
labels:
app.kubernetes.io/name: datadog-operator
control-plane: controller-manager
Expand All @@ -24,40 +24,40 @@ spec:
app.kubernetes.io/name: datadog-operator
spec:
containers:
- command:
- /manager
args:
- --enable-leader-election
- --pprof
image: controller:latest
imagePullPolicy: IfNotPresent
name: manager
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
resources:
limits:
cpu: 100m
memory: 250Mi
requests:
cpu: 100m
memory: 250Mi
ports:
- name: metrics
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /healthz/
port: 8081
periodSeconds: 10
- command:
- /manager
args:
- --enable-leader-election
- --pprof
image: controller:latest
imagePullPolicy: IfNotPresent
name: manager
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
resources:
limits:
cpu: 100m
memory: 250Mi
requests:
cpu: 100m
memory: 250Mi
ports:
- name: metrics
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /healthz/
port: 8081
periodSeconds: 10
imagePullSecrets:
- name: registry-credentials
terminationGracePeriodSeconds: 10
serviceAccountName: controller-manager
serviceAccountName: controller-manager
2 changes: 1 addition & 1 deletion config/e2e/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ images:
newTag: latest
kind: Kustomization
namePrefix: datadog-operator-e2e-
namespace: system
namespace: e2e-operator
patches:
- path: rc-e2e-manager.yaml
target:
Expand Down
2 changes: 1 addition & 1 deletion config/e2e/rc-e2e-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: manager
namespace: system
namespace: e2e-operator
labels:
app.kubernetes.io/name: datadog-operator
control-plane: controller-manager
Expand Down
7 changes: 7 additions & 0 deletions config/new-e2e/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namePrefix: datadog-operator-e2e-
namespace: e2e-operator
resources:
- ../crd
- ../rbac
40 changes: 21 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/DataDog/datadog-operator

go 1.22.0
go 1.22.5

toolchain go1.22.7
toolchain go1.23.0

require (
github.com/DataDog/datadog-api-client-go/v2 v2.27.0
Expand All @@ -22,7 +22,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
github.com/zorkian/go-datadog-api v2.30.0+incompatible
go.uber.org/zap v1.26.0
go.uber.org/zap v1.27.0
gopkg.in/DataDog/dd-trace-go.v1 v1.68.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -44,8 +44,8 @@ require (
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.59.0-rc.5
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/prometheus/client_golang v1.19.1
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
golang.org/x/text v0.18.0
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f
golang.org/x/text v0.20.0
k8s.io/kubectl v0.31.1
)

Expand All @@ -68,7 +68,7 @@ require (
github.com/DataDog/gostackparse v0.7.0 // indirect
github.com/DataDog/sketches-go v1.4.5 // indirect
github.com/DataDog/viper v1.13.5 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/andybalholm/brotli v1.0.6 // indirect
Expand Down Expand Up @@ -105,6 +105,8 @@ require (
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down Expand Up @@ -162,21 +164,21 @@ require (
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.25.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.31.0 // indirect
fanny-jiang marked this conversation as resolved.
Show resolved Hide resolved
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/time v0.8.0 // indirect
golang.org/x/tools v0.27.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
Expand Down
Loading
Loading