mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-03 23:51:48 +00:00
test: implement integration testing framework (#239)
Fixes #203 The namespace used to differentiate the resources between CI pipelines, CI stages or even between test targets was broken and resulted in conflicting resource names. This PR ensure the resources names don't collide with each other by making sure we use the entire hcloud_prefix value as md5sum, and by including the target role names inside the resource names. Create a setup/teardown framework to handle testing resources used by the tests. To simplify the review process, additional changes such as splitting the setup/teardown task in the prepare.yml and cleanup.yml files will be done in future PRs (many files were renamed, and git will not preserve the file history after the PR squash). * chore: move integrations targets files * test: create integration common files * test: fix resources name namespace using the magic hcloud_ns * test: simplify requirements install * test: rename hcloud_server test taskfiles
This commit is contained in:
parent
7d8c3f34b5
commit
c5e0d429c5
150 changed files with 5771 additions and 4432 deletions
25
scripts/integration-test-files.sh
Executable file
25
scripts/integration-test-files.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Sync the integration test files from the template to all the integrations targets.
|
||||
|
||||
integration_targets="tests/integration/targets/hcloud_"
|
||||
integration_common="tests/integration/common"
|
||||
|
||||
# banner
|
||||
banner() {
|
||||
echo "#"
|
||||
echo "# DO NOT EDIT THIS FILE! Please edit the files in $integration_common instead."
|
||||
echo "#"
|
||||
}
|
||||
|
||||
# copy_file <src> <dest>
|
||||
copy_file() {
|
||||
mkdir -p "$(dirname "$2")"
|
||||
banner > "$2"
|
||||
cat "$1" >> "$2"
|
||||
}
|
||||
|
||||
for target in "$integration_targets"*; do
|
||||
copy_file "$integration_common"/defaults/main/common.yml "$target"/defaults/main/common.yml
|
||||
copy_file "$integration_common"/tasks/main.yml "$target"/tasks/main.yml
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue