test: add missing API assertion fixtures and body validation for 8 cloud providers (#1107)

Added _api_assertions.sh fixtures for binarylane, genesiscloud, hyperstack, kamatera, latitude, ovh, scaleway, and upcloud to enable comprehensive mock test coverage. Updated _validate_body() in test/mock.sh to validate POST request bodies for all cloud providers, ensuring payload correctness. Fixed syntax error in gcore validation (!! to ;;).

Co-authored-by: Spawn Refactor Service <refactor@spawn.service>
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-02-14 08:46:49 -08:00 committed by GitHub
parent f8b2178658
commit 0d494d044e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 25 additions and 1 deletions

View file

@ -0,0 +1,2 @@
assert_api_called "GET" "/account/keys" "fetches SSH keys"
assert_api_called "POST" "/servers" "creates server"

View file

@ -0,0 +1,2 @@
assert_api_called "GET" "/ssh-keys" "fetches SSH keys"
assert_api_called "POST" "/instances" "creates instance"

View file

@ -0,0 +1,2 @@
assert_api_called "GET" "/ssh-keys" "fetches SSH keys"
assert_api_called "POST" "/servers" "creates server"

View file

@ -0,0 +1,2 @@
assert_api_called "GET" "/svc/config/sshkey/list" "fetches SSH keys"
assert_api_called "POST" "/svc/server/create" "creates server"

View file

@ -0,0 +1,2 @@
assert_api_called "GET" "/ssh-keys" "fetches SSH keys"
assert_api_called "POST" "/servers" "creates server"

2
test/fixtures/ovh/_api_assertions.sh vendored Normal file
View file

@ -0,0 +1,2 @@
assert_api_called "GET" "/me/sshKey" "fetches SSH keys"
assert_api_called "POST" "/cloud/project" "interacts with cloud project"

View file

@ -0,0 +1,2 @@
assert_api_called "GET" "/sshkeys" "fetches SSH keys"
assert_api_called "POST" "/servers" "creates server"

View file

@ -0,0 +1,2 @@
assert_api_called "GET" "/1.3/account" "fetches account info"
assert_api_called "POST" "/1.3/server" "creates server"

View file

@ -299,9 +299,17 @@ _validate_body() {
vultr) case "$EP_CLEAN" in /instances) _check_fields "label region plan os_id" ;; esac ;;
linode) case "$EP_CLEAN" in /linode/instances) _check_fields "label region type image" ;; esac ;;
civo) case "$EP_CLEAN" in /instances) _check_fields "hostname size region" ;; esac ;;
binarylane) case "$EP_CLEAN" in /servers) _check_fields "name region plan os_id" ;; esac ;;
upcloud) case "$EP_CLEAN" in /server) _check_fields "server" ;; esac ;;
genesiscloud) case "$EP_CLEAN" in /instances) _check_fields "name" ;; esac ;;
hyperstack) case "$EP_CLEAN" in /servers) _check_fields "name" ;; esac ;;
kamatera) case "$EP_CLEAN" in /server/create) _check_fields "datacenter" ;; esac ;;
latitude) case "$EP_CLEAN" in /servers) _check_fields "hostname site_id os_type" ;; esac ;;
ovh) case "$EP_CLEAN" in */create) _check_fields "name" ;; esac ;;
scaleway) case "$EP_CLEAN" in /servers) _check_fields "name" ;; esac ;;
webdock) case "$EP_CLEAN" in /servers) _check_fields "name slug locationId profileSlug imageSlug" ;; esac ;;
serverspace) case "$EP_CLEAN" in /servers) _check_fields "name location_id image_id cpu ram_mb" ;; esac ;;
gcore) case "$EP_CLEAN" in /instances) _check_fields "name flavor volumes interfaces" ;; esac !!
gcore) case "$EP_CLEAN" in /instances) _check_fields "name flavor volumes interfaces" ;; esac ;;
esac
}