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: docs/test-framework-dev-guide.md
+125-7Lines changed: 125 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,27 @@ provides a high level overview of the testing framework.
16
16
Go version should be at least the same than the one in [.go-version](https://github.com/elastic/elastic-agent/blob/main/.go-version) file at the root of this repository.
17
17
18
18
19
-
### GCloud CLI
19
+
####GCloud CLI
20
20
The integration testing framework spins up resources in GCP. To achieve this, it needs the
21
21
[GCloud CLI](https://cloud.google.com/sdk/gcloud) to be installed on the system where the tests are initiated from.
22
22
23
-
### Beats
23
+
####Beats
24
24
The Elastic Agent package that is used for integration tests packages Beats built from the Unified Release (as opposed to DRA). There is no explicit action needed for this prerequisite but just keep in mind that if any Agent integration tests rely on certain Beats features or bugfixes, they may not be available in the integration tests yet because a unified release containing those features or bugfixes may not have happened yet.
25
25
26
+
#### Helm & Helm charts
27
+
To run the Kubernets integration tests you need to install
28
+
[helm](https://helm.sh/). Then add and update some helm charts
Make sure to run `helm repo update` before running K8s integration
37
+
tests otherwise the tests will fail stating a chart/version cannot be
38
+
found.
39
+
26
40
### Configuration
27
41
28
42
ESS (production) API Key to create on <https://cloud.elastic.co/account/keys>
@@ -39,6 +53,7 @@ If necessary, you can create a new serverless deployment manually; the previous
39
53
40
54
Credentials for these deployments are securely stored in Google and can only be accessed by Buildkite pipelines. The access control is set using [OpenID Connect in Google Cloud Platform](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-google-cloud-platform). And that's managed by the Robots team.
41
55
56
+
42
57
## Running tests
43
58
44
59
Some integration and E2E tests are safe to run locally. These tests set
@@ -60,9 +75,100 @@ Go to https://docker-auth.elastic.co/ and authenticate with Okta to receive your
60
75
61
76
[elastic_docker_registry]: docker.elastic.co
62
77
78
+
### Packaging
79
+
Before you can run any test, you first need to package the Elastic
80
+
Agent version you want to test. For that you'll need to run
The packaging process has many leavers that need to be correctly set:
87
+
88
+
-`DEV=true|false`: Build with debug symbols
89
+
-`EXTERNAL=true|false`: If `false` it will look for the `beats`
90
+
folder at the same level as `elastic-agent` and build
91
+
`x-pack/agentbeat` from there. Be aware that if you change Beats
92
+
code and there is already an Agentbeat artifact built, it will not
93
+
be re-build. You need to manually clean the Agentbeat build
94
+
folder. If `true` it will download the latest snapshot.
95
+
-`SNAPSHOT=true|false`: When downloading dependencies (like Beats)
96
+
use snapshot versions. That is required to package from the `main`
97
+
branch with `EXTERNAL=true`.
98
+
-`PLATFORMS`: Comma separated list of platforms you want to build. If
99
+
not set, it defaults to **ALL** platforms. [Selecting specific
100
+
platform](#selecting-specific-platform) contains a list of common
101
+
values. For a full list look at [`elastic-agent/dev-tools/mage/platforms.go`](https://github.com/elastic/elastic-agent/blob/main/dev-tools/mage/platforms.go#L15).
102
+
-`PACKAGES`: Comma separated list of packages you want to build. If
103
+
not set, it defaults to **ALL** packages, which takes a long time,
104
+
so make sure to *always* set it correctly. The packages are defined
@@ -80,11 +186,11 @@ The test are run with mage using the `integration` namespace:
80
186
81
187
#### Kubernetes oriented tests
82
188
83
-
-`mage integration:testKubernetes` to run kubernetes tests under the `testing/integration/k8s` folder for the default image on the default version of kubernetes (all previous commands will not run any kubernetes tests).
189
+
-`INSTANCE_PROVISIONER=kind mage integration:testKubernetes` to run kubernetes tests under the `testing/integration/k8s` folder for the default image on the default version of kubernetes (all previous commands will not run any kubernetes tests).
84
190
85
-
-`mage integration:testKubernetesMatrix` to run a matrix of kubernetes tests under the `testing/integration/k8s` folder for all image types and supported versions of kubernetes.
191
+
-`INSTANCE_PROVISIONER=kind mage integration:testKubernetesMatrix` to run a matrix of kubernetes tests under the `testing/integration/k8s` folder for all image types and supported versions of kubernetes.
86
192
87
-
-`mage integration:testKubernetesSingle [testName|all]` to execute a single test under the `testing/integration/k8s` folder. Only the selected test will be executed.
193
+
-`INSTANCE_PROVISIONER=kind mage integration:testKubernetesSingle [testName|all]` to execute a single test under the `testing/integration/k8s` folder. Only the selected test will be executed.
88
194
89
195
#### Serverless oriented tests
90
196
@@ -100,7 +206,7 @@ The test are run with mage using the `integration` namespace:
100
206
101
207
You can list all available mage targets by running `mage -l`
102
208
103
-
#### Selecting specific platform
209
+
#### Selecting specific platform<aname="selecting-specific-platform"></a>
104
210
105
211
By default, the runner will deploy to every combination of operating system and architecture that the tests define
106
212
as supporting. When working on tests and debugging an issue it's better to limit the operating system and architecture
@@ -493,3 +599,15 @@ using a separate env variable `AGENT_STACK_VERSION` like in this example (we use
### K8s: pod not read (`timeout waiting for k8s object elastic-agent-standalone-xxxxx to be ready`/`client rate limiter Wait returned an error: context deadline exceeded`)
604
+
Your Kind cluster might be in a broken state. Run:
0 commit comments