|
| 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