Skip to content

Commit 619706b

Browse files
committed
Merge remote-tracking branch 'upstream/denis/fleeting'
2 parents ba86298 + 57fc64b commit 619706b

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

servers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Image struct {
5454
Slug string `json:"slug"`
5555
Name string `json:"name"`
5656
OperatingSystem string `json:"operating_system"`
57+
DefaultUsername string `json:"default_username"`
5758
}
5859

5960
type VolumeStub struct {

test/integration/custom_images_integration_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ func TestIntegrationCustomImage_Boot(t *testing.T) {
196196
UserDataHandling: "extend-cloud-config",
197197
Zones: []string{"lpg1", "rma1"},
198198
SourceFormat: "raw",
199+
Slug: "fancy",
199200
}
200201

201202
customImageImport, err := client.CustomImageImports.Create(context.Background(), createCustomImageImportRequest)
@@ -231,6 +232,19 @@ func TestIntegrationCustomImage_Boot(t *testing.T) {
231232
t.Fatalf("Servers.WaitFor returned error %s\n", err)
232233
}
233234

235+
if server.Image.Slug != "custom:fancy" {
236+
t.Errorf("Server.Image.Slug got=%s, want=%s", server.Image.Slug, "=custom:fancy")
237+
}
238+
if server.Image.Name != createCustomImageImportRequest.Name {
239+
t.Errorf("Server.Image.Name got=%s, want '%s'", server.Image.Name, createCustomImageImportRequest.Name)
240+
}
241+
if server.Image.OperatingSystem != "" {
242+
t.Errorf("Server.Image.OperatingSystem got=%s, want an empty string", server.Image.OperatingSystem)
243+
}
244+
if server.Image.DefaultUsername != "" {
245+
t.Errorf("Server.Image.DefaultUsername got=%s, want an empty string", server.Image.DefaultUsername)
246+
}
247+
234248
err = client.Servers.Delete(context.Background(), server.UUID)
235249
if err != nil {
236250
t.Fatalf("Servers.Delete returned error %s\n", err)

test/integration/servers_integration_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ func TestIntegrationServer_CRUD(t *testing.T) {
6666
t.Errorf("server.CreatedAt ourside of expected range. got=%v", server.CreatedAt)
6767
}
6868

69+
if server.Image.Slug != DefaultImageSlug {
70+
t.Errorf("Server.Image.Slug got=%s, want=%s", server.Image.Slug, DefaultImageSlug)
71+
}
72+
73+
const expectedValue = "debian"
74+
if !strings.Contains(strings.ToLower(server.Image.Name), expectedValue) {
75+
t.Errorf("Server.Image.Name got=%s, want to contain '%s'", server.Image.Name, expectedValue)
76+
}
77+
if !strings.Contains(strings.ToLower(server.Image.OperatingSystem), expectedValue) {
78+
t.Errorf("Server.Image.OperatingSystem got=%s, want to contain '%s'", server.Image.OperatingSystem, expectedValue)
79+
}
80+
if !strings.Contains(strings.ToLower(server.Image.DefaultUsername), expectedValue) {
81+
t.Errorf("Server.Image.DefaultUsername got=%s, want to contain '%s'", server.Image.DefaultUsername, expectedValue)
82+
}
83+
6984
servers, err := client.Servers.List(context.Background())
7085
if err != nil {
7186
t.Fatalf("Servers.List returned error %s\n", err)

0 commit comments

Comments
 (0)