This commit is contained in:
@@ -88,11 +88,11 @@ release:
|
||||
CLIENT_VM := abra-client
|
||||
vm-client-status:
|
||||
sudo systemctl status microvm@$(CLIENT_VM).service
|
||||
vm-client-create:
|
||||
vm-client-create:test-integration-hosts
|
||||
sudo microvm -f git+file://$$(pwd) -c $(CLIENT_VM)
|
||||
vm-client-start:
|
||||
sudo systemctl start microvm@$(CLIENT_VM).service
|
||||
vm-client-update:
|
||||
vm-client-update:test-integration-hosts
|
||||
sudo microvm -R -f git+file://$$(pwd) -u $(CLIENT_VM)
|
||||
vm-client-run:
|
||||
sudo microvm -f git+file://$$(pwd) -r $(CLIENT_VM)
|
||||
@@ -121,6 +121,8 @@ vm-server-delete: vm-server-stop
|
||||
vm-server-connect:
|
||||
ssh abra@10.0.0.3 -i ./tests/resources/local_integration_ssh
|
||||
|
||||
test-integration-hosts:
|
||||
./scripts/tests/extra_hosts
|
||||
test-integration:
|
||||
ssh-add ./tests/resources/local_integration_ssh
|
||||
@bats -Tp tests/integration --verbose-run
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
publicKey = builtins.readFile ./tests/resources/local_integration_ssh.pub;
|
||||
privateKey = builtins.readFile ./tests/resources/local_integration_ssh;
|
||||
localDomainHosts = builtins.readFile ./tests/resources/local_hosts;
|
||||
# local DNS aliases for the server host
|
||||
extraHosts = builtins.readFile ./tests/resources/extra_hosts;
|
||||
username = "abra";
|
||||
password = "abra";
|
||||
defaultDNS = [
|
||||
@@ -54,7 +55,7 @@
|
||||
username
|
||||
password
|
||||
defaultDNS
|
||||
localDomainHosts
|
||||
extraHosts
|
||||
;
|
||||
};
|
||||
};
|
||||
@@ -71,7 +72,6 @@
|
||||
username
|
||||
password
|
||||
defaultDNS
|
||||
localDomainHosts
|
||||
;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
privateKey,
|
||||
username,
|
||||
defaultDNS,
|
||||
localDomainHosts,
|
||||
extraHosts,
|
||||
...
|
||||
}:
|
||||
let
|
||||
@@ -94,7 +94,7 @@ in
|
||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||
networking.firewall.allowedUDPPorts = [ 22 ];
|
||||
|
||||
networking.extraHosts = localDomainHosts;
|
||||
networking.extraHosts = extraHosts;
|
||||
|
||||
environment.variables = {
|
||||
CGO_ENABLED = 0;
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# This file generates local DNS aliases for the client VM for integration testing
|
||||
|
||||
echo "generating hosts file..."
|
||||
hosts_file_path="./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=./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"
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "generating hosts file..."
|
||||
|
||||
hosts_file_path="./tests/resources/local_hosts"
|
||||
|
||||
echo "removing old file..."
|
||||
rm $hosts_file_path
|
||||
|
||||
# default entries
|
||||
# the server
|
||||
echo "10.0.0.3 abra.local" >> $hosts_file_path
|
||||
# used to spin up traefik
|
||||
echo "10.0.0.3 traefik.abra.local" >> $hosts_file_path
|
||||
# used in integration tests
|
||||
echo "10.0.0.3 gitea.abra.local" >> $hosts_file_path
|
||||
echo "10.0.0.3 zammad.abra.local" >> $hosts_file_path
|
||||
echo "10.0.0.3 custom-html.abra.local" >> $hosts_file_path
|
||||
echo "10.0.0.3 foo.abra.local" >> $hosts_file_path
|
||||
echo "10.0.0.3 foobar.abra.local" >> $hosts_file_path
|
||||
|
||||
search_dir=./tests/integration
|
||||
for entry in "$search_dir"/*.bats
|
||||
do
|
||||
base_name=$(basename "${entry}")
|
||||
# converting file names to testing subdomains
|
||||
subdomain=$(echo "$base_name" | tr . _)
|
||||
echo "10.0.0.3 $subdomain.abra.local" >> $hosts_file_path
|
||||
done
|
||||
|
||||
echo "writing hosts success"
|
||||
@@ -1,5 +1,4 @@
|
||||
10.0.0.3 abra.local
|
||||
10.0.0.3 traefik.abra.local
|
||||
10.0.0.3 gitea.abra.local
|
||||
10.0.0.3 zammad.abra.local
|
||||
10.0.0.3 custom-html.abra.local
|
||||
Reference in New Issue
Block a user