e5522df90c
Record app health heartbeat every 5 mins + default ExtensionEvent OperationId to VMWatchCohortId if VMWatchSettings specifies it in EnvironmentAttributes. |
||
---|---|---|
.. | ||
env | ||
test | ||
webserver | ||
README.md | ||
run.sh |
README.md
Integration Tests
This directory contains instructions and test files on how to test the extension binary in an environment that looks like an Azure Linux Virtual Machine.
Requirements
- Install Docker Engine on Linux or Docker for Mac.
- Install Bats.
Testing Strategy
The integation tests use bats
to run the scenarios as bash scripts.
To test the extension handler functionality, we simply:
- build a Docker image using test.Dockerfile
- copy some files to make it look like a
/var/lib/waagent
dir - copy extension binary into the container
- copy some files to make it look like a
- remove the
test
container if it exists - create a Docker container (name:
test
) from image- specify which handler subcommand will be invoked (e.g.
fake-waagent install
)
- specify which handler subcommand will be invoked (e.g.
- push .settings file
- do other things on the container that we need to craft the environment
- start the container
- collect the output from the command execution
- validate using the following:
- check status code
- validate output of the command
docker diff test
to validate file changes in the container- copy files out of container and validate their contents
Running Tests
To run the integration tests, run the following commands from the repository root:
make binary
./integration-test/run.sh
If you are running on a linux host (a real linux host not WSL), you can use the command ./integration-test/run.sh --all
to run all the tests.