Skip to content

Commit 25a29f1

Browse files
authored
Create end-to-end testing document (#132)
Create a separate document for end-to-end testing.
1 parent c223aa8 commit 25a29f1

File tree

2 files changed

+62
-11
lines changed

2 files changed

+62
-11
lines changed

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,7 @@ This will run the unit tests for every library in the repository, not just for a
3939
Doing so ensures your testing will match what is run in the CI pipeline.
4040

4141
### Running End-to-End (e2e) Tests
42-
End-to-end tests validate the integration of the entire system. These tests require additional setup, such as setting a subscription ID. To run e2e tests, use the following command from the repository root:
43-
44-
```
45-
make e2e-test
46-
```
47-
48-
This command will:
49-
50-
1. Create a test user and associated SSH directory.
51-
2. Place mock SSH keys for testing.
52-
3. Run the tests and then clean up any test artifacts generated during the process.
42+
Please refer to [E2E_TESTING.md](docs/E2E_TESTING.md) for end-to-end testing.
5343

5444
## Contributing
5545

docs/E2E_TESTING.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Azure-init End-to-end Testing
2+
3+
End-to-end tests validate the integration of the entire system. These tests require additional setup, such as setting a subscription ID.
4+
5+
## Quickstart
6+
7+
To run e2e tests, use the following command from the repository root:
8+
9+
```
10+
make e2e-test
11+
```
12+
13+
This command will:
14+
15+
1. Create a test user and associated SSH directory.
16+
2. Place mock SSH keys for testing.
17+
3. Run the tests and then clean up any test artifacts generated during the process.
18+
19+
## Details
20+
21+
End-to-end testing of azure-init consists of 2 steps: preparation of SIG(Shared Image Gallery) image, and the actual testing.
22+
23+
### Preparation of Azure SIG image
24+
25+
To create an Azure SIG image to be used for end-to-end testing, run `image_creation.sh`.
26+
That will create a resource group, a storage account, a virtual machine, generate a SIG image, and publish the SIG image.
27+
28+
```
29+
demo/image_creation.sh
30+
```
31+
32+
If you want to run the script with custom variables for resource group, VM location, VM size, base image URN, etc., then specify corresponding environment variables. For example:
33+
34+
```
35+
RG="mytest-azinit" LOCATION="westeurope" VM_SIZE="Standard_D2ds_v5" BASE_IMAGE="Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest" demo/image_creation.sh
36+
```
37+
38+
The current limitation is, however, that the `BASE_IMAGE` should be one of Debian-derivatives like Ubuntu. When the build host OS is different from the target host OS, the `functional_test` binary might not be able to run due to mismatch of package versions such as glibc.
39+
40+
### Running end-to-end testing
41+
42+
To run end-to-end testing, use `make e2e-test`, which will create a test user, ssh directory, place mock ssh keys, and
43+
then clean up the test artifacts afterwards.
44+
45+
`VM_IMAGE` should be specified to pick the correct SIG image created in the previous step.
46+
47+
```
48+
VM_IMAGE="$(az sig image-definition list --resource-group testgalleryazinitrg --gallery-name testgalleryazinit | jq -r .[].id)" make e2e-test
49+
```
50+
51+
It is also possible to pass custom environment variables. For example:
52+
53+
```
54+
RG="mytest-azinit" LOCATION="westeurope" VM_SIZE="Standard_D2ds_v5" VM_IMAGE="$(az sig image-definition list --resource-group testgalleryazinitrg --gallery-name testgalleryazinit | jq -r .[].id)" make e2e-test
55+
```
56+
57+
When testing is done, it is recommended to clean up resource group for SIG images.
58+
59+
```
60+
az group delete --resource-group testgalleryazinitrg
61+
```

0 commit comments

Comments
 (0)