diff --git a/tests/test-cases/Group23-VIC-Machine-Service/23-03-VCH-Create.robot b/tests/test-cases/Group23-VIC-Machine-Service/23-03-VCH-Create.robot index 8f19818913..8d6e12fb84 100644 --- a/tests/test-cases/Group23-VIC-Machine-Service/23-03-VCH-Create.robot +++ b/tests/test-cases/Group23-VIC-Machine-Service/23-03-VCH-Create.robot @@ -83,6 +83,33 @@ Property Should Contain Should Contain ${actual} ${expected} +Get Docker Params + [Arguments] ${name} + + Get VCH ${name} + + ${dockerHost}= Run echo '${OUTPUT}' | jq -r '.runtime["docker_host"]' + @{hostParts}= Split String ${dockerHost} : + ${ip}= Split String ${hostParts}[0] + ${port}= Strip String @{hostParts}[1] + ${vic-admin}= Run echo '${OUTPUT}' | jq -r '.runtime["admin_portal"]' + + Run Keyword If ${port} == 2376 Set Environment Variable VCH-PARAMS -H ${dockerHost} --tls + Run Keyword If ${port} == 2375 Set Environment Variable VCH-PARAMS -H ${dockerHost} + + Set Environment Variable VCH-IP ${ip} + Set Environment Variable VCH-PORT ${port} + Set Environment Variable VIC-ADMIN ${vic-admin} + +Get Container ID + ${output}= Run docker %{VCH-PARAMS} pull ${busybox} + Should Not Contain ${output} 'Cannot connect' + ${containerID}= Run docker %{VCH-PARAMS} run -d ${busybox} + + [Return] ${containerID} + + + *** Test Cases *** Create minimal VCH Create VCH '{"name":"%{VCH-NAME}-api-test-minimal","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"%{PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}' @@ -149,6 +176,7 @@ Create minimal VCH within datacenter Property Should Contain .runtime.power_state poweredOn Property Should Contain .runtime.upgrade_status Up to date + [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-dc @@ -228,6 +256,7 @@ Create complex VCH Property Should Be Equal .container.name_convention container-{id} + [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-complex @@ -265,3 +294,49 @@ Fail to create VCH without network Verify Status 400 Should Contain ${output} network + +Verify container name convention with container ID + Create VCH '{"name":"%{VCH-NAME}-container-1","storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"%{PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}},"container":{"name_convention":"container-{id}"}}' + + Verify Return Code + Verify Status 201 + + Wait Until Keyword Succeeds 10x 15s Get Docker Params %{VCH-NAME}-container-1 + ${containerID}= Wait Until Keyword Succeeds 10x 15x Get Container ID + ${shortID}= Get container shortID ${containerID} + + ${output}= Run govc ls vm + Should Contain ${output} container-${shortID} + Run docker %{VCH-PARAMS} rm -f ${containerID} + + Run Regression Tests + + [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-container-1 + + +Verify container name convention with name + Create VCH '{"name":"%{VCH-NAME}-container-2","storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"%{PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}},"container":{"name_convention":"container-{name}"}}' + + Verify Return Code + Verify Status 201 + + Wait Until Keyword Succeeds 10x 15s Get Docker Params %{VCH-NAME}-container-2 + + ${containerID}= Wait Until Keyword Succeeds 10x 15x Get Container ID + ${name}= Get container name ${containerID} + ${output}= Run govc ls vm + Should Contain ${output} container-${name} + Run docker %{VCH-PARAMS} rm -f ${containerID} + + Run Regression Tests + + [Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-container-2 + + +Verify container name convention with invalid arguments + Create VCH '{"name":"%{VCH-NAME}-container-3","storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"public":{"port_group":{"name":"%{PUBLIC_NETWORK}"}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}},"container":{"name_convention":"container-test"}}' + + Verify Return Code + Verify Status 422 + + [Teardown] Log To Console Test passed no need to run cleanup