Skip to content

Commit 13817bb

Browse files
committed
Update unit test + linting
1 parent ac39bb7 commit 13817bb

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

openstack/cce/v3/nodes/testing/requests_test.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,29 @@ func TestListNode(t *testing.T) {
7373

7474
listNodes := nodes.ListOpts{Name: "test-node-1234"}
7575
actual, err := nodes.List(fake.ServiceClient(), "cec124c2-58f1-11e8-ad73-0255ac101926", listNodes)
76-
7776
if err != nil {
7877
t.Errorf("Failed to extract nodes: %v", err)
7978
}
8079

81-
var expected = []nodes.Nodes{
80+
expected := []nodes.Nodes{
8281
{
8382
Kind: "Host",
8483
Apiversion: "v3",
85-
Metadata: nodes.Metadata{Name: "test-node-1234",
86-
Id: "b99acd73-5d7c-11e8-8e76-0255ac101929"},
87-
Spec: nodes.Spec{Az: "cn-east-2a",
84+
Metadata: nodes.Metadata{
85+
Name: "test-node-1234",
86+
Id: "b99acd73-5d7c-11e8-8e76-0255ac101929",
87+
},
88+
Spec: nodes.Spec{
89+
Az: "cn-east-2a",
8890
Login: nodes.LoginSpec{SshKey: "test-keypair"},
8991
RootVolume: nodes.VolumeSpec{Size: 40, VolumeType: "SATA"},
9092
BillingMode: 0,
9193
DataVolumes: []nodes.VolumeSpec{
9294
{
9395
VolumeType: "SATA",
9496
Size: 100,
95-
}},
97+
},
98+
},
9699
Flavor: "s1.medium",
97100
Runtime: nodes.RuntimeSpec{
98101
Name: "containerd",
@@ -120,7 +123,6 @@ func TestGetV3Node(t *testing.T) {
120123
th.AssertNoErr(t, err)
121124
expected := Expected
122125
th.AssertDeepEquals(t, expected, actual)
123-
124126
}
125127

126128
func TestCreateV3Node(t *testing.T) {
@@ -152,6 +154,7 @@ func TestCreateV3Node(t *testing.T) {
152154
}
153155
],
154156
"flavor": "s3.large.2",
157+
"k8sTags": null,
155158
"login": {
156159
"sshKey": "test-keypair",
157160
"userPassword": {
@@ -173,7 +176,8 @@ func TestCreateV3Node(t *testing.T) {
173176
},
174177
"runtime": {
175178
"name": "containerd"
176-
}
179+
},
180+
"taints": null
177181
}
178182
}
179183
`)
@@ -182,7 +186,8 @@ func TestCreateV3Node(t *testing.T) {
182186
w.WriteHeader(http.StatusCreated)
183187
_, _ = fmt.Fprint(w, Output)
184188
})
185-
options := nodes.CreateOpts{Kind: "Node",
189+
options := nodes.CreateOpts{
190+
Kind: "Node",
186191
ApiVersion: "v3",
187192
Metadata: nodes.CreateMetaData{Name: "test-node"},
188193
Spec: nodes.Spec{
@@ -210,7 +215,6 @@ func TestCreateV3Node(t *testing.T) {
210215
th.AssertNoErr(t, err)
211216
expected := Expected
212217
th.AssertDeepEquals(t, expected, actual)
213-
214218
}
215219

216220
func TestUpdateV3Node(t *testing.T) {
@@ -253,7 +257,6 @@ func TestDeleteNode(t *testing.T) {
253257

254258
err := nodes.Delete(fake.ServiceClient(), "cec124c2-58f1-11e8-ad73-0255ac101926", "cf4bc001-58f1-11e8-ad73-0255ac101926")
255259
th.AssertNoErr(t, err)
256-
257260
}
258261

259262
func TestGetV3Job(t *testing.T) {
@@ -272,5 +275,4 @@ func TestGetV3Job(t *testing.T) {
272275
th.AssertNoErr(t, err)
273276
expected := ExpectedJob
274277
th.AssertDeepEquals(t, expected, actual)
275-
276278
}

0 commit comments

Comments
 (0)