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,48 @@
Test 11-01 - Upgrade
=======
# Purpose:
To verify vic-machine upgrade can upgrade VCH from a certain version
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Download vic_7315.tar.gz from gcp
2. Deploy VIC 7315 to vsphere server
3. Issue docker network create bar, creating a new network called "bar"
4. Create container with port mapping
5. Upgrade VCH to latest version with short timeout 1s
6. Create a named volume
7. Create a container with a mounted anonymous and named volume
8. Upgrade VCH to latest version
9. Check that one of the older VCH's containers has a create timestamp in seconds, and one from the upgraded VCH uses nanoseconds
10. Check that the above two containers have valid human-readable create times in docker ps output
11. Verify that the volumes are still there using inspect
12. Roll back to the previous version
13. Upgrade again to the upgraded version
14. Verify that the volumes are still there using inspect
15. Check the previous created container and image are still there
15. Attempt to rename an old container created with a VCH that doesn't support rename
16. Rename a new container created with a VCH that supports rename
17. Check the previous created container's display name and datastore folder name
18. Check the display name and datastore folder name of a new container created after VCH upgrade
# Expected Outcome:
* Step 5 should fail with timeout
* Step 15 should result in an error containing the following message:
```
does not support rename
```
* Step 16 should succeed and the container's new name should be present in ps, inspect and govc vm.info output.
* Step 17 should show that both the container's display name and datastore folder name are containerName-containerID
* Step 18 should show that (1) on a non-vsan setup, the container's display name is containerName-containerShortID while the datastore folder name is containerID, or (2) on a vsan setup, both the container's display name and datastore folder name are containerName-containerShortID
* All other steps should result in success
# Possible Problems:
* Upgrade test will upgrade VCH from build 7315, because that build has VCH restart and configuration restart features done.
* Before GA, if there is any VCH configuration change, please bump upgrade from version, and be sure to add cases to cover those changes.
* After GA, the upgrade from version will be GA release version.
* This suite may fail when run locally due to a `vic-machine upgrade` issue. Since `vic-machine` checks the build number of its binary to determine upgrade status and a locally-built `vic-machine` binary may not have the `BUILD_NUMBER` set correctly, `vic-machine upgrade` may fail with the message `foo-VCH has same or newer version x than installer version y. No upgrade is available.` To resolve this, follow these steps:
* Set `BUILD_NUMBER` to a high number at the top of the `Makefile` - `BUILD_NUMBER ?= 9999999999`
* Re-build binaries - `sudo make distclean && sudo make clean && sudo make all`

View File

@@ -0,0 +1,227 @@
# Copyright 2016-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 11-01 - Upgrade
Resource ../../resources/Util.robot
Suite Setup Install VIC with version to Test Server 7315
Suite Teardown Clean up VIC Appliance And Local Binary
Default Tags
*** Variables ***
${namedVolume}= named-volume
${mntDataTestContainer}= mount-data-test
${mntTest}= /mnt/test
${mntNamed}= /mnt/named
*** Keywords ***
Run Docker Checks
# wait for docker info to succeed
Log To Console Verify Containers...
Wait Until Keyword Succeeds 20x 5 seconds Run Docker Info %{VCH-PARAMS}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} bar
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network inspect bridge
Should Be Equal As Integers ${rc} 0
${ip}= Get Container IP %{VCH-PARAMS} %{ID1} bridge
Should Be Equal ${ip} %{IP1}
${ip}= Get Container IP %{VCH-PARAMS} %{ID2} bridge
Should Be Equal ${ip} %{IP2}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect vch-restart-test1
Should Be Equal As Integers ${rc} 0
Should Contain ${output} "Id"
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop vch-restart-test1
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Should Be Equal As Integers ${rc} 0
${status}= Get State Of Github Issue 5653
Run Keyword If '${status}' == 'closed' Should Contain ${output} Exited (143)
Run Keyword If '${status}' == 'closed' Fail Exit code check below needs to be updated now that Issue #5653 has been resolved
# Disabling the precise check for error code until https://github.com/vmware/vic/issues/5653 is fixed - we can get rid of the
# conditional around the exit code check once the issue is closed
#Should Contain ${output} Exited (143)
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start vch-restart-test1
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Exited (0)
# Check that rename doesn't work on a container from a VCH that doesn't support rename
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename vch-restart-test1 vch-test2
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} does not support rename
# Check that rename works on a container from a VCH that supports rename
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${contID}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name new-vch-cont1 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${contID} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename new-vch-cont1 new-vch-cont2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Verify Container Rename new-vch-cont1 new-vch-cont2 ${contID}
# check the display name and datastore folder name of an existing container
${rc} ${output}= Run And Return Rc And Output govc vm.info *-%{ID1}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} vch-restart-tes-%{ID1}
${rc} ${output}= Run And Return Rc And Output govc datastore.ls | grep vch-restart-tes-%{ID1}
Should Be Equal As Integers ${rc} 0
Should Be Equal ${output} vch-restart-tes-%{ID1}
# check the display name and datastore folder name of a new container
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${vmName}= Get VM Display Name ${id}
${rc} ${output}= Run And Return Rc And Output govc vm.info ${vmName}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ${vmName}
${rc} ${output}= Run Keyword If '%{DATASTORE_TYPE}' == 'VSAN' Run And Return Rc And Output govc datastore.ls | grep ${vmName}
Run Keyword If '%{DATASTORE_TYPE}' == 'VSAN' Should Be Equal As Integers ${rc} 0
Run Keyword If '%{DATASTORE_TYPE}' == 'VSAN' Should contain ${output} ${vmName}
${rc} ${output}= Run Keyword If '%{DATASTORE_TYPE}' == 'Non_VSAN' Run And Return Rc And Output govc datastore.ls | grep ${id}
Run Keyword If '%{DATASTORE_TYPE}' == 'Non_VSAN' Should Be Equal As Integers ${rc} 0
Run Keyword If '%{DATASTORE_TYPE}' == 'Non_VSAN' Should Contain ${output} ${id}
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{VCH-IP} 10000
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{VCH-IP} 10001
# one of the ports collides
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p 10001:80 -p 10002:80 --name webserver1 ${nginx}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start webserver1
Should Be Equal As Integers ${rc} 1
Should Contain ${output} port 10001 is not available
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -aq | xargs -n1 docker %{VCH-PARAMS} stop
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -aq | xargs -n1 docker %{VCH-PARAMS} rm
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Create Docker Containers
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} network create bar
Should Be Equal As Integers ${rc} 0
Comment Launch container on bridge network
${id1} ${ip1}= Launch Container vch-restart-test1 bridge docker1.11
${id2} ${ip2}= Launch Container vch-restart-test2 bridge docker1.11
Set Environment Variable ID1 ${id1}
Set Environment Variable ID2 ${id2}
Set Environment Variable IP1 ${ip1}
Set Environment Variable IP2 ${ip2}
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} create -it -p 10000:80 -p 10001:80 --name webserver nginx
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} start webserver
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{VCH-IP} 10000
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{VCH-IP} 10001
Create Container with Named Volume
Log To Console \nCreate a named volume and mount it to a container\n
${rc} ${container}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} volume create --name=${namedVolume}
Should Be Equal As Integers ${rc} 0
Should Contain ${container} ${namedVolume}
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} create --name=${mntDataTestContainer} -v ${mntTest} -v ${namedVolume}:${mntNamed} busybox
Should Be Equal As Integers ${rc} 0
Set Suite Variable ${TestContainerVolume} ${output}
Check Container Create Timestamps
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${newc}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox}
Should Be Equal As Integers ${rc} 0
# Container created with the older VCH should have timestamp in seconds
${rc} ${oldoutput}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${TestContainerVolume} | jq -r '.[0].Created'
Should Be Equal As Integers ${rc} 0
${rest} ${oldtstamp}= Split String From Right ${oldoutput} : 1
${oldlen}= Get Length ${oldtstamp}
Should Be Equal As Integers ${oldlen} 3
# Container created with the upgraded VCH should have timestamp in nanoseconds
${rc} ${newoutput}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${newc} | jq -r '.[0].Created'
Should Be Equal As Integers ${rc} 0
${rest} ${newtstamp}= Split String From Right ${newoutput} : 1
${newlen}= Get Length ${newtstamp}
Should Be True ${newlen} >= 3
# Containers should show a valid human-readable duration in ps output. This tests the
# data migration plugin - the timestamp should be converted correctly to seconds
# before sending the ps response to the docker client.
# Pause for 2 seconds to allow for the time check below
Sleep 2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Should Be Equal As Integers ${rc} 0
${oldcshortID}= Get container shortID ${TestContainerVolume}
${lines}= Get Lines Containing String ${output} ${oldcshortID}
Should Not Contain ${lines} years ago
${newcshortID}= Get container shortID ${newc}
${lines}= Get Lines Containing String ${output} ${newcshortID}
Should Not Contain ${lines} Less than a second ago
*** Test Cases ***
Upgrade Present in vic-machine
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux
Should Contain ${output} upgrade
Upgrade VCH with unreasonably short timeout and automatic rollback after failure
Log To Console \nUpgrading VCH with 1s timeout ...
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux upgrade --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --force=true --compute-resource=%{TEST_RESOURCE} --timeout 1s
Should Contain ${output} Upgrading VCH exceeded time limit
Should Not Contain ${output} Completed successfully
${rc} ${output}= Run And Return Rc And Output govc snapshot.tree -vm=%{VCH-NAME}
Should Not Contain ${output} upgrade
# confirm that the rollback took effect
Check Original Version
Upgrade VCH
Create Docker Containers
Create Container with Named Volume
# Create check list for Volume Inspect
@{checkList}= Create List ${mntTest} ${mntNamed} ${namedVolume}
Upgrade
Check Upgraded Version
Check Container Create Timestamps
Verify Volume Inspect Info After Upgrade and Before Rollback ${TestContainerVolume} ${checkList}
Rollback
Check Original Version
Upgrade with ID
Check Upgraded Version
Verify Volume Inspect Info After Upgrade with ID ${TestContainerVolume} ${checkList}
Run Docker Checks
Log To Console Regression Tests...
Run Regression Tests

View File

@@ -0,0 +1,26 @@
Test 11-02 - Upgrade Exec
=======
# Purpose:
To verify that exec does not work in VIC version 0.9.0 and lower
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Download vic_8351.tar.gz from gcp
2. Deploy VIC 8351 to vsphere server
3. Create a busybox container running the background
4. Upgrade VCH to latest version
5. Run docker exec on container created in step (3.)
6. Create new container
7. Run docker exec on new container in (6.)
# Expected Outcome:
* Step 5 should fail
* All other steps should result in success
# Possible Problems:
* This suite may fail when run locally due to a `vic-machine upgrade` issue. Since `vic-machine` checks the build number of its binary to determine upgrade status and a locally-built `vic-machine` binary may not have the `BUILD_NUMBER` set correctly, `vic-machine upgrade` may fail with the message `foo-VCH has same or newer version x than installer version y. No upgrade is available.` To resolve this, follow these steps:
* Set `BUILD_NUMBER` to a high number at the top of the `Makefile` - `BUILD_NUMBER ?= 9999999999`
* Re-build binaries - `sudo make distclean && sudo make clean && sudo make all`

View File

@@ -0,0 +1,35 @@
# Copyright 2016-2018 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 11-02 - Upgrade Exec
Resource ../../resources/Util.robot
Suite Setup Install VIC with version to Test Server 8351
Suite Teardown Clean up VIC Appliance And Local Binary
Default Tags
*** Test Cases ***
Exec Not Allowed On Older Containers
Launch Container exec-test bridge
Upgrade
Check Upgraded Version
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec -d exec-test ls
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} running tasks not supported for this container
Launch Container exec-test2 bridge
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec -d exec-test2 ls
Should Be Equal As Integers ${rc} 0

View File

@@ -0,0 +1,38 @@
Test 11-03 - Upgrade InsecureRegistry
=======
# Purpose:
To verify InsecureRegistries are correctly migrated
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy an insecure registry on http
2. Create a test project on insecure registry
3. Start a docker daemon with insecure registry configured
4. Push test image to insecure registry through above docker daemon(VCH docker push not implemented)
5. Download vic_7315.tar.gz from gcp if it does not exist locally
6. Deploy VIC 7315 to vsphere server with above insecure registry
7. Make sure pull given test image through VCH successfully
8. Upgrade VCH to latest version
9. Make sure pull given test image through VCH successfully
10. Deploy an insecure registry on https with self-signed certificate
11. Create a test project on insecure registry
12. Start a docker daemon with insecure registry configured
13. Push test image to insecure registry through above docker daemon(VCH docker push not implemented)
14. Download vic_7315.tar.gz from gcp if it does not exist locally
15. Deploy VIC 7315 to vsphere server with above insecure registry
16. Make sure pull given test image through VCH successfully
17. Upgrade VCH to latest version
18. Make sure pull given test image through VCH successfully
# Expected Outcome:
* Able to pull given test image through VCH successfully both before and after upgrade
# Possible Problems:
* This suite may fail when run locally due to a `vic-machine upgrade` issue. Since `vic-machine` checks the build number of its binary to determine upgrade status and a locally-built `vic-machine` binary may not have the `BUILD_NUMBER` set correctly, `vic-machine upgrade` may fail with the message `foo-VCH has same or newer version x than installer version y. No upgrade is available.` To resolve this, follow these steps:
* Set `BUILD_NUMBER` to a high number at the top of the `Makefile` - `BUILD_NUMBER ?= 9999999999`
* Re-build binaries - `sudo make distclean && sudo make clean && sudo make all`

View File

@@ -0,0 +1,137 @@
# 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 11-03 - Upgrade-InsecureRegistry
Resource ../../resources/Util.robot
#Test Teardown Cleanup Test Environment
*** Variables ***
${test_vic_version} 7315
${vic_success} Installer completed successfully
${docker_bridge_network} bridge
${docker_daemon_default_port} 2375
${http_harbor_name} integration-test-harbor-http
${https_harbor_name} integration-test-harbor-https
${default_local_docker_endpoint} unix:///var/run/docker-local.sock
*** Keywords ***
Setup Test Environment
[arguments] ${insecure_registry}
${handle} ${docker_daemon_pid}= Start Docker Daemon Locally --insecure-registry ${insecure_registry}
Setup VCH And Registry ${insecure_registry}
[Return] ${handle} ${docker_daemon_pid}
Run Secret Curl Command
[Tags] secret
[Arguments] ${registry_ip} ${protocol} ${curl_option} ${user}=admin ${password}=%{TEST_PASSWORD}
${rc} ${output}= Run And Return Rc And Output curl ${curl_option} -u ${user}:${password} -H "Content-Type: application/json" -X POST -d '{"project_name": "test","public": 1}' ${protocol}://${registry_ip}/api/projects
[Return] ${rc} ${output}
Add Project On Registry
[Arguments] ${registry_ip} ${protocol}
# Harbor API: https://github.com/vmware/harbor/blob/master/docs/swagger.yaml
Run Keyword If '${protocol}' == 'https' Set Test Variable ${curl_option} --insecure
Run Keyword If '${protocol}' == 'http' Set Test Variable ${curl_option} ${EMPTY}
:FOR ${i} IN RANGE 12
\ ${rc} ${output}= Run Secret Curl Command ${registry_ip} ${protocol} ${curl_option}
\ Log ${output}
\ Return From Keyword If '${rc}' == '0'
\ Sleep 10s
Fail Failed to add project on registry!
Run Secret Docker Login
[Tags] secret
[Arguments] ${registry_ip} ${registry_user}=admin ${registry_password}=%{TEST_PASSWORD} ${docker}=DOCKER_API_VERSION=1.23 docker
${rc} ${output}= Run And Return Rc And Output ${docker} -H ${default_local_docker_endpoint} login --username ${registry_user} --password ${registry_password} ${registry_ip}
[Return] ${rc} ${output}
Setup VCH And Registry
[Arguments] ${registry_ip} ${docker}=DOCKER_API_VERSION=1.23 docker
${rc} ${output}= Run And Return Rc And Output echo "From busybox" | ${docker} -H ${default_local_docker_endpoint} build -t ${registry_ip}/test/busybox -
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Successfully built
Log To Console \nbusybox built successfully
${rc} ${output}= Run Secret Docker Login ${registry_ip}
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Login Succeeded
Log To Console \nLogin successfully
${rc}= Run And Return Rc ${docker} -H ${default_local_docker_endpoint} push ${registry_ip}/test/busybox
Should Be Equal As Integers ${rc} 0
Log To Console \nbusybox pushed successfully
Test VCH And Registry
[Arguments] ${vch_endpoint} ${registry_ip} ${docker}=DOCKER_API_VERSION=1.23 docker
${rc} ${output}= Run And Return Rc And Output ${docker} -H ${vch_endpoint} pull ${registry_ip}/test/busybox
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Digest:
Should Contain ${output} Status:
Should Not Contain ${output} Error response from daemon
Cleanup Test Environment
[Arguments] ${docker}=DOCKER_API_VERSION=1.23 docker
Clean up VIC Appliance And Local Binary
${out}= Cleanup Harbor ${harbor_name}
Log ${out}
${rc}= Run And Return Rc ${docker} -H ${default_local_docker_endpoint} rmi ${harbor_ip}/test/busybox
Should Be Equal As Integers ${rc} 0
Kill Local Docker Daemon ${handle} ${docker_daemon_pid}
*** Test Cases ***
Upgrade VCH with Harbor On HTTP
Pass Execution Need to use a different insecure registry, because Harbor does not support VIC as insecure and 0.5.0 is too old
Set Test Environment Variables
${out}= Cleanup Harbor ${http_harbor_name}
Log ${out}
${out}= Cleanup Harbor ${https_harbor_name}
Log ${out}
Set Test Variable ${harbor_name} ${http_harbor_name}
${ip}= Install Harbor To Test Server ${harbor_name}
Set Test Variable ${harbor_ip} ${ip}
Add Project On Registry ${harbor_ip} http
${hdl} ${pid}= Setup Test Environment ${harbor_ip}
Set Test Variable ${handle} ${hdl}
Set Test Variable ${docker_daemon_pid} ${pid}
Install VIC with version to Test Server ${test_vic_version} --insecure-registry ${harbor_ip} --no-tls
Test VCH And Registry %{VCH-IP}:%{VCH-PORT} ${harbor_ip}
Upgrade
Check Upgraded Version
Test VCH And Registry %{VCH-IP}:%{VCH-PORT} ${harbor_ip}
Upgrade VCH with Harbor On HTTPS
Pass Execution Need to use a different insecure registry, because Harbor does not support VIC as insecure and 0.5.0 is too old
${out}= Cleanup Harbor ${http_harbor_name}
Log ${out}
${out}= Cleanup Harbor ${https_harbor_name}
Log ${out}
Set Test Variable ${harbor_name} ${https_harbor_name}
${ip}= Install Harbor To Test Server ${harbor_name} https
Set Test Variable ${harbor_ip} ${ip}
Add Project On Registry ${harbor_ip} https
${hdl} ${pid}= Setup Test Environment ${harbor_ip}
Set Test Variable ${handle} ${hdl}
Set Test Variable ${docker_daemon_pid} ${pid}
${harbor_cert}= Fetch Harbor Self Signed Cert ${harbor_ip}
Install VIC with version to Test Server ${test_vic_version} --insecure-registry ${harbor_ip} --no-tls --registry-ca ${harbor_cert}
Test VCH And Registry %{VCH-IP}:%{VCH-PORT} ${harbor_ip}
Upgrade
Check Upgraded Version
Test VCH And Registry %{VCH-IP}:%{VCH-PORT} ${harbor_ip}

View File

@@ -0,0 +1,30 @@
Test 11-04 - Upgrade UpdateInProgress
=======
# Purpose:
To verify that vic-machine inspect could detect the upgrade status of a VCH
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Download vic_7315.tar.gz from gcp
2. Deploy VIC 7315 to vsphere server
3. Set UpdateInProgress to true using govc
4. Upgrade VCH
5. Run vic-machine upgrade --resetInProgressFlag to reset UpdateInProgress to false
6. Upgrade VCH
7. Run vic-machine inspect to check the upgrade status of the VCH (this should run in parallel with step 6)
8. After step 3 finishes, run step 4 again.
# Expected Outcome:
* In step 4, output should contain "Upgrade failed: another upgrade/configure operation is in progress"
* In step 5, output should contain "Reset UpdateInProgress flag successfully"
* In step 6, output should contain "Completed successfully"
* In step 7, output should contain "Upgrade/configure in progress"
* In step 8, output should not contain "Upgrade/configure in progress"
# Possible Problems:
* This suite may fail when run locally due to a `vic-machine upgrade` issue. Since `vic-machine` checks the build number of its binary to determine upgrade status and a locally-built `vic-machine` binary may not have the `BUILD_NUMBER` set correctly, `vic-machine upgrade` may fail with the message `foo-VCH has same or newer version x than installer version y. No upgrade is available.` To resolve this, follow these steps:
* Set `BUILD_NUMBER` to a high number at the top of the `Makefile` - `BUILD_NUMBER ?= 9999999999`
* Re-build binaries - `sudo make distclean && sudo make clean && sudo make all`

View File

@@ -0,0 +1,36 @@
# 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 11-04 - Upgrade-UpdateInProgress
Suite Setup Install VIC with version to Test Server 7315
Suite Teardown Clean up VIC Appliance And Local Binary
Resource ../../resources/Util.robot
*** Test Cases ***
Upgrade VCH with UpdateInProgress
Run govc vm.change -vm=%{VCH-NAME} -e=UpdateInProgress=true
Check UpdateInProgress true
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux upgrade --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --force=true --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT}
Should Contain ${output} Upgrade failed: another upgrade/configure operation is in progress
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux upgrade --reset-progress --name=%{VCH-NAME} --target=%{TEST_URL} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --force=true --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT}
Should Contain ${output} Reset UpdateInProgress flag successfully
Check UpdateInProgress false
Upgrade and inspect VCH
Start Process bin/vic-machine-linux upgrade --debug 1 --name %{VCH-NAME} --target %{TEST_URL} --user %{TEST_USERNAME} --password %{TEST_PASSWORD} --force --compute-resource %{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} shell=True alias=UpgradeVCH
Wait Until Keyword Succeeds 20x 5s Inspect VCH Upgrade/configure in progress
Wait For Process UpgradeVCH
Inspect VCH Completed successfully
Check UpdateInProgress false

View File

@@ -0,0 +1,21 @@
Test 11-05 - Configure
=======
# Purpose:
To verify vic-machine configure can upgrade with --upgrade specified
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Download vic_7315.tar.gz from gcp
2. Deploy VIC 7315 to vsphere server
3. Using latest version vic-machine to configure this VCH
# Expected Outcome:
* Step 3 should get expected error
# Possible Problems:
* This suite may fail when run locally due to a `vic-machine upgrade` issue. Since `vic-machine` checks the build number of its binary to determine upgrade status and a locally-built `vic-machine` binary may not have the `BUILD_NUMBER` set correctly, `vic-machine upgrade` may fail with the message `foo-VCH has same or newer version x than installer version y. No upgrade is available.` To resolve this, follow these steps:
* Set `BUILD_NUMBER` to a high number at the top of the `Makefile` - `BUILD_NUMBER ?= 9999999999`
* Re-build binaries - `sudo make distclean && sudo make clean && sudo make all`

View File

@@ -0,0 +1,25 @@
# 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 11-05 - Configure
Resource ../../resources/Util.robot
Suite Setup Install VIC with version to Test Server 7315
Suite Teardown Clean up VIC Appliance And Local Binary
*** Test Cases ***
Configure VCH with new vic-machine
${ret}= Run bin/vic-machine-linux configure --target %{TEST_URL} --user %{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE} --name %{VCH-NAME} --http-proxy http://proxy.vmware.com:3128
Should Not Contain ${ret} Completed successfully
Should Contain ${ret} configure failed

View File

@@ -0,0 +1,9 @@
Group 11 - Upgrade
=======
[Test 11-01 - Upgrade](11-01-Upgrade.md)
-
[Test 11-02 - Upgrade Exec](11-02-Upgrade-Exec.md)
-
[Test 11-03 - Upgrade InsecureRegistry](11-03-Upgrade-InsecureRegistry.md)