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()) } }