Files
canada-kaktus/internal/hetzner_test.go
Tobias Trabelsi d22a53fbb7
All checks were successful
PR Build / Test (pull_request) Successful in 2m22s
PR Build / Build_Image (pull_request) Successful in 2m22s
fix(): use publich ip addresses
2025-10-06 11:16:00 +02:00

31 lines
602 B
Go

package internal
import (
"testing"
"github.com/hetznercloud/hcloud-go/hcloud"
)
func TestGetAllIps(t *testing.T) {
servers := []*hcloud.Server{{
Status: hcloud.ServerStatusRunning,
Name: "Test",
}}
servers = append(servers, &hcloud.Server{
Status: hcloud.ServerStatusRunning,
Name: "Test2",
})
expectedError := "instance Test has no public Addresses"
_, err := GetAllIps(servers)
if err == nil {
t.Error("GetAllIps did not error with missing data")
}
if err.Error() != expectedError {
t.Errorf("Wrong error message. want %s, got %s", expectedError, err.Error())
}
}