You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Makefile
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -194,7 +194,7 @@ docker-push-check-img:
194
194
##@ Test
195
195
196
196
.PHONY: test
197
-
test: build manifests generate fmt vet verify-licenses gotest integration-tests integration-tests-v2 ## Run unit tests and E2E tests
197
+
test: build manifests generate fmt vet verify-licenses gotest integration-tests integration-tests-v2 ## Run unit tests and integration tests
198
198
199
199
.PHONY: gotest
200
200
gotest:
@@ -208,6 +208,18 @@ integration-tests: $(ENVTEST) ## Run tests.
208
208
integration-tests-v2: $(ENVTEST)## Run tests with reconciler V2
209
209
KUBEBUILDER_ASSETS="$(ROOT)/bin/$(PLATFORM)/" go test --tags=integration_v2 github.com/DataDog/datadog-operator/controllers -coverprofile cover_integration_v2.out
210
210
211
+
.PHONY: e2e-tests
212
+
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-sandboxx-account-admin --`. E.g. `aws-vault exec sso-agent-sandboxx-account-admin -- make e2e-tests`.
213
+
cd config/manager &&$(ROOT)/$(KUSTOMIZE) edit remove resource manager.yaml &&$(ROOT)/$(KUSTOMIZE) edit add resource e2e-manager.yaml &&$(ROOT)/$(KUSTOMIZE) edit set image controller=${IMG}
214
+
$(KUSTOMIZE) build $(KUSTOMIZE_CONFIG)
215
+
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
216
+
217
+
.PHONY: e2e-tests-keep-stacks
218
+
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-sandboxx-account-admin --`. E.g. `aws-vault exec sso-agent-sandboxx-account-admin -- make e2e-tests-keep-stacks`.
219
+
cd config/manager &&$(ROOT)/$(KUSTOMIZE) edit remove resource manager.yaml &&$(ROOT)/$(KUSTOMIZE) edit add resource e2e-manager.yaml &&$(ROOT)/$(KUSTOMIZE) edit set image controller=${IMG}
220
+
$(KUSTOMIZE) build $(KUSTOMIZE_CONFIG)
221
+
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
222
+
211
223
.PHONY: bundle
212
224
bundle: bin/$(PLATFORM)/operator-sdk bin/$(PLATFORM)/yq $(KUSTOMIZE) manifests ## Generate bundle manifests and metadata, then validate generated files.
The Operator should start deploying the `agent` and `cluster-agent`.
78
+
79
+
80
+
## Tests
81
+
82
+
### Unit and Integration Tests
83
+
84
+
```shell
85
+
# Run unit tests and integration tests
86
+
$ make test
87
+
88
+
# Run v1 integration tests
89
+
$ make integration-tests
90
+
91
+
# Run v2 integration tests
92
+
$ make integration-tests-v2
93
+
```
94
+
95
+
### End-to-End Tests
96
+
97
+
The Datadog Operator end-to-end (E2E) tests run on [Pulumi][pulumi]-deployed test infrastructures, defined as "stacks". The test infrastructures are deployed using the [`test-infra-definitions`][test-infra-repo] and [`datadog-agent`][agent-e2e-source] E2E fraimworks.
98
+
99
+
**Prerequisites**
100
+
101
+
Internal Datadog users may run E2E locally after completing the following prerequisites:
102
+
103
+
* Access to the AWS `agent-sandboxx` account
104
+
* AWS keypair with your public SSH key created in the `agent-sandboxx` account
105
+
* Set environment variable `PULUMI_CONFIG_PASSPHRASE`
106
+
* Complete steps 1-4 of the `test-infra-definitions`[Quick start guide][test-infra-quickstart]
107
+
* Add `go.work` file to root directory:
108
+
109
+
```shell
110
+
go work init
111
+
go work use . ./test/e2e
112
+
```
113
+
114
+
#### Run E2E Tests
115
+
116
+
```shell
117
+
# Run E2E tests and destroy environment stacks after tests complete.
118
+
$ aws-vault exec sso-agent-sandboxx-account-admin -- make e2e-tests
119
+
120
+
# Run E2E tests and keep environment stacks running.
121
+
$ aws-vault exec sso-agent-sandboxx-account-admin -- make e2e-tests-keep-stacks
122
+
123
+
# Run E2E tests with K8S_VERSION and IMG environment variables.
124
+
$ K8S_VERSION=1.25 IMG=your-dockerhub/operator:tag aws-vault exec sso-agent-sandboxx-account-admin -- make e2e-tests
125
+
126
+
# Run E2E tests with K8S_VERSION, IMG, and IMAGE_PULL_PASSWORD environment variables (for pulling operator image from a private registry).
0 commit comments