Skip to content

Commit 7120329

Browse files
committed
tests: fix containerinfra template creation
1 parent 1906146 commit 7120329

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

internal/acceptance/openstack/containerinfra/v1/containerinfra.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ func CreateClusterTemplateCOE(t *testing.T, client *gophercloud.ServiceClient, c
3131
t.Logf("Attempting to create %s cluster template: %s", coe, name)
3232

3333
boolFalse := false
34+
labels := map[string]string{
35+
"test": "test",
36+
}
3437
createOpts := clustertemplates.CreateOpts{
3538
COE: coe,
3639
DNSNameServer: "8.8.8.8",
@@ -45,6 +48,8 @@ func CreateClusterTemplateCOE(t *testing.T, client *gophercloud.ServiceClient, c
4548
Public: &boolFalse,
4649
RegistryEnabled: &boolFalse,
4750
ServerType: "vm",
51+
// workaround for https://bugs.launchpad.net/magnum/+bug/2109685
52+
Labels: labels,
4853
}
4954

5055
res := clustertemplates.Create(context.TODO(), client, createOpts)
@@ -68,6 +73,7 @@ func CreateClusterTemplateCOE(t *testing.T, client *gophercloud.ServiceClient, c
6873
tools.PrintResource(t, clusterTemplate.CreatedAt)
6974

7075
th.AssertEquals(t, name, clusterTemplate.Name)
76+
th.AssertDeepEquals(t, labels, clusterTemplate.Labels)
7177
th.AssertEquals(t, choices.ExternalNetworkID, clusterTemplate.ExternalNetworkID)
7278
th.AssertEquals(t, choices.MagnumImageID, clusterTemplate.ImageID)
7379

openstack/containerinfra/v1/clustertemplates/testing/fixtures_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,28 @@ func HandleCreateClusterTemplateSuccessfully(t *testing.T) {
278278
th.Mux.HandleFunc("/v1/clustertemplates", func(w http.ResponseWriter, r *http.Request) {
279279
th.TestMethod(t, r, "POST")
280280
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
281+
th.TestJSONRequest(t, r, `{
282+
"coe": "kubernetes",
283+
"dns_nameserver": "8.8.8.8",
284+
"docker_storage_driver": "devicemapper",
285+
"docker_volume_size": 3,
286+
"external_network_id": "public",
287+
"flavor_id": "m1.small",
288+
"hidden": true,
289+
"http_proxy": "http://10.164.177.169:8080",
290+
"https_proxy": "http://10.164.177.169:8080",
291+
"image_id": "Fedora-Atomic-27-20180212.2.x86_64",
292+
"keypair_id": "kp",
293+
"master_lb_enabled": true,
294+
"name": "kubernetes-dev",
295+
"network_driver": "flannel",
296+
"no_proxy": "10.0.0.0/8,172.0.0.0/8,192.0.0.0/8,localhost",
297+
"public": false,
298+
"registry_enabled": false,
299+
"server_type": "vm",
300+
"tls_disabled": false,
301+
"volume_driver": "cinder"
302+
}`)
281303

282304
w.Header().Add("Content-Type", "application/json")
283305
w.Header().Add("OpenStack-API-Minimum-Version", "container-infra 1.1")

0 commit comments

Comments
 (0)