1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-14 19:02:45 +03:00

Makefile & tests for new clouds

This commit is contained in:
Jake Buchholz Göktürk 2024-10-19 16:12:22 -07:00
parent 34681ae220
commit b1ae3ab611
3 changed files with 43 additions and 37 deletions

View File

@ -1,6 +1,6 @@
PREFIX?=/
SUBPACKAGES = core network openrc aws azure gcp oci nocloud incus
SUBPACKAGES = core network openrc aws azure gcp hetzner incus nocloud oci scaleway
.PHONY: check install $(SUBPACKAGES)
@ -53,9 +53,15 @@ gcp:
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/gcp \
lib/tiny-cloud/cloud/gcp/*
oci:
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/oci \
lib/tiny-cloud/cloud/oci/*
hetzner:
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/hetzner \
lib/tiny-cloud/cloud/hetzner/*
incus:
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/incus \
lib/tiny-cloud/cloud/incus/imds
install -Dm755 -t $(PREFIX)/lib/tiny-cloud/cloud/incus \
lib/tiny-cloud/cloud/incus/autodetect
nocloud:
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/nocloud \
@ -64,11 +70,13 @@ nocloud:
install -Dm755 -t $(PREFIX)/lib/tiny-cloud/cloud/nocloud \
lib/tiny-cloud/cloud/nocloud/autodetect
incus:
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/incus \
lib/tiny-cloud/cloud/incus/imds
install -Dm755 -t $(PREFIX)/lib/tiny-cloud/cloud/incus \
lib/tiny-cloud/cloud/incus/autodetect
oci:
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/oci \
lib/tiny-cloud/cloud/oci/*
scaleway:
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/scaleway \
lib/tiny-cloud/cloud/scaleway/*
check: tests/Kyuafile Kyuafile
kyua --variable parallelism=$(shell nproc) test || (kyua report --verbose && exit 1)

View File

@ -5,7 +5,7 @@
. $(atf_get_srcdir)/test_env.sh
export PREFIX="$srcdir"
PROVIDERS="aws azure gcp nocloud scaleway"
PROVIDERS="aws azure gcp hetzner incus oci nocloud scaleway"
init_tests \
imds_help \
@ -72,6 +72,7 @@ check_hostname() {
imds_hostname_aws_body() { check_hostname aws; }
imds_hostname_azure_body() { check_hostname azure; }
imds_hostname_gcp_body() { check_hostname gcp; }
imds_hostname_hetzner_body() { check_hostname hetzner; }
imds_hostname_incus_body() {
fake_metadata incus <<-EOF
#cloud-config
@ -87,7 +88,6 @@ HOSTNAME=myhostname
EOF
CLOUD="scaleway" atf_check -o match:"myhostname" imds @hostname
}
imds_hostname_hetzner_body() { check_hostname hetzner; }
check_local_hostname() {
fake_metadata "$1" <<-EOF
@ -107,6 +107,7 @@ check_local_hostname() {
imds_local_hostname_aws_body() { check_local_hostname aws; }
imds_local_hostname_azure_body() { check_local_hostname azure; }
imds_local_hostname_gcp_body() { check_local_hostname gcp; }
imds_local_hostname_hetzner_body() { check_local_hostname hetzner; }
imds_local_hostname_incus_body() { check_local_hostname incus; }
imds_local_hostname_nocloud_body() { check_local_hostname nocloud; }
imds_local_hostname_oci_body() { check_local_hostname oci; }
@ -117,8 +118,6 @@ FOO=bar
EOF
CLOUD="scaleway" atf_check -o match:"^myhostname$" imds @local-hostname
}
imds_local_hostname_hetzner_body() { check_local_hostname hetzner; }
imds_local_hostname_incus_body() { check_local_hostname incus; }
check_ssh_keys() {
local key="ssh-ed25519 keydata"
@ -146,6 +145,28 @@ check_ssh_keys() {
imds_ssh_keys_aws_body() { check_ssh_keys aws; }
imds_ssh_keys_azure_body() { check_ssh_keys azure; }
imds_ssh_keys_gcp_body() { check_ssh_keys gcp; }
imds_ssh_keys_hetzner_body() {
local key="ssh-ed25519 keydata"
fake_metadata "hetzner" <<-EOF
# hetzner
public-keys: '["$key"]'
EOF
CLOUD="hetzner" atf_check -o match:"$key" imds @ssh-keys
}
imds_ssh_keys_incus_body() {
local key="ssh-ed25519 keydata"
fake_userdata_incus <<-EOF
ssh_authorized_keys:
- asdasdf
# other key
- $key
foo: bar
EOF
CLOUD="incus" atf_check \
-o match:"$key" \
-o not-match:"other key" \
imds @ssh-keys
}
imds_ssh_keys_nocloud_body() { check_ssh_keys nocloud; }
imds_ssh_keys_oci_body() { check_ssh_keys oci; }
imds_ssh_keys_scaleway_body() {
@ -163,29 +184,6 @@ SSH_PUBLIC_KEYS_0_IP=
EOF
CLOUD="scaleway" atf_check -o match:"$key" imds @ssh-keys
}
imds_ssh_keys_hetzner_body() {
local key="ssh-ed25519 keydata"
fake_metadata "hetzner" <<-EOF
# hetzner
public-keys: '["$key"]'
EOF
CLOUD="hetzner" atf_check -o match:"$key" imds @ssh-keys
}
imds_ssh_keys_incus_body() {
local key="ssh-ed25519 keydata"
fake_userdata_incus <<-EOF
ssh_authorized_keys:
- asdasdf
# other key
- $key
foo: bar
EOF
CLOUD="incus" atf_check \
-o match:"$key" \
-o not-match:"other key" \
imds @ssh-keys
}
imds_nocloud_cmdline_local_hostname_body() {
atf_require_prog yx

View File

@ -6,7 +6,7 @@
export PREFIX="$srcdir"
export MOCK=echo
PROVIDERS="alpine aws azure gcp nocloud oci scaleway hetzner"
PROVIDERS="alpine aws azure gcp incus hetzner nocloud oci scaleway"
init_tests \
tiny_cloud_help \