feature/tt/initial-implementation (#1)
Reviewed-on: #1 Co-authored-by: Tobias Trabelsi <lerentis@uploadfilter24.eu> Co-committed-by: Tobias Trabelsi <lerentis@uploadfilter24.eu>
This commit is contained in:
30
internal/hetzner_test.go
Normal file
30
internal/hetzner_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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())
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user