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/howto/system_testing.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,6 +143,32 @@ data "aws_ami" "latest-amzn" {
143
143
144
144
Notice the use of the `TEST_RUN_ID` variable. It contains a unique ID, which can help differentiate resources created in potential concurrent test runs.
145
145
146
+
#### Environment variables
147
+
148
+
To use environment variables within the Terraform service deployer a `env.yml` file is required.
149
+
150
+
The file should be structured like this:
151
+
152
+
```yaml
153
+
version: '2.3'
154
+
services:
155
+
terraform:
156
+
environment:
157
+
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
158
+
```
159
+
160
+
It's purpose is to inject environment variables in the Terraform service deployer environment.
161
+
162
+
To specify a default use this syntax: `AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-default}`, replacing `default` with the desired default value.
163
+
164
+
**NOTE**: Terraform requires to prefix variables using the environment variables form with `TF_VAR_`. These variables are not available in test case definitions because they are [not injected](https://github.com/elastic/elastic-package/blob/f5312b6022e3527684e591f99e73992a73baafcf/internal/testrunner/runners/system/servicedeployer/terraform_env.go#L43) in the test environment.
165
+
166
+
#### Cloud Provider CI support
167
+
168
+
Terraform is often used to interact with Cloud Providers. This require Cloud Provider credentials.
169
+
170
+
Injecting credentials can be achieved with functions from the [`apm-pipeline-library`](https://github.com/elastic/apm-pipeline-library/tree/main/vars) Jenkins library. For example look for `withAzureCredentials`, `withAWSEnv` or `withGCPEnv`.
171
+
146
172
### Kubernetes service deployer
147
173
148
174
The Kubernetes service deployer requires the `_dev/deploy/k8s` directory to be present. It can include additional `*.yaml` files to deploy
@@ -217,6 +243,9 @@ The `SERVICE_LOGS_DIR` placeholder is not the only one available for use in a da
217
243
218
244
Placeholders used in the `test-<test_name>-config.yml` must be enclosed in `{{` and `}}` delimiters, per Handlebars syntax.
219
245
246
+
247
+
**NOTE**: Terraform variables in the form of environment variables (prefixed with `TF_VAR_`) are not injected and cannot be used as placeholder (their value will always be empty).
248
+
220
249
## Running a system test
221
250
222
251
Once the two levels of configurations are defined as described in the previous section, you are ready to run system tests for a package's data streams.
@@ -264,3 +293,18 @@ to indexing generated data from the integration's data streams into Elasticsearc
264
293
```
265
294
elastic-package test system --generate
266
295
```
296
+
297
+
## Continuous Integration
298
+
299
+
`elastic-package` runs a set of system tests on some [dummy packages](https://github.com/elastic/elastic-package/tree/main/test/packages) to ensure it's functionalities work as expected. This allows to test changes affecting package testing within `elastic-package` before merging and releasing the changes.
300
+
301
+
Tests use set of environment variables that are set at the beginning of the `Jenkinsfile`.
302
+
303
+
The exposed environment variables are passed to the test runners through service deployer specific configuration (refer to the service deployer section for further details).
304
+
305
+
### Stack version
306
+
307
+
The tests use the [default version](https://github.com/elastic/elastic-package/blob/main/internal/install/stack_version.go#L9) `elastic-package` provides.
308
+
309
+
You can override this value by changing it in your PR if needed. To update the default version always create a dedicated PR.
0 commit comments