mirror of
https://github.com/ansible-collections/hetzner.hcloud
synced 2024-12-12 21:42:35 +00:00
c5e0d429c5
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
25 lines
664 B
Bash
Executable file
25 lines
664 B
Bash
Executable file
#!/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
|