Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit d71ec9c

Browse files
Erick CardonaSamuel Ortiz
authored andcommitted
imageservice: Add more image properties
The following OpenStack image properties were added the the Image structure and to the relevant test files: Create date Last update File Schema Signed-off-by: Erick Cardona <[email protected]>
1 parent 5e61034 commit d71ec9c

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

openstack/imageservice/v2/images/requests_test.go

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ func TestCreateImage(t *testing.T) {
6868
owner := "b4eedccc6fb74fa8a7ad6b08382b852b"
6969
minDiskGigabytes := 0
7070
minRAMMegabytes := 0
71+
file := actualImage.File
72+
createdDate := actualImage.CreatedDate
73+
lastUpdate := actualImage.LastUpdate
74+
schema := "/v2/schemas/image"
7175

7276
expectedImage := Image{
7377
ID: "e7db3b45-8db7-47ad-8109-3fb55c2c24fd",
@@ -84,7 +88,11 @@ func TestCreateImage(t *testing.T) {
8488

8589
Owner: owner,
8690

87-
Visibility: ImageVisibilityPrivate,
91+
Visibility: ImageVisibilityPrivate,
92+
File: file,
93+
CreatedDate: createdDate,
94+
LastUpdate: lastUpdate,
95+
Schema: schema,
8896
}
8997

9098
th.AssertDeepEquals(t, &expectedImage, actualImage)
@@ -112,6 +120,10 @@ func TestCreateImageNulls(t *testing.T) {
112120
owner := "b4eedccc6fb74fa8a7ad6b08382b852b"
113121
minDiskGigabytes := 0
114122
minRAMMegabytes := 0
123+
file := actualImage.File
124+
createdDate := actualImage.CreatedDate
125+
lastUpdate := actualImage.LastUpdate
126+
schema := "/v2/schemas/image"
115127

116128
expectedImage := Image{
117129
ID: "e7db3b45-8db7-47ad-8109-3fb55c2c24fd",
@@ -128,7 +140,11 @@ func TestCreateImageNulls(t *testing.T) {
128140

129141
Owner: owner,
130142

131-
Visibility: ImageVisibilityPrivate,
143+
Visibility: ImageVisibilityPrivate,
144+
File: file,
145+
CreatedDate: createdDate,
146+
LastUpdate: lastUpdate,
147+
Schema: schema,
132148
}
133149

134150
th.AssertDeepEquals(t, &expectedImage, actualImage)
@@ -151,6 +167,10 @@ func TestGetImage(t *testing.T) {
151167
minDiskGigabytes := 0
152168
minRAMMegabytes := 0
153169
owner := "5ef70662f8b34079a6eddb8da9d75fe8"
170+
file := actualImage.File
171+
createdDate := actualImage.CreatedDate
172+
lastUpdate := actualImage.LastUpdate
173+
schema := "/v2/schemas/image"
154174

155175
expectedImage := Image{
156176
ID: "1bea47ed-f6a9-463b-b423-14b9cca9ad27",
@@ -170,8 +190,12 @@ func TestGetImage(t *testing.T) {
170190
Protected: false,
171191
Visibility: ImageVisibilityPublic,
172192

173-
Checksum: checksum,
174-
SizeBytes: sizeBytes,
193+
Checksum: checksum,
194+
SizeBytes: sizeBytes,
195+
File: file,
196+
CreatedDate: createdDate,
197+
LastUpdate: lastUpdate,
198+
Schema: schema,
175199
}
176200

177201
th.AssertDeepEquals(t, &expectedImage, actualImage)
@@ -202,6 +226,10 @@ func TestUpdateImage(t *testing.T) {
202226

203227
sizebytes := 2254249
204228
checksum := "2cec138d7dae2aa59038ef8c9aec2390"
229+
file := actualImage.File
230+
createdDate := actualImage.CreatedDate
231+
lastUpdate := actualImage.LastUpdate
232+
schema := "/v2/schemas/image"
205233

206234
expectedImage := Image{
207235
ID: "da3b75d9-3f4a-40e7-8a2c-bfab23927dea",
@@ -223,6 +251,10 @@ func TestUpdateImage(t *testing.T) {
223251

224252
DiskFormat: "",
225253
ContainerFormat: "",
254+
File: file,
255+
CreatedDate: createdDate,
256+
LastUpdate: lastUpdate,
257+
Schema: schema,
226258
}
227259

228260
th.AssertDeepEquals(t, &expectedImage, actualImage)

openstack/imageservice/v2/images/results.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ type Image struct {
6464

6565
// Properties is a set of key-value pairs, if any, that are associated with the image.
6666
Properties map[string]string
67+
68+
// CreatedDate is the date when the image has been created.
69+
CreatedDate string `mapstructure:"created_at"`
70+
71+
// LastUpdate is the date when the last change has been made to the image or it's properties.
72+
LastUpdate string `mapstructure:"updated_at"`
73+
74+
// File is the trailing path after the glance endpoint that represent the location
75+
// of the image or the path to retrieve it.
76+
File string `mapstructure:"file"`
77+
78+
// Schema is the path to the JSON-schema that represent the image or image entity.
79+
Schema string `mapstructure:"schema"`
6780
}
6881

6982
type commonResult struct {

0 commit comments

Comments
 (0)