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
Enable e2e tests with cloud provider emulators for aws,gcp,azure (#743)
* Make e2e tests functional
* Provide support to run them with major cloud providers & their emulators
* Upgrade helm pkg `k8.io/helm/v2` to `helm.sh/helm/v3`
Copy file name to clipboardexpand all lines: docs/development/testing_and_dependencies.md
+4-13
Original file line number
Diff line number
Diff line change
@@ -33,24 +33,15 @@ By default, we run tests without computing code coverage. To get the code covera
33
33
34
34
### Integration tests
35
35
36
-
You can also run integration tests for etcd-backup-restore on any given Kubernetes cluster. The test creates namespace `integration-test` on the cluster and deploys the [etcd-backup-restore helm chart](../../chart/etcd-backup-restore) which in turn deploys the required secrets, configmap, services and finally the statefulset which contains the pod that runs etcd and backup-restore as a sidecar.
36
+
Integration tests are process based tests i.e spins up `etcd` and `etcdbr` as processes and runs the tests to check the functionality. The tests expect that the AWS credentials are present in the `$HOME/.aws` directory. Make sure to provide the correct credentials before running the tests.
37
37
38
38
```sh
39
-
make integration-test-cluster
39
+
make integration-test
40
40
```
41
41
42
-
:warning: Prerequisite for this command is to set the following environment variables:
43
-
44
-
- INTEGRATION_TEST_KUBECONFIG: kubeconfig to the cluster on which you wish to run the test
45
-
<!-- TODO: change the etcd wrapper version to a newer version which spawns etcd v3.4.34 -->
46
-
- ETCD_WRAPPER_VERSION: optional, defaults to `v0.2.0`
47
-
- ETCDBR_VERSION: optional, defaults to `v0.12.1`
48
-
- ACCESS_KEY_ID: S3 credentials
49
-
- SECRET_ACCESS_KEY: S3 credentials
50
-
- REGION: S3 credentials
51
-
- STORAGE_CONTAINER: S3 bucket name
42
+
### E2E tests
52
43
53
-
If you have a working setup of [TestMachinery](https://github.com/gardener/test-infra), you can run the integration tests on a TM-generated cluster as well.
44
+
The e2e tests for etcd-backup-restore are cluster-based tests located in the test/e2e package, run on Kubernetes clusters using both emulators and real cloud providers (AWS, GCP, Azure). These tests deploy the etcd-backup-restore helm chart to verify full functionality in various environments.
Copy file name to clipboardexpand all lines: docs/development/tests.md
+84
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,94 @@ Integration tests include the basic working of:
18
18
-**data validation**: corrupted etcd data should be marked for deletion and restoration should be triggered
19
19
-**restoration**: etcd data should be restored correctly from latest set of snapshots (full + deltas)
20
20
21
+
**Note**: The tests expects that the aws credentials are present in the `$HOME/.aws` directory. Make sure to provide the correct credentials before running the tests.
22
+
23
+
These tests can be run locally with both `etcd` and `etcdbr` running as processes. To execute the tests, run the following command:
24
+
25
+
```sh
26
+
make integration-test
27
+
```
28
+
21
29
### Unit tests
22
30
23
31
Each package within this repo contains its own set of unit tests to test the functionality of the methods contained within the packages.
24
32
25
33
### Performance regression tests
26
34
27
35
These tests help check any regression in performance in terms of memory consumption and CPU utilization.
36
+
37
+
### End-to-end tests
38
+
39
+
The e2e tests for etcd-backup-restore are cluster based tests located in the `test/e2e` package. These tests are run on a Kubernetes cluster and test the full functionality of etcd-backup-restore. The tests create a provider namespace on the cluster and deploy the [etcd-backup-restore helm chart](../../chart/etcd-backup-restore) which in turn deploys the required secrets, configmap, services and finally the statefulset which deploys the pod that runs etcd and backup-restore as a sidecar.
40
+
41
+
These tests are setup to be run with both emulators and real cloud providers. The emulators can be used for local development and testing as well as running jobs to test code changes when a PR is raised. The real cloud providers can be used for testing in a real cloud environment to ensure that the changes work as expected in an actual environment.
42
+
43
+
Currently, the tests can be run using the following cloud providers:
44
+
45
+
- AWS
46
+
- GCP
47
+
- Azure
48
+
49
+
#### Running the e2e tests with the emulators
50
+
51
+
##### On a Kind Cluster
52
+
53
+
To run the e2e tests with the emulators, run the following command:
54
+
55
+
```sh
56
+
make ci-e2e-kind PROVIDERS="{providers}"
57
+
```
58
+
59
+
By default, when no provider is specified, the tests are run using AWS emulator i.e Localstack as storage provider. The provider can be specified as comma separated values of the cloud providers mentioned above in small case. For example, to run the tests on AWS and GCP, run the following command:
60
+
61
+
```sh
62
+
make ci-e2e-kind PROVIDERS="aws,gcp"
63
+
```
64
+
65
+
##### On any Kubernetes Cluster
66
+
67
+
The e2e tests can also be run on any other cluster by running the following command:
68
+
69
+
> **_NOTE:_** If using emulators for e2e tests, make sure to port-forward the snapstore service to the local machine before running the tests.
70
+
71
+
- For AWS: `kubectl port-forward service/localstack 4566:4566`
72
+
- For GCP: `kubectl port-forward service/fake-gcs 4443:4443 8000:8000`
73
+
- For Azure: `kubectl port-forward service/azurite 10000:10000`
74
+
75
+
```sh
76
+
make test-e2e PROVIDERS="{providers}" KUBECONFIG="{path-to-kubeconfig}"
77
+
```
78
+
79
+
#### Running the e2e tests with real cloud providers
80
+
81
+
To run the tests with real cloud providers, the required credentials need to be set as environment variables before running the tests. See the below sections for the required environment variables for each cloud provider. To test with multiple providers, set the required environment variables for each provider.
82
+
83
+
##### Set the required environment variables
84
+
85
+
- AWS:
86
+
-`AWS_ACCESS_KEY_ID`
87
+
-`AWS_SECRET_ACCESS_KEY`
88
+
-`AWS_DEFAULT_REGION`
89
+
90
+
- GCP:
91
+
-`GOOGLE_APPLICATION_CREDENTIALS`
92
+
-`GCP_PROJECT_ID`
93
+
94
+
- Azure:
95
+
-`STORAGE_ACCOUNT`
96
+
-`STORAGE_KEY`
97
+
98
+
##### Run the tests
99
+
100
+
To run the tests with a kind cluster, run the following command:
101
+
102
+
```sh
103
+
make ci-e2e-kind PROVIDERS="{providers}"
104
+
```
105
+
106
+
To run the tests on any other cluster, run the following command:
107
+
108
+
```sh
109
+
make test-e2e PROVIDERS="{providers}" KUBECONFIG="{path-to-kubeconfig}"
0 commit comments