#!/usr/bin/env bash # This file generates local DNS aliases for the client VM for integration testing GIT_ROOT=$(git rev-parse --show-toplevel) echo "generating hosts file..." hosts_file_path="$GIT_ROOT/tests/resources/extra_hosts" echo "removing old file..." rm -f "$hosts_file_path" # the server domain server_ip="10.0.0.3" domain="abra.local" echo "$server_ip $domain" >> "$hosts_file_path" # static subdomains used in integration tests subdomains=("gitea" "zammad" "custom-html" "foo" "foobar") for subdomain in "${subdomains[@]}" do echo "$server_ip $subdomain.$domain" >> "$hosts_file_path" done search_dir="$GIT_ROOT/tests/integration" for entry in "$search_dir"/*.bats do file_name=$(basename "${entry}") # converting file names to testing subdomains subdomain=$(echo "$file_name" | tr . _) echo "$server_ip $subdomain.$domain" >> "$hosts_file_path" done echo "writing extra hosts success"