VMware vSphere Integrated Containers provider (#206)

* Add Virtual Kubelet provider for VIC

Initial virtual kubelet provider for VMware VIC.  This provider currently
handles creating and starting of a pod VM via the VIC portlayer and persona
server.  Image store handling via the VIC persona server.  This provider
currently requires the feature/wolfpack branch of VIC.

* Added pod stop and delete.  Also added node capacity.

Added the ability to stop and delete pod VMs via VIC.  Also retrieve
node capacity information from the VCH.

* Cleanup and readme file

Some file clean up and added a Readme.md markdown file for the VIC
provider.

* Cleaned up errors, added function comments, moved operation code

1. Cleaned up error handling.  Set standard for creating errors.
2. Added method prototype comments for all interface functions.
3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder.

* Add mocking code and unit tests for podcache, podcreator, and podstarter

Used the unit test framework used in VIC to handle assertions in the provider's
unit test.  Mocking code generated using OSS project mockery, which is compatible
with the testify assertion framework.

* Vendored packages for the VIC provider

Requires feature/wolfpack branch of VIC and a few specific commit sha of
projects used within VIC.

* Implementation of POD Stopper and Deleter unit tests (#4)

* Updated files for initial PR
This commit is contained in:
Loc Nguyen
2018-06-04 15:41:32 -07:00
committed by Ria Bhatia
parent 98a111e8b7
commit 513cebe7b7
6296 changed files with 1123685 additions and 8 deletions

View File

@@ -0,0 +1,24 @@
Test 23-01 - Version
=======
# Purpose:
To verify vic-machine-server returns a valid version number
# References:
1. [The design document](../../../doc/design/vic-machine/service.md)
# Environment:
This test has no environmental requirements
# Test Steps:
1. Start the vic-machine-server
2. Retry 5 times using curl to issue a GET request for the version endpoint
3. Use curl to issue a GET request for the gretting hello message endpoint
# Expected Outcome:
* Step 2 should succeed with a 200 OK response containing a version number
* Step 3 should succeed with a 200 OK response containing a greeting message
# Possible Problems:
* Step 1 could take more than the expected retry time for the service to become available, causing the GET request sent in step 2 to fail with a return code of 7. (Other tests in this suite may wait on a response from the version endpoint to determine whether the service is available, but this test should not as it is the endpoint under test.)

View File

@@ -0,0 +1,58 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 23-01 - Version
Resource ../../resources/Util.robot
Resource ../../resources/Group23-VIC-Machine-Service-Util.robot
Suite Setup Start VIC Machine Server
Suite Teardown Terminate All Processes kill=True
Default Tags
*** Keywords ***
Get Version
${out}= Run netstat -l | grep 1337
Log ${out}
${out}= Run ps aux | grep vic-machine-server
Log ${out}
Get Path version
Verify Return Code
Get Hello
Get Path hello
Verify Version
Output Should Match Regexp v\\d+\\.\\d+\\.\\d+-(\\w+-)?\\d+-[a-f0-9]+
Output Should Not Contain "
Verify Hello
Output Should Contain success
Output Should Not Contain "
*** Test Cases ***
Get Version
Wait Until Keyword Succeeds 5x 1s Get Version
Verify Status Ok
Verify Version
Get Hello
Get Hello
Verify Return Code
Verify Status Ok
Verify Hello

View File

@@ -0,0 +1,26 @@
Test 23-02 - VCH List
=======
# Purpose:
To verify vic-machine-server can return a list of VCHs including the expected information
# References:
1. [The design document](../../../doc/design/vic-machine/service.md)
# Environment:
This test requires a vSphere system where VCHs can be deployed
# Test Steps:
1. Deploy a VCH
2. Get a list of all VCHs
3. Get a list of all VCHs in the test datacenter
4. Attempt to list all VCHs in an invalid datacenter
5. Attempt to list all VCHs in an invalid compute resource
6. Attempt to list all VCHs in an invalid datacenter and compute resource
# Expected Outcome:
* The results of 2-3 should contain the VCH created in 1, with the correct ID.
* The requests in 4-6 should result in an appropriate error message.
# Possible Problems:
None known

View File

@@ -0,0 +1,113 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 23-02 - VCH List
Resource ../../resources/Util.robot
Resource ../../resources/Group23-VIC-Machine-Service-Util.robot
Suite Setup Setup
Suite Teardown Teardown
Default Tags
*** Keywords ***
Setup
Start VIC Machine Server
Install VIC Appliance To Test Server
Teardown
Cleanup VIC Appliance On Test Server
Terminate All Processes kill=True
Get VCH List
Get Path Under Target vch
Get VCH List Within Datacenter
${dcID}= Get Datacenter ID
Get Path Under Target datacenter/${dcID}/vch
Verify VCH List
${expectedId}= Get VCH ID %{VCH-NAME}
Property Should Be Equal .vchs[] | select(.name=="%{VCH-NAME}").id ${expectedId}
Property Should Not Be Empty .vchs[] | select(.name=="%{VCH-NAME}").admin_portal
Property Should Not Be Empty .vchs[] | select(.name=="%{VCH-NAME}").docker_host
Property Should Not Be Empty .vchs[] | select(.name=="%{VCH-NAME}").upgrade_status
Property Should Not Be Empty .vchs[] | select(.name=="%{VCH-NAME}").version
Get VCH List Using Session
Get Path Under Target Using Session vch
Get VCH List Within Datacenter Using Session
${dcID}= Get Datacenter ID
Get Path Under Target Using Session datacenter/${dcID}/vch
*** Test Cases ***
Get VCH List
Get VCH List
Verify Return Code
Verify Status Ok
Verify VCH List
Get VCH List Using Session
Get VCH List Using Session
Verify Return Code
Verify Status Ok
Verify VCH List
Get VCH List Within Datacenter
Get VCH List Within Datacenter
Verify Return Code
Verify Status Ok
Verify VCH List
Get VCH List Within Datacenter Using Session
Get VCH List Within Datacenter Using Session
Verify Return Code
Verify Status Ok
Verify VCH List
# TODO: Add test for compute resource (once relevant code is updated to use ID instead of name)
# TODO: Add test for compute resource within datacenter (once relevant code is updated to use ID instead of name)
Get VCH List Within Invalid Datacenter
Get Path Under Target datacenter/INVALID/vch
Verify Return Code
Verify Status Not Found
Get VCH List Within Invalid Compute Resource
Get Path Under Target vch compute-resource=INVALID
Verify Return Code
Verify Status Bad Request
Get VCH List Within Invalid Datacenter and Compute Resource
Get Path Under Target datacenter/INVALID/vch compute-resource=INVALID
Verify Return Code
Verify Status Not Found

View File

@@ -0,0 +1,26 @@
Test 23-03 - VCH Create
=======
# Purpose:
To verify vic-machine-server can create a VCH with a specified configuration
# References:
1. [The design document](../../../doc/design/vic-machine/service.md)
# Environment:
This test requires a vSphere system where VCHs can be deployed
# Test Steps:
1. Create a VCH with as minimal a configuration as possible
2. Inspect that VCH using the CLI
3. Verify that the VCH appliance created has been successfully initialized
4. Create a VCH with a more complex configuration (some input params for creation have placeholder values)
5. Inspect that VCH using the CLI
# Expected Outcome:
* The results of 2 should contain the same information as was supplied when the VCH was created in 1.
* The results of 3 should show that the VCH appliance is initialized and docker endpoint is able to connect.
* The results of 5 should contain the same information as was supplied when the VCH was created in 4.
# Possible Problems:
None known

View File

@@ -0,0 +1,279 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 23-03 - VCH Create
Resource ../../resources/Util.robot
Resource ../../resources/Group23-VIC-Machine-Service-Util.robot
Suite Setup Setup
Suite Teardown Teardown
Default Tags
*** Keywords ***
Setup
Start VIC Machine Server
Set Test Environment Variables
${PUBLIC_NETWORK}= Remove String %{PUBLIC_NETWORK} '
Set Suite Variable ${PUBLIC_NETWORK}
Teardown
Terminate All Processes kill=True
Create VCH
[Arguments] ${data}
Post Path Under Target vch ${data}
Create VCH Within Datacenter
[Arguments] ${data}
${dcID}= Get Datacenter ID
Post Path Under Target datacenter/${dcID}/vch ${data}
Inspect VCH Config ${name}
${RC} ${OUTPUT}= Run And Return Rc And Output bin/vic-machine-linux inspect config --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --name=${name} --format raw
Should Be Equal As Integers ${RC} 0
Set Test Variable ${OUTPUT}
Get VCH ${name}
Get Path Under Target vch
${id}= Run echo '${OUTPUT}' | jq -r '.vchs[] | select(.name=="${name}").id'
Get Path Under Target vch/${id}
*** 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}}}'
Verify Return Code
Verify Status Created
Inspect VCH Config %{VCH-NAME}-api-test-minimal
Output Should Contain --image-store=ds://%{TEST_DATASTORE}
Output Should Contain --bridge-network=%{BRIDGE_NETWORK}
Get VCH %{VCH-NAME}-api-test-minimal
Property Should Be Equal .name %{VCH-NAME}-api-test-minimal
Property Should Not Be Equal .compute.resource.id null
Property Should Contain .storage.image_stores[0] %{TEST_DATASTORE}
Property Should Be Equal .storage.base_image_size.value 8000000
Property Should Be Equal .storage.base_image_size.units KB
Property Should Contain .auth.server.certificate.pem -----BEGIN CERTIFICATE-----
Property Should Be Equal .auth.server.private_key.pem null
Property Should Contain .network.bridge.ip_range 172.16.0.0/12
Property Should Contain .runtime.power_state poweredOn
Property Should Contain .runtime.upgrade_status Up to date
Wait For VCH Initialization name=%{VCH-NAME}-api-test-minimal
[Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-minimal
Create minimal VCH within datacenter
Create VCH Within Datacenter '{"name":"%{VCH-NAME}-api-test-dc","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}}}'
Verify Return Code
Verify Status Created
Inspect VCH Config %{VCH-NAME}-api-test-dc
Output Should Contain --image-store=ds://%{TEST_DATASTORE}
Output Should Contain --bridge-network=%{BRIDGE_NETWORK}
Get VCH %{VCH-NAME}-api-test-dc
Property Should Be Equal .name %{VCH-NAME}-api-test-dc
Property Should Not Be Equal .compute.resource.id null
Property Should Contain .storage.image_stores[0] %{TEST_DATASTORE}
Property Should Be Equal .storage.base_image_size.value 8000000
Property Should Be Equal .storage.base_image_size.units KB
Property Should Contain .auth.server.certificate.pem -----BEGIN CERTIFICATE-----
Property Should Be Equal .auth.server.private_key.pem null
Property Should Contain .network.bridge.ip_range 172.16.0.0/12
Property Should Contain .runtime.power_state poweredOn
Property Should Contain .runtime.upgrade_status Up to date
Wait For VCH Initialization name=%{VCH-NAME}-api-test-dc
[Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-dc
Create complex VCH
Create VCH '{"name":"%{VCH-NAME}-api-test-complex","debug":3,"compute":{"cpu":{"limit":{"units":"MHz","value":2345},"reservation":{"units":"GHz","value":2},"shares":{"level":"high"}},"memory":{"limit":{"units":"MiB","value":1200},"reservation":{"units":"MiB","value":501},"shares":{"number":81910}},"resource":{"name":"%{TEST_RESOURCE}"}},"endpoint":{"cpu":{"sockets":2},"memory":{"units":"MiB","value":3072}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"],"volume_stores":[{"datastore":"ds://%{TEST_DATASTORE}/test-volumes/foo","label":"foo"}],"base_image_size":{"units":"B","value":16000000}},"network":{"bridge":{"ip_range":"172.16.0.0/12","port_group":{"name":"%{BRIDGE_NETWORK}"}},"container":[{"alias":"vic-containers","firewall":"outbound","nameservers":["8.8.8.8","8.8.4.4"],"port_group":{"name":"${PUBLIC_NETWORK}"},"gateway":{"address":"203.0.113.1","routing_destinations":["203.0.113.1/24"]},"ip_ranges":["203.0.113.8/31"]}],"public":{"port_group":{"name":"${PUBLIC_NETWORK}"},"static":"192.168.100.22/24","gateway":{"address":"192.168.100.1"},"nameservers":["192.168.110.10","192.168.1.1"]}},"registry":{"image_fetch_proxy":{"http":"http://example.com","https":"https://example.com"},"insecure":["https://insecure.example.com"],"whitelist":["10.0.0.0/8"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}},"syslog_addr":"tcp://syslog.example.com:4444", "container": {"name_convention": "container-{id}"}}'
Verify Return Code
Verify Status Created
Inspect VCH Config %{VCH-NAME}-api-test-complex
Output Should Contain --debug=3
Output Should Contain --cpu=2345
Output Should Contain --cpu-reservation=2000
Output Should Contain --cpu-shares=high
Output Should Contain --memory=1200
Output Should Contain --memory-reservation=501
Output Should Contain --memory-shares=81910
Output Should Contain --endpoint-cpu=2
Output Should Contain --endpoint-memory=3072
Output Should Contain --image-store=ds://%{TEST_DATASTORE}
Output Should Contain --volume-store=ds://%{TEST_DATASTORE}/test-volumes/foo:foo
Output Should Contain --base-image-size=16MB
Output Should Contain --bridge-network=%{BRIDGE_NETWORK}
Output Should Contain --container-network=${PUBLIC_NETWORK}:vic-containers
Output Should Contain --container-network-gateway=${PUBLIC_NETWORK}:203.0.113.1/24
Output Should Contain --container-network-ip-range=${PUBLIC_NETWORK}:203.0.113.8/31
Output Should Contain --container-network-dns=${PUBLIC_NETWORK}:8.8.8.8
Output Should Contain --container-network-dns=${PUBLIC_NETWORK}:8.8.4.4
Output Should Contain --container-network-firewall=${PUBLIC_NETWORK}:outbound
Output Should Contain --public-network-gateway=192.168.100.1
Output Should Contain --public-network-ip=192.168.100.22/24
Output Should Contain --dns-server=192.168.110.10
Output Should Contain --dns-server=192.168.1.1
Output Should Contain --insecure-registry=https://insecure.example.com
Output Should Contain --whitelist-registry=10.0.0.0/8
Output Should Contain --whitelist-registry=https://insecure.example.com
Get VCH %{VCH-NAME}-api-test-complex
Property Should Be Equal .name %{VCH-NAME}-api-test-complex
Property Should Be Equal .debug 3
Property Should Be Equal .syslog_addr tcp://syslog.example.com:4444
Property Should Not Be Equal .compute.resource.id null
Property Should Be Equal .compute.cpu.limit.value 2345
Property Should Be Equal .compute.cpu.limit.units MHz
Property Should Be Equal .compute.cpu.reservation.value 2000
Property Should Be Equal .compute.cpu.reservation.units MHz
Property Should Be Equal .compute.cpu.shares.level high
Property Should Be Equal .compute.memory.limit.value 1200
Property Should Be Equal .compute.memory.limit.units MiB
Property Should Be Equal .compute.memory.reservation.value 501
Property Should Be Equal .compute.memory.reservation.units MiB
Property Should Be Equal .compute.memory.shares.number 81910
Property Should Be Equal .endpoint.cpu.sockets 2
Property Should Be Equal .endpoint.memory.value 3072
Property Should Be Equal .endpoint.memory.units MiB
Property Should Contain .storage.image_stores[0] %{TEST_DATASTORE}
Property Should Contain .storage.volume_stores[0].datastore %{TEST_DATASTORE}/test-volumes/foo
Property Should Contain .storage.volume_stores[0].label foo
Property Should Be Equal .storage.base_image_size.value 16000
Property Should Be Equal .storage.base_image_size.units KB
Property Should Be Equal .registry.image_fetch_proxy.http http://example.com
Property Should Be Equal .registry.image_fetch_proxy.https https://example.com
Property Should Contain .registry.insecure | join(" ") https://insecure.example.com
Property Should Contain .registry.whitelist | join(" ") https://insecure.example.com
Property Should Contain .registry.whitelist | join(" ") 10.0.0.0/8
Property Should Contain .auth.server.certificate.pem -----BEGIN CERTIFICATE-----
Property Should Be Equal .auth.server.private_key.pem null
Property Should Be Equal .network.bridge.ip_range 172.16.0.0/12
Property Should Be Equal .network.container[0].alias vic-containers
Property Should Be Equal .network.container[0].firewall outbound
Property Should Be Equal .network.container[0].ip_ranges[0] 203.0.113.8/31
Property Should Be Equal .network.container[0].nameservers[0] 8.8.8.8
Property Should Be Equal .network.container[0].nameservers[1] 8.8.4.4
Property Should Be Equal .network.container[0].gateway.address 203.0.113.1
Property Should Be Equal .network.container[0].gateway.routing_destinations[0] 203.0.113.1/24
Property Should Be Equal .network.public.gateway.address 192.168.100.1
Property Should Be Equal .network.public.nameservers[0] 192.168.110.10
Property Should Be Equal .network.public.nameservers[1] 192.168.1.1
Property Should Be Equal .runtime.power_state poweredOn
Property Should Be Equal .runtime.upgrade_status Up to date
Property Should Be Equal .container.name_convention container-{id}
[Teardown] Run Secret VIC Machine Delete Command %{VCH-NAME}-api-test-complex
Fail to create VCH with invalid operations credentials
Create VCH '{"name":"%{VCH-NAME}-api-bad-ops","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"endpoint":{"operations_credentials":{"user":"invalid","password":"invalid"}},"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}}}'
Verify Return Code
Verify Status Bad Request
Output Should Contain operations credentials
Fail to create VCH with invalid datastore
Create VCH '{"name":"%{VCH-NAME}-api-bad-storage","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}-invalid"]},"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}}}'
Verify Return Code
Verify Status Bad Request
Output Should Contain datastore
Fail to create VCH with invalid compute
Create VCH '{"name":"%{VCH-NAME}-api-bad-compute","compute":{"resource":{"name":"%{TEST_RESOURCE}-invalid"}},"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}}}'
Verify Return Code
Verify Status Bad Request
Output Should Contain compute resource
Fail to create VCH without network
Create VCH '{"name":"%{VCH-NAME}-api-bad-network","compute":{"resource":{"name":"%{TEST_RESOURCE}"}},"storage":{"image_stores":["ds://%{TEST_DATASTORE}"]},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}'
Verify Return Code
Verify Status Bad Request
Output Should Contain network
Fail to create VCH with gateway without static address
Create VCH '{"name":"%{VCH-NAME}-api-bad-gateway","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}"},"gateway":{"address":"127.0.0.1","routing_destinations":[]}}},"auth":{"server":{"generate":{"cname":"vch.example.com","organization":["VMware, Inc."],"size":{"value":2048,"units":"bits"}}},"client":{"no_tls_verify": true}}}'
Verify Return Code
Verify Status Bad Request
Output Should Contain static

View File

@@ -0,0 +1,26 @@
Test 23-05 - VCH Logs
=======
# Purpose:
To verify vic-machine-server can provide logs for a VCH host when available
# References:
[1 - VIC Machine Service API Design Doc - VCH Certificate](../../../doc/design/vic-machine/service.md)
# Environment:
This test requires that a vSphere server is running and available, where VCH can be deployed.
# Test Steps:
1. Deloy a VCH into the test environment
2. Verify that the creation log is available after the VCH is created using the vic-machine-service
3. Verify that the creation log is available for its particular datacenter using the vic-machine-service
4. Delete the log file from VCH datastore folder
5. Verify that creation log is unavailable (404) using the vic-machine service
6. Verify that creation log is unavailable (404) for its particular datacenter using the vic-machine-service
# Expected Outcome:
* Step 2-3 should succeed and output should contain log message that the creation is completed successfully
* Step 5-6 should error with a 404 (not found) as no log file exists
# Possible Problems:
None

View File

@@ -0,0 +1,89 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 23-05 - VCH Logs
Resource ../../resources/Util.robot
Resource ../../resources/Group23-VIC-Machine-Service-Util.robot
Suite Setup Start VIC Machine Server
Suite Teardown Terminate All Processes kill=True
Test Setup Install VIC Appliance To Test Server
Test Teardown Cleanup VIC Appliance On Test Server
Default Tags
*** Keywords ***
Get VCH Log
[Arguments] ${vch-id}
Get Path Under Target vch/${vch-id}/log
Get VCH Log Within Datacenter
[Arguments] ${vch-id}
${dcID}= Get Datacenter ID
Get Path Under Target datacenter/${dcID}/vch/${vch-id}/log
Delete Log File From VCH Datastore
${filename}= Run GOVC_DATASTORE=%{TEST_DATASTORE} govc datastore.ls %{VCH-NAME} | grep vic-machine_
Should Not Be Empty ${filename}
${output}= Run govc datastore.rm "%{VCH-NAME}/${filename}"
${filename}= Run GOVC_DATASTORE=%{TEST_DATASTORE} govc datastore.ls %{VCH-NAME} | grep vic-machine_
Should Be Empty ${filename}
Verify Log
Output Should Contain \n
Output Should Contain Installer completed successfully
Verify Error String
Should Be String ${OUTPUT}
*** Test Cases ***
Get VCH Creation Log succeeds after installation completes
${id}= Get VCH ID %{VCH-NAME}
Get VCH Log ${id}
Verify Return Code
Verify Status Ok
Verify Log
Get VCH Log Within Datacenter ${id}
Verify Return Code
Verify Status Ok
Verify Log
Get VCH Creation log errors with 404 after log file is deleted
${id}= Get VCH ID %{VCH-NAME}
Delete Log File From VCH Datastore
Get VCH Log ${id}
Verify Return Code
Verify Status Not Found
Get VCH Log Within Datacenter ${id}
Verify Error String
Verify Return Code
Verify Status Not Found

View File

@@ -0,0 +1,26 @@
Test 23-06 - VCH Certificate
=======
# Purpose:
To verify vic-machine-server can provide a VCH host certificate when available
# References:
[1 - VIC Machine Service API Design Doc - VCH Certificate](../../../doc/design/vic-machine/service.md)
# Environment:
This test runs an external service binary that exposes the vic-machine API.
# Test Steps:
1. Deploy the VCH into the test environment with tls enabled
2. Verify that the certificate is available using the vic-machine service
3. Verify that the certificate is available for its particular datacenter using the vic-machine service
4. Deploy a new VCH into the test environment using --no-tls and --no-tls-verify so that tls is disabled and no cert is created
5. Verify that the certificate is unavailable (404) using the vic-machine service
6. Verify that the certificate is unavailable (404) for its particular datacenter using the vic-machine service
# Expected Outcome:
* Step 2-3 should succeed and output should contain the host certificate
* Step 5-6 should error with 404 (not found) as no certs exist
# Possible Problems:
None

View File

@@ -0,0 +1,105 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 23-06 - VCH Certificate
Resource ../../resources/Util.robot
Resource ../../resources/Group23-VIC-Machine-Service-Util.robot
Suite Setup Start VIC Machine Server
Suite Teardown Terminate All Processes kill=True
Test Teardown Cleanup VIC Appliance On Test Server
Default Tags
*** Keywords ***
Install VIC Machine Without TLS
[Arguments] ${vic-machine}=bin/vic-machine-linux ${appliance-iso}=bin/appliance.iso ${bootstrap-iso}=bin/bootstrap.iso ${certs}=${true} ${vol}=default ${cleanup}=${true} ${debug}=1 ${additional-args}=${EMPTY}
Set Test Environment Variables
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.esxcli network firewall set -e false
# Attempt to cleanup old/canceled tests
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Datastore On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling Networks On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling vSwitches On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling Containers On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling Resource Pools On Test Server
Set Suite Variable ${vicmachinetls} --no-tls
Log To Console \nInstalling VCH to test server with tls disabled...
${output}= Run VIC Machine Command ${vic-machine} ${appliance-iso} ${bootstrap-iso} ${certs} ${vol} ${debug} ${additional-args}
Log ${output}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${certs}
Log To Console Installer completed successfully: %{VCH-NAME}...
[Return] ${output}
Get VCH Certificate
[Arguments] ${vch-id}
Get Path Under Target vch/${vch-id}/certificate
Get VCH Certificate Within Datacenter
[Arguments] ${vch-id}
${dcID}= Get Datacenter ID
Get Path Under Target datacenter/${dcID}/vch/${vch-id}/certificate
Verify Certificate
Output Should Contain BEGIN CERTIFICATE
Output Should Contain END CERTIFICATE
Output Should Not Contain "
Verify Certificate Not Found
Output Should Contain No certificate found for VCH
Output Should Not Contain BEGIN CERTIFICATE
Output Should Not Contain END CERTIFICATE
*** Test Cases ***
Get VCH Certificate
[Setup] Install VIC Appliance To Test Server
${id}= Get VCH ID %{VCH-NAME}
Get VCH Certificate ${id}
Verify Return Code
Verify Status Ok
Verify Certificate
Get VCH Certificate Within Datacenter ${id}
Verify Return Code
Verify Status Ok
Verify Certificate
Get VCH Certificate No TLS
[Setup] Install VIC Machine Without TLS
${id}= Get VCH ID %{VCH-NAME}
Get VCH Certificate ${id}
Verify Return Code
Verify Status Not Found
Verify Certificate Not Found
Get VCH Certificate Within Datacenter ${id}
Verify Return Code
Verify Status Not Found
Verify Certificate Not Found

View File

@@ -0,0 +1,248 @@
Test 23-08 - VCH Delete
=======================
#### Purpose:
To verify vic-machine-server deletes the correct set of objects as a part of an API call
#### References:
1. [VIC Machine Service API Design Doc](../../../doc/design/vic-machine/service.md)
#### Environment:
This suite requires a vSphere system where VCHs can be deployed with default and named volume stores.
Basic Validation
----------------
### 1. Delete VCH
#### Test Steps:
1. Create a VCH
2. Issue a delete request without a body
3. Verify that the VCH no longer exists
#### Expected Outcome:
* The VCH is deleted
### 2. Delete VCH within datacenter
#### Test Steps:
1. Create a VCH
2. Issue a delete request without a body to the datacenter-scoped handler
3. Verify that the VCH no longer exists
#### Expected Outcome:
* The VCH is deleted
### 3. Delete the correct VCH
#### Test Steps:
1. Create two VCHs
2. Issue a delete request for one VCH
3. Verify that the deleted VCH no longer exists
4. Verify that the other VCH still exists
#### Expected Outcome:
* Only the expected VCH is deleted
### 4. Delete invalid VCH
#### Test Steps:
1. Create a VCH
2. Issue a delete request for a non-existent VCH
3. Verify that the VCH still exists
#### Expected Outcome:
* The erroneous deletion returns a 404 Not Found without side effects
### 5. Delete VCH in invalid datacenter
#### Test Steps:
1. Create a VCH
2. Issue a deletion request for that VCH scoped to an invalid datacenter
3. Verify that the VCH still exists
#### Expected Outcome:
* The erroneous deletion returns a 404 Not Found without side effects
### 6. Delete with invalid bodies
#### Test Steps:
1. Create a VCH
2. Issue a delete request for that VCH with a malformed body
3. Issue a delete request for that VCH with an invalid value for the `containers` element
4. Issue a delete request for that VCH with an invalid value for the `volume_stores` element
5. Issue a delete request for that VCH with a valid value for the `volume_stores` element, but an invalid value for the `containers` element
6. Issue a delete request for that VCH with a valid value for the `containers` element, but an invalid value for the `volume_stores` element
7. Verify that the VCH still exists
#### Expected Outcome:
* Each erroneous deletion returns a 422 Unprocessable Entity without side effects
With Containers
---------------
### 7. Delete VCH with powered off container
#### Test Steps:
1. Create a VCH with a powered off container
2. Issue a delete request without a body
3. Verify that the VCH no longer exists
4. Verify that the powered off container VM no longer exists
#### Expected Outcome:
* The VCH and powered off container are both deleted
### 8. Delete VCH with powered off container deletes files
#### Test Steps:
1. Create a VCH with a powered off container
2. Issue a delete request without a body
3. Verify that the files for the powered off container VM no longer exist
4. Verify that the VCH no longer exists
#### Expected Outcome:
* The VCH and powered off container are both deleted
### 9. Delete VCH without deleting powered on container
#### Test Steps:
1. Create a VCH with a powered off container and a powered on container
2. Issue a delete request without a body
3. Verify that the VCH still exists
4. Verify that the powered on container VM still exists
5. Verify that the powered off container VM no longer exists
#### Expected Outcome:
* The powered off container is deleted, but the deletion fails with a 500 Internal Server Error and the VCH and powered on container both remain
### 10. Delete VCH explicitly without deleting powered on container
#### Test Steps:
1. Create a VCH with a powered off container and a powered on container
2. Issue a delete request with a body expressing that only powered off containers should be deleted
3. Verify that the VCH still exists
4. Verify that the powered on container VM still exists
5. Verify that the powered off container VM no longer exists
#### Expected Outcome:
* The powered off container is deleted, but the deletion fails with a 500 Internal Server Error and the VCH and powered on container both remain
### 11. Delete VCH and delete powered on container
#### Test Steps:
1. Create a VCH with a powered off container and a powered on container
2. Issue a delete request with a body expressing that all containers should be deleted
3. Verify that the VCH still exists
4. Verify that the powered on container VM no longer exists
5. Verify that the powered off container VM no longer exists
#### Expected Outcome:
* The VCH and both containers are deleted
With Volumes
------------
Note: Because it is more difficult to verify the existence or deletion of anonymous volumes, they are not included in the following tests. If the deletion code is ever updated to treat different types of volumes differently, tests should be added.
### 12. Delete VCH and powered off containers and volumes
#### Test Steps:
1. Create a VCH with a named volume store
2. Create a powered off container that has a named volume on the default volume store
3. Create a powered off container that has a named volume on the named volume store
4. Issue a delete request with a body expressing that powered off containers and volume stores should be deleted
5. Verify that the VCH no longer exists
6. Verify that the container VMs no longer exist
7. Verify that the volume stores and volumes no longer exist
#### Expected Outcome:
* The VCH, both containers, both volume stores, and both are deleted
### 13. Delete VCH and powered on containers and volumes
#### Test Steps:
1. Create a VCH with a named volume store
2. Create a powered on container that has a named volume on the default volume store
3. Create a powered on container that has a named volume on the named volume store
4. Issue a delete request with a body expressing that all containers and volume stores should be deleted
5. Verify that the VCH no longer exists
6. Verify that the container VMs no longer exist
7. Verify that the volume stores and volumes no longer exist
#### Expected Outcome:
* The VCH, both containers, both volume stores, and both are deleted
### 14. Delete VCH and powered off container and preserve volumes
#### Test Steps:
1. Create a VCH with a named volume store
2. Create a powered off container that has a named volume on the default volume store
3. Create a powered off container that has a named volume on the named volume store
4. Issue a delete request with a body expressing that powered off containers, but not volume stores, should be deleted
5. Verify that the VCH no longer exists
6. Verify that the container VMs no longer exist
7. Verify that the volume stores and volumes still exist
8. Create a new VCH re-using the same volume stores
9. Create a powered off container re-using the named volume on the default volume store
10. Create a powered off container re-using the named volume on the named volume store
#### Expected Outcome:
* The VCH and both containers are deleted, but both volume stores and volumes are preserved and re-usable
### 15. Delete VCH and powered on container but preserve volume
#### Test Steps:
1. Create a VCH with a named volume store
2. Create a powered on container that has a named volume on the default volume store
3. Issue a delete request with a body expressing that all containers, but not volume stores, should be deleted
4. Verify that the VCH no longer exists
5. Verify that the container VM no longer exists
6. Verify that the volume store and volume still exists
7. Create a new VCH re-using the same volume store
8. Create a powered off container re-using the named volume on the default volume store
#### Expected Outcome:
* The VCH and container are deleted, but the volume store and volume are preserved and re-usable
### 16. Delete VCH and preserve powered on container and volumes
#### Test Steps:
1. Create a VCH with a named volume store
2. Create a powered on container that has a named volume on the default volume store
3. Issue a delete request with a body expressing that neither powered on containers nor volume stores should be deleted
4. Verify that the VCH still exists
5. Verify that the container VM still exists
6. Verify that the volume store and volume still exist
#### Expected Outcome:
* The deletion fails with a 500 Internal Server Error and the VCH, powered on container, volume store, and volume all remain
### 17. Delete VCH and preserve powered on container and fail to delete volumes
#### Test Steps:
1. Create a VCH with a named volume store
2. Create a powered on container that has a named volume on the default volume store
3. Issue a delete request with a body expressing that volume stores, but not powered on containers, should be deleted
4. Verify that the VCH still exists
5. Verify that the container VM still exists
6. Verify that the volume store and volume still exist
#### Expected Outcome:
* The deletion fails with a 500 Internal Server Error and the VCH, powered on container, volume store, and volume all remain

View File

@@ -0,0 +1,690 @@
# Copyright 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation Test 23-08 - VCH Delete
Resource ../../resources/Util.robot
Resource ../../resources/Group23-VIC-Machine-Service-Util.robot
Suite Setup Start VIC Machine Server
Suite Teardown Terminate All Processes kill=True
Test Setup Install And Prepare VIC Appliance
Test Teardown Run govc datastore.rm %{VCH-NAME}-VOL
Default Tags
*** Keywords ***
Pull Busybox
Run Docker Command pull ${busybox}
Verify Return Code
Output Should Not Contain Error
Install And Prepare VIC Appliance
Install VIC Appliance To Test Server
Pull Busybox
Re-Install And Prepare VIC Appliance
Install VIC Appliance To Test Server With Current Environment Variables cleanup=${false}
Pull Busybox
Install And Prepare VIC Appliance With Volume Stores
Set Test Environment Variables
Set Test Variable ${VOLUME_STORE_PATH} %{VCH-NAME}-VOL-foo
Set Test Variable ${VOLUME_STORE_NAME} foo
Re-Install And Prepare VIC Appliance With Volume Stores
Re-Install And Prepare VIC Appliance With Volume Stores
Install VIC Appliance To Test Server With Current Environment Variables additional-args=--volume-store=%{TEST_DATASTORE}/${VOLUME_STORE_PATH}:${VOLUME_STORE_NAME} cleanup=${false}
Pull Busybox
Get VCH ID ${name}
Get Path Under Target vch
${id}= Run echo '${OUTPUT}' | jq -r '.vchs[] | select(.name=="${name}").id'
[Return] ${id}
Run Docker Command
[Arguments] ${command}
${RC} ${OUTPUT}= Run And Return Rc And Output docker %{VCH-PARAMS} ${command}
Set Test Variable ${RC}
Set Test Variable ${OUTPUT}
Start Last Container
Run Docker Command start ${OUTPUT}
Verify Return Code
Output Should Not Contain Error:
Populate VCH with Powered Off Container
${POWERED_OFF_CONTAINER_NAME}= Generate Random String 15
Run Docker Command create --name ${POWERED_OFF_CONTAINER_NAME} ${busybox} /bin/top
Verify Return Code
Output Should Not Contain Error
Set Test Variable ${POWERED_OFF_CONTAINER_NAME}
Populate VCH with Powered On Container
${POWERED_ON_CONTAINER_NAME}= Generate Random String 15
Run Docker Command create --name ${POWERED_ON_CONTAINER_NAME} ${busybox} /bin/top
Verify Return Code
Output Should Not Contain Error
Start Last Container
Set Test Variable ${POWERED_ON_CONTAINER_NAME}
Populate VCH with Named Volume on Default Volume Store Attached to Powered Off Container
${BASE}= Generate Random String 15
Set Test Variable ${OFF_NV_DVS_VOLUME_NAME} ${BASE}-nv-dvs
Set Test Variable ${OFF_NV_DVS_CONTAINER_NAME} ${BASE}-c-nv-dvs
Run Docker Command volume create --name ${OFF_NV_DVS_VOLUME_NAME}
Verify Return Code
Output Should Not Contain Error
Run Docker Command create --name ${OFF_NV_DVS_CONTAINER_NAME} -v ${OFF_NV_DVS_VOLUME_NAME}:/volume ${busybox} /bin/top
Verify Return Code
Output Should Not Contain Error
Populate VCH with Named Volume on Named Volume Store Attached to Powered Off Container
${BASE}= Generate Random String 15
Set Test Variable ${OFF_NV_NVS_VOLUME_NAME} ${BASE}-nv-nvs
Set Test Variable ${OFF_NV_NVS_CONTAINER_NAME} ${BASE}-c-nv-nvs
Run Docker Command volume create --name ${OFF_NV_NVS_VOLUME_NAME} --opt VolumeStore=${VOLUME_STORE_NAME}
Verify Return Code
Output Should Not Contain Error
Run Docker Command create --name ${OFF_NV_NVS_CONTAINER_NAME} -v ${OFF_NV_NVS_VOLUME_NAME}:/volume ${busybox} /bin/top
Verify Return Code
Output Should Not Contain Error
Populate VCH with Named Volume on Default Volume Store Attached to Powered On Container
${BASE}= Generate Random String 15
Set Test Variable ${ON_NV_DVS_VOLUME_NAME} ${BASE}-nv-dvs-on
Set Test Variable ${ON_NV_DVS_CONTAINER_NAME} ${BASE}-c-nv-dvs-on
Run Docker Command volume create --name ${ON_NV_DVS_VOLUME_NAME}
Verify Return Code
Output Should Not Contain Error
Run Docker Command create --name ${ON_NV_DVS_CONTAINER_NAME} -v ${ON_NV_DVS_VOLUME_NAME}:/volume ${busybox} /bin/top
Verify Return Code
Output Should Not Contain Error
Start Last Container
Populate VCH with Named Volume on Named Volume Store Attached to Powered On Container
${BASE}= Generate Random String 15
Set Test Variable ${ON_NV_NVS_VOLUME_NAME} ${BASE}-nv-nvs-on
Set Test Variable ${ON_NV_NVS_CONTAINER_NAME} ${BASE}-c-nv-nvs-on
Run Docker Command volume create --name ${ON_NV_NVS_VOLUME_NAME} --opt VolumeStore=${VOLUME_STORE_NAME}
Verify Return Code
Output Should Not Contain Error
Run Docker Command create --name ${ON_NV_NVS_CONTAINER_NAME} -v ${ON_NV_NVS_VOLUME_NAME}:/volume ${busybox} /bin/top
Verify Return Code
Output Should Not Contain Error
Start Last Container
Verify Container Exists
[Arguments] ${name}
${vm}= Run govc vm.info -json=true ${name}-* | jq '.VirtualMachines | length'
Should Be Equal As Integers ${vm} 1
Verify Container Not Exists
[Arguments] ${name}
${vm}= Run govc vm.info -json=true ${name}-* | jq '.VirtualMachines | length'
Should Be Equal As Integers ${vm} 0
Verify VCH Exists
[Arguments] ${path} ${name}=%{VCH-NAME}
Get Path Under Target ${path}
Verify Return Code
Verify Status Ok
${rp}= Run govc ls -json=true host/*/Resources/${name} | jq '.elements | length'
${vm}= Run govc vm.info -json=true ${name} | jq '.VirtualMachines | length'
${ds}= Run govc datastore.ls ${name}
Should Be Equal As Integers ${rp} 1
Should Be Equal As Integers ${vm} 1
Should Not Contain ${ds} was not found
Verify VCH Not Exists
[Arguments] ${path} ${name}=%{VCH-NAME}
Get Path Under Target ${path}
Verify Return Code
Verify Status Not Found
${rp}= Run govc ls -json=true host/*/Resources/${name} | jq '.elements | length'
${vm}= Run govc vm.info -json=true ${name} | jq '.VirtualMachines | length'
${ds}= Run govc datastore.ls ${name}
Should Be Equal As Integers ${rp} 0
Should Be Equal As Integers ${vm} 0
Should Contain ${ds} was not found
Verify Volume Exists
[Arguments] ${volume} ${name}
${ds}= Run govc datastore.ls ${volume}/volumes/${name}
Should Not Contain ${ds} was not found
Verify Volume Exists Docker
[Arguments] ${volume} ${name}
${ds}= Run govc datastore.ls ${volume}/volumes/${name}
Should Not Contain ${ds} was not found
Run Docker Command volume ls -q -f name=${name}
Verify Return Code
Output Should Contain ${name}
Verify Volume Not Exists
[Arguments] ${volume} ${name}
${ds}= Run govc datastore.ls ${volume}/volumes/${name}
Should Contain ${ds} was not found
Verify Volume Not Exists Docker
[Arguments] ${volume} ${name}
${ds}= Run govc datastore.ls ${volume}/volumes/${name}
Should Contain ${ds} was not found
Run Docker Command volume ls -q -f name=${name}
Verify Return Code
Output Should Not Contain ${name}
Verify Volume Store Exists
[Arguments] ${name}
${ds}= Run govc datastore.ls ${name}
Should Not Contain ${ds} was not found
# don't currently have the pretty volume store name
# Run Docker Command info
# Verify Return Code
# Output Should Match Regexp ^VolumeStores:\s[^$]*${name}
Verify Volume Store Not Exists
[Arguments] ${name}
${ds}= Run govc datastore.ls ${name}
Should Contain ${ds} was not found
# don't currently have the pretty volume store name
# Run Docker Command info
# Verify Return Code
# Output Should Not Match Regexp ^VolumeStores:\s[^$]*${name}
*** Test Cases ***
Delete VCH
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists vch/${id}
Delete Path Under Target vch/${id}
Verify Return Code
Verify Status Accepted
Verify VCH Not Exists vch/${id}
# No VCH to delete
[Teardown] NONE
Delete VCH within datacenter
${dc}= Get Datacenter ID
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists datacenter/${dc}/vch/${id}
Delete Path Under Target datacenter/${dc}/vch/${id}
Verify Return Code
Verify Status Accepted
Verify VCH Not Exists datacenter/${dc}/vch/${id}
# No VCH to delete
[Teardown] NONE
Delete the correct VCH
${one}= Get VCH ID %{VCH-NAME}
${old}= Set Variable %{VCH-NAME}
Install VIC Appliance To Test Server
${two}= Get VCH ID %{VCH-NAME}
Should Not Be Equal ${one} ${two}
# This will fail when run outside of drone because "Install VIC Appliance To Test Server"
# will delete "dangling" VCHs - which means any associated with a drone job id that isn't running
Verify VCH Exists vch/${one} ${old}
Verify VCH Exists vch/${two}
Delete Path Under Target vch/${one}
Verify Return Code
Verify Status Accepted
Verify VCH Not Exists vch/${one} ${old}
Verify VCH Exists vch/${two}
[Teardown] Cleanup VIC Appliance On Test Server
Delete invalid VCH
${id}= Get VCH ID %{VCH-NAME}
Delete Path Under Target vch/INVALID
Verify Return Code
Verify Status Not Found
Verify VCH Exists vch/${id}
[Teardown] Cleanup VIC Appliance On Test Server
Delete VCH in invalid datacenter
${id}= Get VCH ID %{VCH-NAME}
Delete Path Under Target datacenter/INVALID/vch/${id}
Verify Return Code
Verify Status Not Found
Verify VCH Exists vch/${id}
[Teardown] Cleanup VIC Appliance On Test Server
Delete with invalid bodies
${id}= Get VCH ID %{VCH-NAME}
Delete Path Under Target vch/${id} '{"invalid"}'
Verify Return Code
Verify Status Bad Request
Delete Path Under Target vch/${id} '{"containers":"invalid"}'
Verify Return Code
Verify Status Unprocessable Entity
Output Should Contain containers
Delete Path Under Target vch/${id} '{"volume_stores":"invalid"}'
Verify Return Code
Verify Status Unprocessable Entity
Output Should Contain volume_stores
Delete Path Under Target vch/${id} '{"containers":"invalid", "volume_stores":"all"}'
Verify Return Code
Verify Status Unprocessable Entity
Output Should Contain containers
Delete Path Under Target vch/${id} '{"containers":"all", "volume_stores":"invalid"}'
Verify Return Code
Verify Status Unprocessable Entity
Output Should Contain volume_stores
Verify VCH Exists vch/${id}
[Teardown] Cleanup VIC Appliance On Test Server
Delete VCH with powered off container
${id}= Get VCH ID %{VCH-NAME}
Populate VCH with Powered Off Container
Verify Container Exists ${POWERED_OFF_CONTAINER_NAME}
Verify VCH Exists vch/${id}
Delete Path Under Target vch/${id}
Verify Return Code
Verify Status Accepted
Verify VCH Not Exists vch/${id}
Verify Container Not Exists ${POWERED_OFF_CONTAINER_NAME}
# No VCH to delete
[Teardown] NONE
Delete VCH with powered off container deletes files
${id}= Get VCH ID %{VCH-NAME}
Populate VCH with Powered Off Container
Verify VCH Exists vch/${id}
Run Docker Command inspect ${POWERED_OFF_CONTAINER_NAME}
${uuid}= Run echo '${OUTPUT}' | jq -r '.[0].Id'
${ds}= Run govc datastore.ls ${uuid}
Should Not Contain ${ds} was not found
Delete Path Under Target vch/${id}
Verify Return Code
Verify Status Accepted
${ds}= Run govc datastore.ls ${uuid}
Should Contain ${ds} was not found
Verify VCH Not Exists vch/${id}
# No VCH to delete
[Teardown] NONE
Delete VCH without deleting powered on container
${id}= Get VCH ID %{VCH-NAME}
Populate VCH with Powered On Container
Populate VCH with Powered Off Container
Verify Container Exists ${POWERED_ON_CONTAINER_NAME}
Verify Container Exists ${POWERED_OFF_CONTAINER_NAME}
Verify VCH Exists vch/${id}
Delete Path Under Target vch/${id}
Verify Return Code
Verify Status Internal Server Error
Verify VCH Exists vch/${id}
Verify Container Exists ${POWERED_ON_CONTAINER_NAME}
Verify Container Not Exists ${POWERED_OFF_CONTAINER_NAME}
[Teardown] Cleanup VIC Appliance On Test Server
Delete VCH explicitly without deleting powered on container
${id}= Get VCH ID %{VCH-NAME}
Populate VCH with Powered On Container
Populate VCH with Powered Off Container
Verify Container Exists ${POWERED_ON_CONTAINER_NAME}
Verify Container Exists ${POWERED_OFF_CONTAINER_NAME}
Verify VCH Exists vch/${id}
Delete Path Under Target vch/${id} '{"containers":"off"}'
Verify Return Code
Verify Status Internal Server Error
Verify VCH Exists vch/${id}
Verify Container Exists ${POWERED_ON_CONTAINER_NAME}
Verify Container Not Exists ${POWERED_OFF_CONTAINER_NAME}
[Teardown] Cleanup VIC Appliance On Test Server
Delete VCH and delete powered on container
${id}= Get VCH ID %{VCH-NAME}
Populate VCH with Powered On Container
Populate VCH with Powered Off Container
Verify Container Exists ${POWERED_ON_CONTAINER_NAME}
Verify Container Exists ${POWERED_OFF_CONTAINER_NAME}
Verify VCH Exists vch/${id}
Delete Path Under Target vch/${id} '{"containers":"all"}'
Verify Return Code
Verify Status Accepted
Verify VCH Not Exists vch/${id}
Verify Container Not Exists ${POWERED_ON_CONTAINER_NAME}
Verify Container Not Exists ${POWERED_OFF_CONTAINER_NAME}
Delete VCH and powered off containers and volumes
[Setup] Install And Prepare VIC Appliance With Volume Stores
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists vch/${id}
Populate VCH with Named Volume on Default Volume Store Attached to Powered Off Container
Verify Container Exists ${OFF_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${OFF_NV_DVS_VOLUME_NAME}
Populate VCH with Named Volume on Named Volume Store Attached to Powered Off Container
Verify Container Exists ${OFF_NV_NVS_CONTAINER_NAME}
Verify Volume Store Exists ${VOLUME_STORE_PATH}
Verify Volume Exists ${VOLUME_STORE_PATH} ${OFF_NV_NVS_VOLUME_NAME}
Delete Path Under Target vch/${id} '{"containers":"off","volume_stores":"all"}'
Verify Return Code
Verify Status Accepted
Verify VCH Not Exists vch/${id}
Verify Container Not Exists ${OFF_NV_DVS_CONTAINER_NAME}
Verify Volume Store Not Exists %{VCH-NAME}-VOL
Verify Volume Not Exists %{VCH-NAME}-VOL ${OFF_NV_DVS_VOLUME_NAME}
Verify Container Not Exists ${OFF_NV_NVS_CONTAINER_NAME}
Verify Volume Store Not Exists ${VOLUME_STORE_PATH}
Verify Volume Not Exists ${VOLUME_STORE_PATH} ${OFF_NV_NVS_VOLUME_NAME}
# No VCH to delete
[Teardown] NONE
Delete VCH and powered on containers and volumes
[Setup] Install And Prepare VIC Appliance With Volume Stores
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists vch/${id}
Populate VCH with Named Volume on Default Volume Store Attached to Powered On Container
Verify Container Exists ${ON_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${ON_NV_DVS_VOLUME_NAME}
Populate VCH with Named Volume on Named Volume Store Attached to Powered On Container
Verify Container Exists ${ON_NV_NVS_CONTAINER_NAME}
Verify Volume Store Exists ${VOLUME_STORE_PATH}
Verify Volume Exists ${VOLUME_STORE_PATH} ${ON_NV_NVS_VOLUME_NAME}
Delete Path Under Target vch/${id} '{"containers":"all","volume_stores":"all"}'
Verify Return Code
Verify Status Accepted
Verify VCH Not Exists vch/${id}
Verify Container Not Exists ${ON_NV_DVS_CONTAINER_NAME}
Verify Volume Store Not Exists %{VCH-NAME}-VOL
Verify Volume Not Exists %{VCH-NAME}-VOL ${ON_NV_DVS_VOLUME_NAME}
Verify Container Not Exists ${ON_NV_NVS_CONTAINER_NAME}
Verify Volume Store Not Exists ${VOLUME_STORE_PATH}
Verify Volume Not Exists ${VOLUME_STORE_PATH} ${ON_NV_NVS_VOLUME_NAME}
# No VCH to delete
[Teardown] NONE
Delete VCH and powered off container and preserve volumes
[Setup] Install And Prepare VIC Appliance With Volume Stores
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists vch/${id}
Populate VCH with Named Volume on Default Volume Store Attached to Powered Off Container
Verify Container Exists ${OFF_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${OFF_NV_DVS_VOLUME_NAME}
Populate VCH with Named Volume on Named Volume Store Attached to Powered Off Container
Verify Container Exists ${OFF_NV_NVS_CONTAINER_NAME}
Verify Volume Store Exists ${VOLUME_STORE_PATH}
Verify Volume Exists ${VOLUME_STORE_PATH} ${OFF_NV_NVS_VOLUME_NAME}
Delete Path Under Target vch/${id} '{"containers":"off","volume_stores":"none"}'
Verify Return Code
Verify Status Accepted
Verify VCH Not Exists vch/${id}
Verify Container Not Exists ${OFF_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${OFF_NV_DVS_VOLUME_NAME}
Verify Container Not Exists ${OFF_NV_NVS_CONTAINER_NAME}
Verify Volume Store Exists ${VOLUME_STORE_PATH}
Verify Volume Exists ${VOLUME_STORE_PATH} ${OFF_NV_NVS_VOLUME_NAME}
# Re-use preserved volumes
Re-Install And Prepare VIC Appliance With Volume Stores
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists vch/${id}
# volume should already exist even before use - default volume store
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists Docker %{VCH-NAME}-VOL ${OFF_NV_DVS_VOLUME_NAME}
# confirm volume can be referenced
Run Docker Command create --name ${OFF_NV_DVS_CONTAINER_NAME} -v ${OFF_NV_DVS_VOLUME_NAME}:/volume ${busybox} /bin/top
Verify Return Code
Output Should Not Contain Error
Verify Container Exists ${OFF_NV_DVS_CONTAINER_NAME}
# volume should already exist even before use - named volume store
Verify Volume Store Exists ${VOLUME_STORE_PATH}
Verify Volume Exists Docker ${VOLUME_STORE_PATH} ${OFF_NV_NVS_VOLUME_NAME}
# confirm volume can be referenced
Run Docker Command create --name ${OFF_NV_NVS_CONTAINER_NAME} -v ${OFF_NV_NVS_VOLUME_NAME}:/volume ${busybox} /bin/top
Verify Return Code
Output Should Not Contain Error
Verify Container Exists ${OFF_NV_NVS_CONTAINER_NAME}
[Teardown] Run Keywords Cleanup VIC Appliance On Test Server Cleanup Datastore On Test Server
Delete VCH and powered on container but preserve volume
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists vch/${id}
Populate VCH with Named Volume on Default Volume Store Attached to Powered On Container
Verify Container Exists ${ON_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${ON_NV_DVS_VOLUME_NAME}
Delete Path Under Target vch/${id} '{"containers":"all","volume_stores":"none"}'
Verify Return Code
Verify Status Accepted
Verify VCH Not Exists vch/${id}
Verify Container Not Exists ${ON_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${ON_NV_DVS_VOLUME_NAME}
# Re-use preserved volume
Re-Install And Prepare VIC Appliance
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists vch/${id}
# volume should already exist even before use
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists Docker %{VCH-NAME}-VOL ${ON_NV_DVS_VOLUME_NAME}
# confirm volume can be referenced AND USED - confirms the disk is healthy
Run Docker Command run --name ${ON_NV_DVS_CONTAINER_NAME} -v ${ON_NV_DVS_VOLUME_NAME}:/volume ${busybox} /bin/touch /volume/hello
Verify Return Code
Output Should Not Contain Error
Verify Container Exists ${ON_NV_DVS_CONTAINER_NAME}
[Teardown] Run Keywords Cleanup VIC Appliance On Test Server Cleanup Datastore On Test Server
Delete VCH and preserve powered on container and volumes
[Setup] Install And Prepare VIC Appliance With Volume Stores
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists vch/${id}
Populate VCH with Named Volume on Default Volume Store Attached to Powered On Container
Verify Container Exists ${ON_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${ON_NV_DVS_VOLUME_NAME}
Delete Path Under Target vch/${id} '{"containers":"off","volume_stores":"none"}'
Verify Return Code
Verify Status Internal Server Error
Verify VCH Exists vch/${id}
Verify Container Exists ${ON_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${ON_NV_DVS_VOLUME_NAME}
[Teardown] Run Keywords Cleanup VIC Appliance On Test Server Cleanup Datastore On Test Server
Delete VCH and preserve powered on container and fail to delete volumes
[Setup] Install And Prepare VIC Appliance With Volume Stores
${id}= Get VCH ID %{VCH-NAME}
Verify VCH Exists vch/${id}
Populate VCH with Named Volume on Default Volume Store Attached to Powered On Container
Verify Container Exists ${ON_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${ON_NV_DVS_VOLUME_NAME}
Delete Path Under Target vch/${id} '{"containers":"off","volume_stores":"all"}'
Verify Return Code
Verify Status Internal Server Error
Verify VCH Exists vch/${id}
Verify Container Exists ${ON_NV_DVS_CONTAINER_NAME}
Verify Volume Store Exists %{VCH-NAME}-VOL
Verify Volume Exists %{VCH-NAME}-VOL ${ON_NV_DVS_VOLUME_NAME}
[Teardown] Run Keywords Cleanup VIC Appliance On Test Server Cleanup Datastore On Test Server

View File

@@ -0,0 +1,26 @@
Group 23 - VIC Machine Service
=======
[Test 23-01 - Metadata](23-01-Metadata.md)
-
[Test 23-02 - VCH List](23-02-VCH-List.md)
-
[Test 23-03 - VCH Create](23-03-VCH-Create.md)
-
[Test 23-04 - VCH Inspect](23-04-VCH-Inspect.md)
-
[Test 23-05 - VCH Logs](23-05-VCH-Logs.md)
-
[Test 23-06 - VCH Certificate](23-06-VCH-Certificate.md)
-
[Test 23-07 - VCH Reconfigure](23-07-VCH-Reconfigure.md)
-
[Test 23-08 - VCH Delete](23-08-VCH-Delete.md)
-
[Test 23-09 - VCH Upgrade](23-09-VCH-Upgrade.md)
-
[Test 23-10 - VCH Debug](23-10-VCH-Debug.md)
-
[Test 23-11 - VCH Firewall](23-11-VCH-Firewall.md)
-