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,19 @@
Test 3858 - Verify Kernel modules are not compressed
=======
# Purpose:
Verify Kernel modules are not compressed
# References:
* https://github.com/vmware/vic/issues/3858
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Create VCH through vic-machine create
2. Create container
3. Check /lib/modules to make sure there is no ko.xz file
# Expected Outcome:
* Step 3 should success

View File

@@ -0,0 +1,25 @@
# 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 3858
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server certs=${false}
Suite Teardown Cleanup VIC Appliance On Test Server
*** Test Cases ***
Check kernel modules
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -t ${ubuntu} find /lib/modules -name "*.ko" -printf "FOUND\n" -quit
Should Be Equal As Integers ${rc} 0
Should Contain ${output} FOUND

View File

@@ -0,0 +1,20 @@
Test 4367 - Running a container twice does not produce output the second time #4367
=======
# Purpose:
Verify running a container twice does produce output the second time
# References:
* https://github.com/vmware/vic/issues/4367
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Create VCH through vic-machine create
2. Create container and make sure that we get the output
3. Run container again and make sure that we get the output
# Expected Outcome:
* Step 3 should succeed and produce the same output as Step 2

View File

@@ -0,0 +1,29 @@
# 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 4367
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server certs=${false}
Suite Teardown Cleanup VIC Appliance On Test Server
*** Test Cases ***
Check running twice
${name}= Generate Random String 15
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -t --name ${name} ${busybox} ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} proc
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start -a ${name}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} proc

View File

@@ -0,0 +1,19 @@
Test 4817 - Verify Kernel supports vsyscall
=======
# Purpose:
Verify Kernel supports vsyscall mechanisms
# References:
* https://github.com/vmware/vic/issues/4817
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Create VCH through vic-machine create
2. Create centos:6 container
3. Run bash -c true
# Expected Outcome:
* Step 3 should succeed (exit code of 0)

View File

@@ -0,0 +1,24 @@
# 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 4817
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server certs=${false}
Suite Teardown Cleanup VIC Appliance On Test Server
*** Test Cases ***
Check kernel vsyscall
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -t centos:6 bash -c true
Should Be Equal As Integers ${rc} 0

View File

@@ -0,0 +1,25 @@
Test 5343 - Confirm event collection after SDK connection re-establishment
=======
# Purpose:
Confirm that vSphere event collection occurs correctly after re-establishment of a dropped SDK connection
# References:
* https://github.com/vmware/vic/issues/5343
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Create VCH through vic-machine create
2. Create container
3. Power on container
4. Confirm creation and power on events in logs
5. Delete vSphere SDK session via govc session.rm
6. Trigger SDK connection re-establishment (via VCH operation)
7. Power off container VM via govc
8. Confirm power off event in logs
9. Confirm container is reported as stopped
# Expected Outcome:
All steps should succeed

View File

@@ -0,0 +1,62 @@
# 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 5343
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
*** Test Cases ***
Check vsphere event stream
# basic confirmation of function
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${name}= Generate Random String 15
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name ${name} ${busybox} sleep 600
Should Be Equal As Integers ${rc} 0
${shortid}= Get container shortID ${id}
${rc}= Run And Return Rc docker %{VCH-PARAMS} start ${name}
Should Be Equal As Integers ${rc} 0
# ensure that portlayer log contains the powered on event - this string comes in the e.Message portion of the vSphere event
# and may be prone to Localization which would cause this test to fail.
# for efficiency We assume that if we saw powered on then "${id} Created" would also have matched
Portlayer Log Should Match Regexp ${name}-${shortid} on \\s\\S* in \\S* is powered on
# delete the session to suppress reception of events
${rc} ${out}= Run And Return Rc And Output govc session.ls
Log ${out}
${matches}= Get Lines Matching Regexp ${out} %{VCH-IP}\\s* vic-engine partial_match=True
@{sessions}= Split to lines ${matches}
:FOR ${session} IN @{sessions}
\ ${key}= Fetch From Left ${session} ${SPACE}
\ ${rc}= Run And Return Rc govc session.rm ${key}
\ Should Be Equal As Integers ${rc} 0
# power off the VM directly
${rc} ${output}= Run And Return Rc And Output govc vm.power --off ${name}-${shortid}
Log ${output}
Should Be Equal As Integers ${rc} 0
# Confirm container reported as stopped by VCH
Wait Until Container Stops ${id}
# Assert that the power off event is present
# Would prefer to do this as a tail on the live log but no idea how to do stream processing in robot
Wait Until Keyword Succeeds 1m 10s Portlayer Log Should Match Regexp ${name}-${shortid} on \\s*\\S* in \\S* is powered off

View File

@@ -0,0 +1,21 @@
Test 6515 - Check that existing /etc/hosts entries are blended with dynamic ones
=======
# Purpose:
Check that we do not overwrite or discard explicit static entries in /etc/hosts when generating the dynamic entries
# References:
* https://github.com/vmware/vic/issues/6515
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Create VCH through vic-machine create
2. Create container
3. Copy a populated /etc/hosts file to the container
4. Power on the container
5. Confirm the presence of entries from the copied file
# Expected Outcome:
All steps should succeed

View File

@@ -0,0 +1,16 @@
# 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
127.0.0.1 robot-test-alias
::1 robot-test-alias

View File

@@ -0,0 +1,51 @@
# 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 6515
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
*** Test Cases ***
Check hosts contains base entries
# basic confirmation of function
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${name}= Generate Random String 15
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name ${name} ${busybox} sleep 600
Should Be Equal As Integers ${rc} 0
${shortid}= Get container shortID ${id}
# update the base hosts file with an alias
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp ${CURDIR}/6515.resource ${id}:/etc/hosts
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker %{VCH-PARAMS} start ${name}
Should Be Equal As Integers ${rc} 0
${rc} ${hosts}= Run And Return Rc And Output docker %{VCH-PARAMS} exec ${id} cat /etc/hosts
Should Be Equal As Integers ${rc} 0
Log ${hosts}
Should Contain ${hosts} robot-test-alias
${rc}= Run And Return Rc docker %{VCH-PARAMS} restart ${id}
Should Be Equal As Integers ${rc} 0
${rc} ${hosts}= Run And Return Rc And Output docker %{VCH-PARAMS} exec ${id} cat /etc/hosts
Should Be Equal As Integers ${rc} 0
Log ${hosts}
Should Contain ${hosts} robot-test-alias

View File

@@ -0,0 +1,27 @@
Test 7137 - Ensure state updates generate internal events
=======
# Purpose:
Internal state updates for containers can occur both via events generated by vSphere or
via explicit updates when performing actions such as an inspect.
This ensures that the state updates also generate appropriate internal events to trigger
actions such as network unbind.
# References:
* https://github.com/vmware/vic/issues/7137
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Create VCH through vic-machine create
2. Create container that will stop after a brief delay
3. Tight loop on container inspect to force state updates
4. Confirm that a container started event was generated when the container fully initialized
5. Confirm that a container die event was generated when the container stopped
6. Confirm that the bridge endpoint was removed via the `network inspect bridge` output
# Expected Outcome:
All steps should succeed. This test will not fail reliably if there is an issue but
should show failures within a few runs.

View File

@@ -0,0 +1,55 @@
# Copyright 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 7137
Resource ../../resources/Util.robot
Suite Setup Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
*** Test Cases ***
Check for die events when forcing update via state refresh
# basic confirmation of function
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${since}= Run And Return Rc And Output docker %{VCH-PARAMS} info --format '{{json .SystemTime}}'
Should Be Equal As Integers ${rc} 0
${name}= Generate Random String 15
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name ${name} -d ${busybox} sleep 3
Should Be Equal As Integers ${rc} 0
# tight loop on inspect - this will force an inline state refresh
Run end=$(($(date +%s) + 24));while [ $(date +%s) -lt $end ]; do docker %{VCH-PARAMS} inspect ${id} >/dev/null; done
${rc} ${until}= Run And Return Rc And Output docker %{VCH-PARAMS} info --format '{{json .SystemTime}}'
Should Be Equal As Integers ${rc} 0
# check for die event - need to supply --until=current-server-timestamp so command returns immediately
${rc} ${events}= Run And Return Rc And Output docker %{VCH-PARAMS} events --since=${since} --filter container=${name} --format='Status={{.Status}}' --until=${until}
Should Be Equal As Integers ${rc} 0
Log ${events}
Should Contain ${events} start
Should Contain ${events} die
Should Not Contain ${events} stop
# network endpoints should have been unbound regardless of which state update was hit (inline triggered by inspect or event based from vsphere)
${rc} ${bridge}= Run And Return Rc And Output docker %{VCH-PARAMS} network inspect bridge
Should Be Equal As Integers ${rc} 0
Should Not Contain ${bridge} ${id}

View File

@@ -0,0 +1,12 @@
Group 0 - Bugs
=======
[Test 3858 - Verify Kernel modules are not compressed](3858.md)
[Test 4367 - Running a container twice does not produce output the second time](4367.md)
-
[Test 4817 - Verify Kernel supports vsyscall](4817.md)
-
[Test 5343 - Confirm event collection after SDK connection re-establishment](5343.md)
[Test 6515 - Check that existing /etc/hosts entries are blended with dynamic ones](6515.md)
-
[Test 7137 - Ensure state updates generate internal events](7137.md)

View File

@@ -0,0 +1,29 @@
Test 1-01 - Docker Info
=======
# Purpose:
To verify that docker info command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/info/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to the vSphere server
2. Issue a docker info command to the new VIC appliance
3. Issue a docker -D info command to the new VIC appliance
4. Issue docker info command, docker create busybox, docker info, docker start <containerID>, docker info
5. Issue docker info command, grab the resource pool CPU/mem limits, change values with govc, docker info, check that values are updated, revert to the old values
6. Issue docker info command, grab the resource pool CPU/mem usage, add a running container to the resource pool, docker info, check the resource pool CPU/mem usage values are updated
# Expected Outcome:
* In Step 2, the VIC appliance should respond with a properly formatted info response without errors. Supported volume drivers should be present in the Plugins section.
* Step 3 should result in additional debug information being returned as well.
* Verify in step 4 that the correct number of containers is reported.
* Verify in step 5 that docker info reports the latest resource pool CPU and memory limits.
* Verify in step 6 that docker info reports the latest resource pool CPU and memory usages
# Possible Problems:
None

View File

@@ -0,0 +1,150 @@
# 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 1-01 - Docker Info
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Get resource pool CPU and mem limits
[Arguments] ${info}
${cpuline}= Get Lines Containing String ${info} CPUs:
${memline}= Get Lines Containing String ${info} Total Memory:
@{cpuline}= Split String ${cpuline}
Length Should Be ${cpuline} 2
@{memline}= Split String ${memline}
Length Should Be ${memline} 4
${cpuval}= Set Variable @{cpuline}[1]
${memunit}= Set Variable @{memline}[3]
${memval}= Set Variable @{memline}[2]
# Since govc accepts a mem value only in MB, convert the value if necessary
${memval}= Run Keyword If '${memunit}' == 'GiB' Evaluate int(round(${memval} * 1024)) ELSE Evaluate ${memval}
[Return] ${cpuval} ${memval}
Get resource pool CPU and mem usages
[Arguments] ${info}
${cpuline}= Get Lines Containing String ${info} CPU usage:
${memline}= Get Lines Containing String ${info} memory usage:
@{cpuline}= Split String ${cpuline}
Length Should Be ${cpuline} 5
@{memline}= Split String ${memline}
Length Should Be ${memline} 5
${cpuval}= Set Variable @{cpuline}[3]
${memunit}= Set Variable @{memline}[4]
${memval}= Set Variable @{memline}[3]
# convert the value to MiB for comparison
${memval}= Run Keyword If '${memunit}' == 'GiB' Evaluate int(round(${memval} * 1024)) ELSE Evaluate int(round(${memval}))
[Return] ${cpuval} ${memval}
Set resource pool CPU and mem limits
[Arguments] ${cpuval} ${memval}
${rc} ${output}= Run And Return Rc And Output govc pool.change -cpu.limit=${cpuval} %{VCH-NAME}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output govc pool.change -mem.limit=${memval} %{VCH-NAME}
Should Be Equal As Integers ${rc} 0
*** Test Cases ***
Basic Info
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} info
Should Be Equal As Integers ${rc} 0
Log ${output}
Should Contain ${output} vSphere
${volpluginline}= Get Lines Containing String ${output} Volume:
Should Contain ${volpluginline} vsphere
Debug Info
${output}= Run docker %{VCH-PARAMS} -D info
Log ${output}
Should Contain ${output} Debug Mode (client): true
Correct container count
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} info
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Should Contain ${output} Containers: 0
${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} ${cid}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Should Not Contain ${cid} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} info
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Should Contain ${output} Containers: 1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${cid}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} info
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Should Contain ${output} Containers: 1
Should Contain ${output} Running: 1
Check modified resource pool CPU and memory limits
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} info
Should Be Equal As Integers ${rc} 0
${oldcpuval} ${oldmemval}= Get resource pool CPU and mem limits ${output}
${newcpuval}= Evaluate ${oldcpuval} - 1
${newmemval}= Evaluate 1000
Set resource pool CPU and mem limits ${newcpuval} ${newmemval}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} info
Should Be Equal As Integers ${rc} 0
${cpuval} ${memval}= Get resource pool CPU and mem limits ${output}
Should Be Equal As Integers ${cpuval} ${newcpuval}
Should Be Equal As Integers ${memval} ${newmemval}
Set resource pool CPU and mem limits ${oldcpuval} ${oldmemval}
Check updated resource pool CPU and memory usages
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} info
Should Be Equal As Integers ${rc} 0
${oldcpuval} ${oldmemval}= Get resource pool CPU and mem usages ${output}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Sleep 60s wait for vsphere stats update
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} info
Should Be Equal As Integers ${rc} 0
${cpuval} ${memval}= Get resource pool CPU and mem usages ${output}
Should Not Be Equal As Integers ${oldcpuval} ${cpuval}
Should Not Be Equal As Integers ${oldmemval} ${memval}

View File

@@ -0,0 +1,45 @@
Test 1-02 - Docker Pull
=======
# Purpose:
To verify that docker pull command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/pull/)
# Environment:
This test requires that an vSphere server is running and available.
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue a docker pull command to the new VIC appliance for each of the top 3 most popular images in hub.docker.com
* nginx, busybox, ubuntu
3. Issue a docker pull command to the new VIC appliance using a tag that isn't the default latest
* ubuntu:14.04
4. Issue a docker pull command to the new VIC appliance using a digest
* nginx@sha256:7281cf7c854b0dfc7c68a6a4de9a785a973a14f1481bc028e2022bcd6a8d9f64
* ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
5. Issue a docker pull command to the new VIC appliance using a different repo than the default
* myregistry.local:5000/testing/test-image
6. Issue a docker pull command to the new VIC appliance using all tags option
* --all-tags nginx
7. Issue a docker pull command to the new VIC appliance using an image that doesn't exist
8. Issue a docker pull command to the new VIC appliance using a non-default repository that doesn't exist
9. Issue a docker pull command for an image with a tag that doesn't exist
10. Issue a docker pull command for an image that has already been pulled
11. Issue a docker pull command multiple times for the same image
12. Issue a docker pull command for each of two images that share layers
13. Issue docker images, rmi ubuntu, pull ubuntu, docker images commands
14. Issue docker pull command for the same image using multiple tags
18. Issue docker pull on digest outputted by previous pull
19. Issue docker pull for these gcr.io images:
* gcr.io/google_containers/hyperkube:v1.6.2
* gcr.io/google_samples/gb-redisslave:v1
* gcr.io/google_samples/cassandra:v11
* gcr.io/google_samples/cassandra:v12
# Expected Outcome:
VIC appliance should respond with a properly formatted pull response to each command issued to it. No errors should be seen, except in the case of step 7, 8 and 9. In step 13, the image ID and size for ubuntu should match before and after removing and re-pulling the image.
# Possible Problems:
None

View File

@@ -0,0 +1,161 @@
# 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 1-02 - Docker Pull
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Pull nginx
Wait Until Keyword Succeeds 5x 15 seconds Pull image ${nginx}
Pull busybox
Wait Until Keyword Succeeds 5x 15 seconds Pull image ${busybox}
Pull ubuntu
Wait Until Keyword Succeeds 5x 15 seconds Pull image ${ubuntu}
Pull non-default tag
Wait Until Keyword Succeeds 5x 15 seconds Pull image nginx:alpine
Pull images based on digest
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull nginx@sha256:7281cf7c854b0dfc7c68a6a4de9a785a973a14f1481bc028e2022bcd6a8d9f64
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} No such image:
Should Contain ${output} Digest: sha256:7281cf7c854b0dfc7c68a6a4de9a785a973a14f1481bc028e2022bcd6a8d9f64
Should Contain ${output} Status: Downloaded newer image for library/nginx:sha256:7281cf7c854b0dfc7c68a6a4de9a785a973a14f1481bc028e2022bcd6a8d9f64
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} No such image:
Should Contain ${output} Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
Should Contain ${output} Status: Downloaded newer image for library/ubuntu:sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
Pull an image with the full docker registry URL
Wait Until Keyword Succeeds 5x 15 seconds Pull image registry.hub.docker.com/library/hello-world
Pull an image with all tags
Wait Until Keyword Succeeds 5x 15 seconds Pull image --all-tags nginx
Pull non-existent image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull fakebadimage
Log ${output}
Should Be Equal As Integers ${rc} 1
Should contain ${output} image library/fakebadimage not found
Pull image from non-existent repo
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull fakebadrepo.com:9999/ubuntu
Log ${output}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} no such host
Pull image with a tag that doesn't exist
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox:faketag
Log ${output}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Tag faketag not found in repository library/busybox
Pull image that already has been pulled
Wait Until Keyword Succeeds 5x 15 seconds Pull image ${alpine}
Wait Until Keyword Succeeds 5x 15 seconds Pull image ${alpine}
Pull the same image concurrently
${pids}= Create List
# Create 5 processes to pull the same image at once
:FOR ${idx} IN RANGE 0 5
\ ${pid}= Start Process docker %{VCH-PARAMS} pull ${redis} shell=True
\ Append To List ${pids} ${pid}
# Wait for them to finish and check their output
:FOR ${pid} IN @{pids}
\ ${res}= Wait For Process ${pid}
\ Log ${res.stdout}
\ Log ${res.stderr}
\ Should Be Equal As Integers ${res.rc} 0
\ Should Contain ${res.stdout} Downloaded newer image for default-project/redis:latest
Pull two images that share layers concurrently
${pid1}= Start Process docker %{VCH-PARAMS} pull golang:1.7 shell=True
${pid2}= Start Process docker %{VCH-PARAMS} pull golang:1.6 shell=True
# Wait for them to finish and check their output
${res1}= Wait For Process ${pid1}
${res2}= Wait For Process ${pid2}
Should Be Equal As Integers ${res1.rc} 0
Should Be Equal As Integers ${res2.rc} 0
Should Contain ${res1.stdout} Downloaded newer image for library/golang:1.7
Should Contain ${res2.stdout} Downloaded newer image for library/golang:1.6
Re-pull a previously rmi'd image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images |grep ${ubuntu}
${words}= Split String ${output}
${id}= Get From List ${words} 2
${size}= Get From List ${words} -2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rmi ${ubuntu}
Wait Until Keyword Succeeds 5x 15 seconds Pull image ${ubuntu}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images |grep ${ubuntu}
${words}= Split String ${output}
${newid}= Get From List ${words} 2
${newsize}= Get From List ${words} -2
Should Be Equal ${id} ${newid}
Should Be Equal ${size} ${newsize}
Pull image by multiple tags
Wait Until Keyword Succeeds 5x 15 seconds Pull image busybox:1.25.1
Wait Until Keyword Succeeds 5x 15 seconds Pull image busybox:1.25
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images |grep -E busybox.*1.25
Should Be Equal As Integers ${rc} 0
${lines}= Split To Lines ${output}
# one for 1.25.1 and one for 1.25
Length Should Be ${lines} 2
${line1}= Get From List ${lines} 0
${line2}= Get From List ${lines} -1
${words1}= Split String ${line1}
${words2}= Split String ${line2}
${id1}= Get From List ${words1} 2
${id2}= Get From List ${words2} 2
Should Be Equal ${id1} ${id2}
Issue docker pull on digest outputted by previous pull
${status}= Get State Of Github Issue 5187
Run Keyword If '${status}' == 'closed' Fail Test 1-02-Docker-Pull.robot needs to be updated now that Issue #5187 has been resolved
# ${rc} Run And Return Rc docker %{VCH-PARAMS} rmi busybox
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox | grep Digest | awk '{print $2}'
# Log ${output}
# Should Be Equal As Integers ${rc} 0
# Should Not Be Empty ${output}
# ${rc} Run And Return Rc docker %{VCH-PARAMS} rmi busybox
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox@${output}
# Log ${output}
# Should Be Equal As Integers ${rc} 0
# Should Contain ${output} Downloaded
Pull images from gcr.io
Wait Until Keyword Succeeds 5x 15 seconds Pull image gcr.io/google_containers/hyperkube:v1.6.2
Wait Until Keyword Succeeds 5x 15 seconds Pull image gcr.io/google_samples/gb-redisslave:v1
Wait Until Keyword Succeeds 5x 15 seconds Pull image gcr.io/google_samples/cassandra:v11
Wait Until Keyword Succeeds 5x 15 seconds Pull image gcr.io/google_samples/cassandra:v12
Verify image manifest digest against vanilla docker
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox:1.26
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} sha256:be3c11fdba7cfe299214e46edc642e09514dbb9bbefcd0d3836c05a1e0cd0642

View File

@@ -0,0 +1,36 @@
Test 1-03 - Docker Images
=======
# Purpose:
To verify that docker images command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/images/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Docker pull alpine
3. Docker pull alpine:3.2
4. Docker pull alpine:3.1
5. Issue docker images command to the new VIC appliance
6. Issue docker images -a command to the new VIC appliance
7. Issue docker images -q command to the new VIC appliance
8. Issue docker images --no-trunc command to the new VIC appliance
9. Issue docker images alpine:3.1
10. Issue docker pull busybox:uclibc, busybox:glibc, busybox:musl
11. Issue regular docker busybox:uclibc, busybox:glibc, busybox:musl
12. Grep VIC docker and regular docker images command output for eacy busybox tag
# Expected Outcome:
* Each of the commands issued should return error free with a properly formatted response
* The docker images and docker images -a command should return the 3 alpine images as expected
* The docker images -q command should return only the short hash of the three images
* The docker --no-trunc command should return the full non-truncated image ID of the three images
* The docker images alpine:3.1 command should return only the specific image specified
* The image IDs in step 12 for all busybox versions in VIC should match those in regular docker
# Possible Problems:
None

View File

@@ -0,0 +1,114 @@
# 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 1-03 - Docker Images
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Simple images
${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} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox:1.27.1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox:1.27.0
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images | cut -d ' ' -f 1 | grep busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${count}= Get Count ${output} busybox
Should Be True ${count} >= 3
All images
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images -a | cut -d ' ' -f 1 | grep busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${count}= Get Count ${output} busybox
Should Be True ${count} >= 3
Quiet images
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images -q
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Should Not Contain ${output} busybox
@{lines}= Split To Lines ${output}
${count}= Get Length ${lines}
Should Be True ${count} >= 3
Length Should Be @{lines}[1] 12
No-trunc images
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images --no-trunc
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${count}= Get Count ${output} busybox
Should Be True ${count} >= 3
@{lines}= Split To Lines ${output}
@{line}= Split String @{lines}[2]
Length Should Be @{line}[2] 64
Filter images before
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images -f before=busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
@{lines}= Split To Lines ${output}
Should Contain ${output} 1.27.0
${count}= Get Length ${lines}
Should Be True ${count} >= 3
Filter images since
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images -f since=busybox:1.27.0
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
@{lines}= Split To Lines ${output}
${count}= Get Length ${lines}
Should Be True ${count} > 0
Should Contain ${output} 1.27.1
Tag images
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} tag busybox busybox:cdg
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Should Contain ${output} cdg
Specific images
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images busybox:1.27.0
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
@{lines}= Split To Lines ${output}
Length Should Be ${lines} 2
Should Contain ${output} 1.27.0
VIC/docker Image ID consistency
@{tags}= Create List uclibc glibc musl
:FOR ${tag} IN @{tags}
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox:${tag}
\ Should Be Equal As Integers ${rc} 0
\ Should Not Contain ${output} Error
\ ${rc} ${output}= Run And Return Rc And Output docker --tls pull busybox:${tag}
\ Should Be Equal As Integers ${rc} 0
\ Should Not Contain ${output} Error
\ ${rc} ${vic_id}= Run And Return Rc And Output docker %{VCH-PARAMS} images | grep -E busybox.*.${tag} |awk '{print $3}'
\ Should Be Equal As Integers ${rc} 0
\ ${rc} ${docker_id}= Run And Return Rc And Output docker --tls images | grep -E busybox.*.${tag} |awk '{print $3}'
\ Should Be Equal ${vic_id} ${docker_id}

View File

@@ -0,0 +1,74 @@
Test 1-04 - Docker Create
=======
# Purpose:
To verify that docker create command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/create/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Docker pull busybox
3. Issue docker create busybox to the new VIC appliance
4. Issue docker create -t -i busybox to the new VIC appliance
5. Issue docker create --name test1 busybox to the new VIC appliance
6. Issue docker create -v /var/log busybox ls /var/log to the new VIC appliance
7. Issue docker start <containerID> to the new VIC appliance
8. Issue docker logs <containerID> to the new VIC appliance
9. Issue docker create -v test-named-vol:/testdir busybox
10. Issue docker start <containerID>
11. Issue docker logs <containerID> to grab the disk size of the volume
12. Issue docker create -v /dir:/dir busybox
13. Create a named volume
14. Create a mongo container with the above named volume (mapped to an image volume path) and an anonymous volume
15. Inspect the above container and obtain the HostConfig.Binds field
16. Inspect the above container and obtain the Config.Volumes field
17. Issue docker create busybox /bin/top to the new VIC appliance
18. Issue docker create fakeimage to the new VIC appliance
19. Issue docker create fakeImage to the new VIC appliance
20. Issue docker create --name busy1 busybox /bin/top to the new VIC appliance
21. Issue docker start busy1 to the new VIC appliance
22. Issue docker create --link busy1:busy1 --name busy2 busybox ping -c2 busy1 to the new VIC appliance
23. Issue docker start busy2 to the new VIC appliance
24. Issue docker logs busy2 to the new VIC appliance
25. Create a container, rm the container, then create another container
26. Create a container directly without pulling the image first for an image that hasn't been pulled yet
27. Create a container without specifying a command
28. Create a container with a custom amount of CPUs
29. Create a container with a custom amount of Memory in GB
30. Create a container with a custom amount of Memory in MB
31. Create a container with a custom amount of Memory in KB
32. Create a container with a custom amount of Memory in Bytes
33. Create a container using a rest api call without HostConfig in the form data
34. Create a container, then check the vm display name in vsphere through govc
35. Create a container, then check the vm Destroy_Task method is disabled in VC through govc
36. Create two containers with the same name in parallel, then check that only one attempt is successful
37. Remove the container from Step 32 by name and create another container with the same name
# Expected Outcome:
* Steps 3-7 should all return without error and printing the container ID on return
* Step 8 should show that the contents of the containers /var/log matches the contents of the hosts /var/log
* Steps 9, 10 and 11 should return without errors and should successfully create a new volume called `test-named-vol` with disk size 975.9M
* Step 12 should return with the error message - Error response from daemon: vSphere Integrated Containers does not support mounting directories as a data volume.
* Steps 13 and 14 should succeed
* Step 15's and 16's output should contain the named volume created in Step 13
* Step 18 should return with the error message - Error: image library/fakeimage not found
* Step 19 should return with the error message - Error parsing reference: "fakeImage" is not a valid repository/tag
* Step 22 should result in success and the busy2 container should exist
* Step 24 should show that busy2 was able to successfully ping busy1 just using the linked name
* Step 25 should result in success for all three parts
* Step 26 should return without error
* Step 27 should return with the following error message - Error response from daemon: No command specified
* Steps 28-32 should return without error.
* Step 33 should return without error.
* Step 34 should show that the VM display name equals to containerName-containerShortID and datastore folder name equal to containerID
* Step 35 should show that the VM Destroy_Task method is disabled in VC
* Step 36 should have one container create process succeed and the other fail with an error
* Step 37 should succeed
# Possible Problems:
None

View File

@@ -0,0 +1,242 @@
# 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 1-04 - Docker Create
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Simple creates
${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} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -t -i ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name test1 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Create with anonymous volume
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v /var/log ${busybox} ls /var/log
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Create with named volume
Run docker %{VCH-PARAMS} volume rm test-named-vol
${disk-size}= Run docker %{VCH-PARAMS} logs $(docker %{VCH-PARAMS} start $(docker %{VCH-PARAMS} create -v test-named-vol:/testdir ${busybox} /bin/df -Ph) && sleep 10) | grep by-label | awk '{print $2}'
Should Contain ${disk-size} 975.9M
Create with a directory as a volume
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v /dir:/dir ${busybox}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: Bad request error from portlayer: mounting directories as a data volume is not supported.
Create with complex volume topology - overriding image volume with named volume
# Verify that only anonymous volumes are removed when superseding an image volume with a named volume
${suffix}= Evaluate '%{DRONE_BUILD_NUMBER}-' + str(random.randint(1000,9999)) modules=random
Set Test Variable ${namedImageVol} non-anonymous-image-volume-${suffix}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume rm ${namedImageVol}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name ${namedImageVol}
Should Be Equal As Integers ${rc} 0
Set Test Variable ${imageVolumeContainer} I-Have-Two-Anonymous-Volumes-${suffix}
${rc} ${c5}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name ${imageVolumeContainer} -v ${namedImageVol}:/data/db -v /I/AM/ANONYMOOOOSE mongo
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f "{{.HostConfig.Binds}}" ${imageVolumeContainer}
Should Contain ${output} ${namedImageVol}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f "{{.Config.Volumes}}" ${imageVolumeContainer}
Should Contain ${output} ${namedImageVol}
Create simple top example
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Create fakeimage image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create fakeimage
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error: image library/fakeimage not found
Create fakeImage repository
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create fakeImage
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error parsing reference: "fakeImage" is not a valid repository/tag
Create and start named container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name busy1 ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start busy1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Create linked containers that can ping
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${debian}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --link busy1:busy1 --name busy2 ${debian} ping -c2 busy1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start busy2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} wait busy2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs busy2
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 2 packets received
Create a container after the last container is removed
${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} ${cid}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${cid} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm ${cid}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${cid2}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${cid2} Error
Create a container from an image that has not been pulled yet
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${alpine} bash
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Create a container with no command specified
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull centos:6.6
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create centos:6.6
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: No command specified
Create a container with custom CPU count
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it --cpuset-cpus 3 ${busybox}
Should Be Equal As Integers ${rc} 0
${id}= Get VM display name ${id}
${rc} ${output}= Run And Return Rc And Output govc vm.info ${id} |awk '/CPU:/ {print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 3
Create a container with custom amount of memory in GB
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -m 4G ${busybox}
Should Be Equal As Integers ${rc} 0
${id}= Get VM display name ${id}
${rc} ${output}= Run And Return Rc And Output govc vm.info ${id} |awk '/Memory:/ {print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 4096MB
Create a container with custom amount of memory in MB
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -m 2048M ${busybox}
Should Be Equal As Integers ${rc} 0
${id}= Get VM display name ${id}
${rc} ${output}= Run And Return Rc And Output govc vm.info ${id} |awk '/Memory:/ {print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2048MB
Create a container with custom amount of memory in KB
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -m 2097152K ${busybox}
Should Be Equal As Integers ${rc} 0
${id}= Get VM display name ${id}
${rc} ${output}= Run And Return Rc And Output govc vm.info ${id} |awk '/Memory:/ {print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2048MB
Create a container with custom amount of memory in Bytes
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -m 2147483648B ${busybox}
Should Be Equal As Integers ${rc} 0
${id}= Get VM display name ${id}
${rc} ${output}= Run And Return Rc And Output govc vm.info ${id} |awk '/Memory:/ {print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2048MB
Create a container using rest api call without HostConfig in the form data
${status}= Run Keyword And Return Status Environment Variable Should Be Set DOCKER_CERT_PATH
${certs}= Set Variable If ${status} --cert %{DOCKER_CERT_PATH}/cert.pem --key %{DOCKER_CERT_PATH}/key.pem ${EMPTY}
${output}= Run curl -sk ${certs} -H "Content-Type: application/json" -d '{"Image": "${busybox}", "Cmd": ["ping", "127.0.0.1"], "NetworkMode": "bridge"}' https://%{VCH-IP}:%{VCH-PORT}/containers/create
Log ${output}
Should contain ${output} "Warnings":null
Create a container and check the VM display name and datastore folder name
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it --name busy3 ${busybox}
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}
Create disables VC destroy
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox}
Should Be Equal As Integers ${rc} 0
${id}= Get VM display name ${id}
${rc} ${output}= Run And Return Rc And Output govc vm.info -json ${id} | jq .VirtualMachines[].DisabledMethod
Should Be Equal As Integers ${rc} 0
Run Keyword If '%{HOST_TYPE}' == 'VC' Should Contain ${output} Destroy_Task
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Not Contain ${output} Destroy_Task
Parallel creates with same container name
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${suffix}= Evaluate '%{DRONE_BUILD_NUMBER}-' + str(random.randint(1000,9999)) modules=random
Set Test Variable ${name} testDuplicates-${suffix}
${pid1}= Start Process docker %{VCH-PARAMS} create --name ${name} ${busybox} shell=True
${pid2}= Start Process docker %{VCH-PARAMS} create --name ${name} ${busybox} shell=True
${res1}= Wait For Process ${pid1}
${res2}= Wait For Process ${pid2}
# Only one process should succeed
Run Keyword If ${res1.rc} == 0 Should Not Be Equal As Integers ${res2.rc} 0
Run Keyword If ${res2.rc} == 0 Should Not Be Equal As Integers ${res1.rc} 0
${status1} ${out1}= Run Keyword And Ignore Error Should Contain ${res1.stderr} is already in use
${status2} ${out2}= Run Keyword And Ignore Error Should Contain ${res2.stderr} is already in use
# Only and only one process's stderr should contain the error message
Run Keyword If '${status1}' == 'PASS' Should Not Be Equal '${status2}' 'PASS'
Run Keyword If '${status2}' == 'PASS' Should Not Be Equal '${status1}' 'PASS'
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -f status=created
Should Be Equal As Integers ${rc} 0
Should Contain X Times ${output} ${name} 1
# Verify that remove and re-create works for the same name
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm ${name}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name ${name} ${busybox}
Should Be Equal As Integers ${rc} 0

View File

@@ -0,0 +1,45 @@
Test 1-05 - Docker Start
=======
# Purpose:
To verify that docker start command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/start/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker create -it busybox /bin/top to VIC appliance
3. Issue docker start <containerID>
4. Issue docker create vmware/photon
5. Issue docker start vmware/photon <containerID>
6. Issue docker start fakeContainer
7. Create a container, remove it's ethernet adapter, then start the container
8. Create and start 5 busybox containers running /bin/top serially
9. Create and start 5 ubuntu containers running /bin/top serially
10. Create and start 5 busybox containers running /bin/top all at once
11. Run a container with a test-network, stop the container, remove the test-network, then start the container again
12. Issue docker start -a <containerID> to a busybox ls container
# Expected Outcome:
* Commands 1-5 should all return without error and respond with the container ID
* After commands 3 and 5 verify that the containers are running
* Step 6 should result in the VIC appliance returning the following error:
```
Error response from daemon: No such container: fakeContainer
Error: failed to start containers: fakeContainer
```
* Step 7 should result in an error message stating unable to wait for process launch status
* Steps 8-11 should all result in all containers succeeding and not throwing any errors
* Step 11 should result in the VIC appliance returning the following error:
```
Error response from daemon: Server error from portlayer: network test-network not found
Error: failed to start containers: containerID
```
* Step 12 should succeed and provide the output from the ls command to the screen
# Possible Problems:
None

View File

@@ -0,0 +1,130 @@
# 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 1-05 - Docker Start
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Simple start
${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} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
Start from image that has no PATH
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull vmware/photon
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it vmware/photon
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
Start non-existent container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start fakeContainer
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: No such container: fakeContainer
Should Contain ${output} Error: failed to start containers: fakeContainer
Start with no ethernet card
# Testing that port layer doesn't hang forever if tether fails to initialize (see issue #2327)
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${name}= Generate Random String 15
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name ${name} ${busybox} date
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output govc device.remove -vm ${name}-* ethernet-0
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${name}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} unable to wait for process launch status
Should Not Contain ${output} context deadline exceeded
Serially start 5 long running containers
# Perf testing reported (see issue #2496)
${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
:FOR ${idx} IN RANGE 0 5
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -t ${busybox} /bin/top
\ Should Be Equal As Integers ${rc} 0
\ Should Not Contain ${output} Error:
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${output}
\ Should Be Equal As Integers ${rc} 0
\ Should Not Contain ${output} Error:
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -aq | xargs -n1 docker %{VCH-PARAMS} rm -f
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${ubuntu}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
:FOR ${idx} IN RANGE 0 5
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -t ${ubuntu} top
\ Should Be Equal As Integers ${rc} 0
\ Should Not Contain ${output} Error:
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${output}
\ Should Be Equal As Integers ${rc} 0
\ Should Not Contain ${output} Error:
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -aq | xargs -n1 docker %{VCH-PARAMS} rm -f
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Parallel start 5 long running containers
${pids}= Create List
${containers}= Create List
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
:FOR ${idx} IN RANGE 0 5
\ ${output}= Run docker %{VCH-PARAMS} create -t ${busybox} /bin/top
\ Should Not Contain ${output} Error
\ Append To List ${containers} ${output}
:FOR ${container} IN @{containers}
\ ${pid}= Start Process docker %{VCH-PARAMS} start ${container} shell=True
\ Append To List ${pids} ${pid}
# Wait for them to finish and check their RC
:FOR ${pid} IN @{pids}
\ ${res}= Wait For Process ${pid}
\ Should Be Equal As Integers ${res.rc} 0
Start a container with removed network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create test-network
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net test-network ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network rm test-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} network test-network not found
Simple start with attach
Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} ls
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start -a ${container}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} bin
Should Contain ${output} root
Should Contain ${output} var

View File

@@ -0,0 +1,72 @@
Test 1-06 - Docker Run
=======
# Purpose:
To verify that docker run command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/run/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker run busybox dmesg to the VIC appliance
3. Issue docker run busybox -i dmesg to the VIC appliance
4. Issue docker run -it busybox /bin/top to the VIC appliance
5. Issue 'q' command to the container
6. Issue docker run busybox /bin/top to the VIC appliance
7. Issue docker run busybox fakeCommand to the VIC appliance
8. Issue docker run fakeImage /bin/bash to the VIC appliance
9. Issue docker run -d --name busy3 busybox /bin/top to the VIC appliance
10. Issue docker run --link busy3:busy3 busybox ping -c2 busy3 to the VIC appliance
11. Issue docker run -it busybox /bin/df to the VIC appliance
12. Issue docker run -d -p 6379 redis:alpine to the VIC appliance
13. Issue docker run -it busybox /bin/true
14. Issue docker run -it busybox /bin/false
15. Issue docker run -it busybox /bin/fakeCommand
16. Issue docker run busybox date
17. Create container1 with id1 and then create container2 with name = id1
18. Run a short lived container with autoremove specified
19. Check the number of containers with docker ps -a
20. Run a short-lived auto-remove mongo container with a named volume (mapped to an image volume path) and an anonymous volume
21. Check the number of containers with docker ps -a
22. Run docker volume ls
23. Issue docker run -d -v vol:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=pw --name test-mysql mysql to the VIC appliance
24. Issue docker ps to the VIC appliance to verify that test-mysql is running and clean up afterward
25. Issue docker run -d -e MYSQL_ROOT_PASSWORD=pw --name test-mariadb mariadb to the VIC appliance
26. Issue docker ps to the VIC appliance to verify that test-mariadb is running and clean up afterward
27. Issue docker run -d --name test-postgres postgres to the VIC appliance
28. Issue docker ps to the VIC appliance to verify that test-postgres is running and clean up afterward
# Expected Outcome:
* Step 2 and 3 should result in success and print the dmesg of the container
* Step 4 should result in the top command starting and printing it's results to the screen
* Step 5 should result in top stopping and the container exiting
* Step 6 should result in the top command starting and printing it's results to the screen, as it is not interactive you will need to issue ctrl-c to stop the container with a KILL signal
* Step 7 should result in an error and the following message:
```
exec: "fakeCommand": executable file not found in $PATH
docker: Error response from daemon: Container command not found or does not exist..
```
* Step 8 should result in an error and the following message:
```
docker: Error parsing reference: "fakeImage" is not a valid repository/tag.
```
* Step 10 should result in success and the output should indicate that the ping succeeded across containers just using the linked name
* Step 11 should result in success with exit code 0 and show the output of the df command
* Step 12 should result in success with exit code 0
* Step 13 should result in success with exit code 0
* Step 14 should result in success with exit code 1
* Step 15 should result in success with exit code 127
* Step 16 should result in success and the output should contain the current date
* Step 17 should result in no conflicts
* Step 18 should result in the same container count at beginning and end
* Steps 19 and 20 should succeed
* Step 21's output should contain the same number of containers as Step 19's output
* Step 22's output should contain the named volume used in Step 20
* Step 23-28 should result in success with exit code 0
# Possible Problems:
None

View File

@@ -0,0 +1,209 @@
# 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 1-06 - Docker Run
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Make sure container starts
:FOR ${idx} IN RANGE 0 60
\ ${out}= Run docker %{VCH-PARAMS} ps
\ ${status}= Run Keyword And Return Status Should Contain ${out} /bin/top
\ Return From Keyword If ${status}
\ Sleep 1
Fail Container failed to start
Verify container is running and remove it
[Arguments] ${containerName}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Should Contain ${output} ${containerName}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f ${containerName}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
*** Test Cases ***
Simple docker run
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${busybox} /bin/ash -c "dmesg;echo END_OF_THE_TEST"
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} END_OF_THE_TEST
Docker run with -t
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -t ${busybox} /bin/ash -c "dmesg;echo END_OF_THE_TEST"
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} END_OF_THE_TEST
Simple docker run with app that doesn't exit
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -aq | xargs -n1 docker %{VCH-PARAMS} rm -f
${result}= Start Process docker %{VCH-PARAMS} run -d ${busybox} /bin/top shell=True alias=top
Make sure container starts
${containerID}= Run docker %{VCH-PARAMS} ps -q
${out}= Run docker %{VCH-PARAMS} logs ${containerID}
Should Contain ${out} Mem:
Should Contain ${out} CPU:
Should Contain ${out} Load average:
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -aq | xargs -n1 docker %{VCH-PARAMS} rm -f
Docker run fake command
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${busybox} fakeCommand
Should Be True ${rc} > 0
Should Contain ${output} docker: Error response from daemon:
Should Contain ${output} fakeCommand: no such executable in PATH.
Docker run fake image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run fakeImage /bin/bash
Should Be True ${rc} > 0
Should Contain ${output} docker: Error parsing reference:
Should Contain ${output} "fakeImage" is not a valid repository/tag
Docker run named container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --name busy3 ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Docker run linked containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${debian}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --link busy3:busy3 ${debian} ping -c2 busy3
Should Be Equal As Integers ${rc} 0
Docker run -d unspecified host port
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d -p 6379 redis:alpine
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Docker run check exit codes
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${busybox} true
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${busybox} false
Should Be Equal As Integers ${rc} 1
Docker run ps password check
[Tags] secret
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${busybox} ps auxww
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ps auxww
${output}= Split To Lines ${output}
:FOR ${line} IN @{output}
\ ${line}= Strip String ${line}
\ ${command}= Split String ${line} max_split=3
\ ${len}= Get Length ${command}
\ Continue For Loop If ${len} <= 4
\ Should Not Contain @{command}[4] %{TEST_USERNAME}
\ Should Not Contain @{command}[4] %{TEST_PASSWORD}
Docker run immediate exit
${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} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${busybox}
Should Be Equal As Integers ${rc} 0
Should Be Empty ${output}
Docker run verify container start and stop time
${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
${cmdStart}= Run date +%s
Sleep 3
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name startStop ${busybox}
Should Be Equal As Integers ${rc} 0
Should Be Empty ${output}
${rc} ${containerStart}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{.State.StartedAt}}' startStop | xargs date +%s -d
Should Be Equal As Integers ${rc} 0
${rc} ${containerStop}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{.State.FinishedAt}}' startStop | xargs date +%s -d
Should Be Equal As Integers ${rc} 0
${startStatus}= Run Keyword And Return Status Should Be True ${cmdStart} <= ${containerStart}
Run Keyword Unless ${startStatus} Fail container start time before command start
${stopStatus}= Run Keyword And Return Status Should Be True ${cmdStart} < ${containerStop}
Run Keyword Unless ${stopStatus} Fail container stop time before command start
${timeDiff}= Evaluate ${containerStop}-${cmdStart}
Should Be True 0 < ${timeDiff} < 60000
Docker run verify name and id are not conflated
${rc} ${container1}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd ${busybox}
Should Be Equal As Integers ${rc} 0
${shortID1}= Get container shortID ${container1}
${rc} ${container2}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd --name ${shortID1} ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${container2} Conflict
Docker run and auto remove
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
${count}= Get Length ${output}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --rm ${busybox} date
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
${output}= Split To Lines ${output}
Length Should Be ${output} ${count}
Docker run and auto remove with anonymous volumes and named volumes
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
${count}= Get Length ${output}
${suffix}= Evaluate '%{DRONE_BUILD_NUMBER}-' + str(random.randint(1000,9999)) modules=random
Set Test Variable ${namedImageVol} non-anonymous-image-volume-${suffix}
Should Be Equal As Integers ${rc} 0
Set Test Variable ${imageVolumeContainer} I-Have-Two-Anonymous-Volumes-${suffix}
${rc} ${c5}= Run And Return Rc And Output docker %{VCH-PARAMS} run --rm --name ${imageVolumeContainer} -v ${namedImageVol}:/data/db -v /I/AM/ANONYMOOOOSE mongo bash
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
${output}= Split To Lines ${output}
Length Should Be ${output} ${count}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Contain ${output} ${namedImageVol}
Docker run mysql container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d -v vol:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=pw --name test-mysql mysql
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Verify container is running and remove it test-mysql
Docker run mariadb container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d -e MYSQL_ROOT_PASSWORD=pw --name test-mariadb mariadb
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Verify container is running and remove it test-mariadb
Docker run postgres container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --name test-postgres postgres
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Verify container is running and remove it test-postgres
Docker run --hostname to set hostname and domainname
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --hostname vic.test ${busybox} hostname
Should Be Equal As Integers ${rc} 0
Should Contain ${output} vic.test
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --hostname vic.test ${busybox} hostname -d
Should Be Equal As Integers ${rc} 0
Should Contain ${output} test
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --hostname vic.test ${busybox} cat /etc/hosts
Should Be Equal As Integers ${rc} 0
Should Contain ${output} vic.test

View File

@@ -0,0 +1,39 @@
Test 1-07 - Docker Stop
=======
# Purpose:
To verify that docker stop command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/stop/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker create busybox sleep 30 to the VIC appliance
3. Issue docker stop <containerID> to the VIC appliance
4. Issue docker start <containerID> to the VIC appliance
5. Issue docker stop <containerID> to the VIC appliance
6. Issue docker start <containerID> to the VIC appliance
7. Issue docker stop -t 2 <containerID> to the VIC appliance
8. Issue docker stop fakeContainer to the VIC appliance
9. Create a new container, start the container using govc/UI, attempt to stop the container using docker stop
10. Start a new container, stop it, then attempt to restart it again
11. Start a new container, stop it with Docker 1.13 CLI
# Expected Outcome:
* Steps 2-8 should each complete without error, and the response should be the containerID
* Step 5 should take 10 seconds to complete
* Step 7 should take 2 seconds to complete
* Step 8 should respond with the following error message:
```
Failed to stop container (fakeContainer): Error response from daemon: No such container: fakeContainer
```
* Step 9 should result in the container stopping successfully
* Step 10 should result in the container starting without error the second time
* Step 11 should result in the container stopping successfully
# Possible Problems:
None

View File

@@ -0,0 +1,167 @@
# 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 1-07 - Docker Stop
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Trap Signal Command
# Container command runs an infinite loop, trapping and logging the given signal name
[Arguments] ${sig}
[Return] ${busybox} sh -c "trap 'echo StopSignal${sig}' ${sig}; echo READY; while true; do sleep 1; done"
Assert Ready
# Assert the docker stop signal trap has been set
[Arguments] ${id}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${id}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} READY
Assert Stop Signal
# Assert the docker stop signal was trapped by checking the container output log file
[Arguments] ${id} ${sig}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${id}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} StopSignal${sig}
Assert Kill Signal
# Assert SIGKILL was sent or not by checking the tether debug log file
[Arguments] ${id} ${expect}
${vmName}= Get VM display name ${id}
Run Keyword If '%{DATASTORE_TYPE}' == 'VSAN' Set Test Variable ${id} ${vmName}
${rc} ${output}= Run And Return Rc And Output govc vm.info -json ${vmName} | jq -r .VirtualMachines[].Runtime.PowerState
Should Be Equal As Integers ${rc} 0
Should Be Equal ${output} poweredOff
${rc} ${dir}= Run And Return Rc And Output govc datastore.ls ${id}*
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output govc datastore.download ${dir}/tether.debug -
Should Be Equal As Integers ${rc} 0
Run Keyword If ${expect} Should Contain ${output} sending signal KILL
Run Keyword Unless ${expect} Should Not Contain ${output} sending signal KILL
*** Test Cases ***
Stop an already stopped container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} ls
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0
Basic docker container stop
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} sleep 30
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0
Assert Kill Signal ${container} False
Basic docker stop w/ unclean exit from running process
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${container} | jq '.[]|.["State"]|.["ExitCode"]'
Should Be Equal As Integers ${rc} 0
${status}= Get State Of Github Issue 6614
Run Keyword If '${status}' == 'closed' Fail Test 1-07-Docker-Stop.robot needs to be updated now that Issue #6614 has been resolved
#Should Be Equal As Integers ${output} 143
Stop a container with SIGKILL using default grace period
${rc}= Run And Return Rc docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${trap}= Trap Signal Command HUP
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${trap}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Assert Ready ${container}
${rc}= Run And Return Rc docker %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0
Assert Kill Signal ${container} False
Stop a container with SIGKILL using specific stop signal
${rc}= Run And Return Rc docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${trap}= Trap Signal Command USR1
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --stop-signal USR1 ${trap}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Assert Ready ${container}
${rc}= Run And Return Rc docker %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0
Assert Stop Signal ${container} USR1
Assert Kill Signal ${container} True
Stop a container with SIGKILL using specific grace period
${rc}= Run And Return Rc docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${trap}= Trap Signal Command HUP
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --stop-signal HUP ${trap}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Assert Ready ${container}
${rc}= Run And Return Rc docker %{VCH-PARAMS} stop -t 2 ${container}
Should Be Equal As Integers ${rc} 0
Assert Stop Signal ${container} HUP
Assert Kill Signal ${container} True
Stop a non-existent container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop fakeContainer
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: No such container: fakeContainer
Attempt to stop a container that has been started out of band
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${name}= Generate Random String 15
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name ${name} ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Power On VM OOB ${name}-*
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 10x 3s Assert Kill Signal ${container} False
Restart a stopped container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it ${busybox} /bin/ls
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
${shortID}= Get container shortID ${output}
Wait Until VM Powers Off *-${shortID}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error:
Stop a container with Docker 1.13 CLI
${rc}= Run And Return Rc docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${trap}= Trap Signal Command HUP
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0

View File

@@ -0,0 +1,77 @@
Test 1-08 - Docker Logs
=======
# Purpose:
To verify that docker logs command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/logs/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC build 7315 to appliance to vSphere server
2. Issue docker run -d busybox sh -c "echo These pretzels are making me thirsty"
3. Issue docker logs <ID1>
4. Issue docker logs --timestamps <ID1>
5. Upgrade the VCH to current build
6. Issue docker run -d busybox sh -c "echo Whats the deeeal with Ovaltine"
7. Issue docker logs --timestamps <ID2>
8. Issue docker logs --timestamps <ID1>
9. Issue docker create busybox /bin/sh -c 'seq 1 5000' to the VIC appliance
10. Issue docker start <containerID> to the VIC appliance
11. Issue docker logs <containerID> to the VIC appliance
12. Issue docker logs --tail=all <containerID> to the VIC appliance
13. Issue docker logs --tail=200 <containerID> to the VIC appliance
14. Issue docker logs --tail=0 <containerID> to the VIC appliance
15. Issue docker create -t busybox /bin/sh -c 'for i in $(seq 1 5) ; do sleep 1 && echo line $i; done'
16. Issue docker start <containerID> to the VIC appliance
17. Issue docker logs --follow <containerID> to the VIC appliance
18. Issue docker create busybox /bin/sh -c 'trap "seq 11 20; exit" HUP; seq 1 10; while true; do sleep 1; done'
19. Issue docker start <containerID> to the VIC appliance
20. Issue docker logs <containerID> to the VIC appliance, waiting for the first 10 lines
21. Issue docker kill -s HUP <containerID> to the VIC appliance, generating the next 10 lines
22. Issue docker logs --tail=5 --follow <containerID> to the VIC appliance
23. Issue docker pull ubuntu
24. Issue docker run ubuntu /bin/cat /bin/hostname >/tmp/hostname
25. Issue docker logs <containerID> >/tmp/hostname-logs
26. Issue sha256sum on /tmp/hostname and /tmp/hostname-logs
27. Issue docker run ubuntu /bin/ls >/tmp/ls
28. Issue docker logs <containerID> >/tmp/ls-logs
29. Issue sha256sum on /tmp/ls and /tmp/ls-logs
30. Issue docker logs --since=1s <containerID> to the VIC appliance
31. Issue docker logs --timestamps <containerID> to the VIC appliance
32. Issue docker logs
33. Issue docker logs fakeContainer
# Expected Outcome:
* Steps 1-3,5-7,9-29 should all complete without error
* Step 3 should output "These pretzels are making me thirsty"
* Step 4 should output "vSphere Integrated Containers does not yet support '--timestamps'"
* Step 7 should output "Whats the deeeal with Ovaltine?" with a timestamps
* Step 8 should output "container <ID1> does not support '--timestamp'"
* Step 13 should output 200 lines
* Step 14 should output 0 lines
* Step 17 should have last line be
```
line 5
```
* Step 20 should output 10 lines
* Step 22 should output 15 lines
* Steps 26 and 29 should produce matching sha256 hashes for both files
* Step 30 should output 3 lines
* Step 31 should result in an error with the following message:
```
Error: vSphere Integrated Containers does not yet support timestamped logs.
```
* Step 32 should output all lines
* Step 33 should result in an error with the following message:
```
Error: No such container: fakeContainer
```
# 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,207 @@
# 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 1-08 - Docker Logs
Resource ../../resources/Util.robot
Suite Setup Install VIC with version to Test Server version=7315
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Grep Logs And Count Lines
[Arguments] ${id} ${match} ${total}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${id}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ${match}
${linecount}= Get Line Count ${output}
Should Be Equal As Integers ${linecount} ${total}
Upgrade
${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} Completed successfully
Should Not Contain ${output} Rolling back upgrade
Should Be Equal As Integers ${rc} 0
Check Upgraded Version
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version
@{vers}= Split String ${output}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} Completed successfully
Should Contain ${output} @{vers}[2]
Should Not Contain ${output} %{INITIAL-VERSION}
Should Be Equal As Integers ${rc} 0
Log ${output}
Get Docker Params ${output} ${true}
*** Test Cases ***
# This test happens first because the rest of the tests need the latest VCH after the upgrade step
Docker logs backward compatibility
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} pull busybox
Should Be Equal As Integers ${rc} 0
${rc} ${id1}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} run -d busybox sh -c "echo These pretzels are making me thirsty"
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} logs ${id1}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} These pretzels are making me thirsty
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} logs --timestamps ${id1}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} vSphere Integrated Containers does not yet support '--timestamps'
Upgrade
Check Upgraded Version
${rc} ${id2}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d busybox sh -c "echo Whats the deeeal with Ovaltine?"
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --timestamps ${id2}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Whats the deeeal with Ovaltine?
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --timestamps ${id1}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} container ${id1} does not support '--timestamps'
Docker logs with tail
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} sh -c 'seq 1 5000'
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${id}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Grep Logs And Count Lines ${id} 2500 5000
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --tail=all ${id}
${linecount}= Get Line Count ${output}
Should Be Equal As Integers ${rc} 0
Should Be Equal As Integers ${linecount} 5000
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --tail=200 ${id}
${linecount}= Get Line Count ${output}
Should Be Equal As Integers ${rc} 0
Should Be Equal As Integers ${linecount} 200
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --tail=0 ${id}
Should Be Equal As Integers ${rc} 0
${linecount}= Get Line Count ${output}
Should Be Equal As Integers ${linecount} 0
Docker logs with follow
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} sh -c 'for i in $(seq 1 5) ; do sleep 1 && echo line $i; done'
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${id}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow ${id}
Should Be Equal As Integers ${rc} 0
${linecount}= Get Line Count ${output}
Should Be Equal As Integers ${linecount} 5
${lastline}= Get Line ${output} 4
Should Contain ${lastline} line 5
# Container is stopped at this point, verify that --follow does not block.
${rc} ${output2}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow ${id}
Should Be Equal ${output} ${output2}
Docker logs with follow and tail
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} sh -c 'trap "seq 11 20; exit" HUP; seq 1 10; while true; do sleep 1; done'
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${id}
Should Be Equal As Integers ${rc} 0
# Wait for the first 10 lines to be logged
Wait Until Keyword Succeeds 20x 200 milliseconds Grep Logs And Count Lines ${id} 5 10
# kill -HUP will create another 5 lines of log output
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill -s HUP ${id}
Should Be Equal As Integers ${rc} 0
# --tail=5 to skip the first 5 lines and --follow to wait for the rest
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --tail 5 --follow ${id}
Should Be Equal As Integers ${rc} 0
${linecount}= Get Line Count ${output}
Should Be True ${linecount} >= 5
Docker logs follow shutdown
# Test that logs --follow reads all data following a close (shutdown) event.
# Keys to this test:
# - The container VM shutdown event happens while the (HTTP) log follow poller is asleep.
# - The container VM log accumulates > interaction layer buffer size data while log follow poller was alseep.
# Note that the interaction layer currently uses an extra super tiny buffer size of 64 bytes.
${rc} ${buffer}= Run And Return Rc And Output bash -c "printf '=%.0s' {1..65}"
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} sh -c 'echo ${buffer}; sleep .5; echo ${buffer}'
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${id}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow ${id}
Should Be Equal As Integers ${rc} 0
Should Be Equal ${output} ${buffer}\n${buffer}
Docker binary logs
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${ubuntu}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${ubuntu} /bin/cat /bin/hostname >/tmp/hostname
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a |grep ${ubuntu} |awk '{print $1}'
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${id} >/tmp/hostname-log
Should Be Equal As Integers ${rc} 0
${rc} ${h1}= Run And Return Rc And Output sha256sum /tmp/hostname |awk '{print $1}'
Should Be Equal As Integers ${rc} 0
${rc} ${h2}= Run And Return Rc And Output sha256sum /tmp/hostname-log |awk '{print $1}'
Should Be Equal As Integers ${rc} 0
Should Be Equal ${h1} ${h2}
${rc} ${output}= Run And Return Rc And Output rm /tmp/hostname*
Should Be Equal As Integers ${rc} 0
Docker text logs
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${ubuntu} /bin/ls >/tmp/ls
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a |grep /bin/ls |awk '{print $1}'
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${id} >/tmp/ls-log
Should Be Equal As Integers ${rc} 0
${rc} ${h1}= Run And Return Rc And Output sha256sum /tmp/ls |awk '{print $1}'
Should Be Equal As Integers ${rc} 0
${rc} ${h2}= Run And Return Rc And Output sha256sum /tmp/ls-log |awk '{print $1}'
Should Be Equal As Integers ${rc} 0
Should Be Equal ${h1} ${h2}
${rc} ${output}= Run And Return Rc And Output rm /tmp/ls*
Should Be Equal As Integers ${rc} 0
Docker logs with timestamps and since certain time
${rc}= Run And Return Rc docker %{VCH-PARAMS} run ${busybox} sh -c 'for i in $(seq 0 9) ; do sleep 1 && echo line $i; done'
Should Be Equal As Integers ${rc} 0
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -q |head --lines=1
Should Be Equal As Integers ${rc} 0
${rc} ${lines}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --since=5s ${containerID} |wc -l
Should Be Equal As Integers ${rc} 0
Should Not Be Equal As Integers ${lines} 10
${rc} ${lines}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --since=1h ${containerID} |wc -l
Should Be Equal As Integers ${rc} 0
Should Be Equal As Integers ${lines} 10
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${containerID} |wc -l
Should Be Equal As Integers ${rc} 0
Should Be Equal As Integers ${output} 10
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --timestamps ${containerID}
Should Be Equal As Integers ${rc} 0
${date}= Fetch From Left ${output} ${SPACE}
Should Match Regexp ${date} \\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{9}Z
Docker logs with no flags
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} sh -c "seq 1 128 | xargs -n1 echo"
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Grep Logs And Count Lines ${id} 42 128
Docker logs non-existent container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs fakeContainer
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error: No such container: fakeContainer

View File

@@ -0,0 +1,39 @@
Test 1-09 - Docker Attach
=======
# Purpose:
To verify that docker attach command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/attach/)
# Environment:
This test requires that a vSphere server is running and available
# Test Cases
## Basic attach
1. Deploy VIC appliance to vSphere server
2. Issue docker create -it busybox /bin/top to the VIC appliance
3. Issue docker start <containerID> to the VIC appliance
4. Issue docker attach <containerID> to the VIC appliance
5. Issue ctrl-p then ctrl-q to the container
6. Issue docker create -it busybox /bin/top to the VIC appliance
7. Issue docker attach <containerID>
8. Issue docker start <containerID> to the VIC appliance
9. Issue docker attach --detach-keys="a" <containerID> to the VIC appliance
10. Issue 'a' to the container
11. Attempt to reattach to the the same container a second time
12. Issue docker attach fakeContainer to the VIC appliance
### Expected Outcome:
* Steps 1-6,8-11 should all return without error
* Step 7 should result in the following error message:
```
You cannot attach to a stopped container, start it first
```
* Step 5 and 10 should cause the client to detach from the container gracefully, with the container continuing to run
* Step 12 should result in the following message:
```
Error: No such container: fakeContainer
```

View File

@@ -0,0 +1,86 @@
# 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 1-09 - Docker Attach
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Basic attach
${rc} ${output}= Run And Return Rc And Output mkfifo /tmp/fifo
${out}= Run docker %{VCH-PARAMS} pull busybox
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i busybox /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${containerID}
Should Be Equal As Integers ${rc} 0
Start Process docker %{VCH-PARAMS} attach ${containerID} < /tmp/fifo shell=True alias=custom
Sleep 3
Run echo q > /tmp/fifo
${ret}= Wait For Process custom
Should Be Equal As Integers ${ret.rc} 0
Should Be Empty ${ret.stdout}
Should Be Empty ${ret.stderr}
Attach to stopped container
${out}= Run docker %{VCH-PARAMS} pull busybox
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it busybox /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} attach ${out}
Should Be Equal As Integers ${rc} 1
Should Be Equal ${out} You cannot attach to a stopped container, start it first
Attach to fake container
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} attach fakeContainer
Should Be Equal As Integers ${rc} 1
Should Contain ${out} Error: No such container: fakeContainer
Attach with short input
${rc} ${tmp}= Run And Return Rc And Output mktemp -d -p /tmp
Should Be Equal As Integers ${rc} 0
${fifo}= Catenate SEPARATOR=/ ${tmp} fifo
${rc} ${output}= Run And Return Rc And Output mkfifo ${fifo}
Should Be Equal As Integers ${rc} 0
${out}= Run docker %{VCH-PARAMS} pull busybox
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i busybox sort
Should Be Equal As Integers ${rc} 0
:FOR ${idx} IN RANGE 0 5
\ Start Process docker %{VCH-PARAMS} start -ai ${containerID} < ${fifo} shell=True alias=custom
\ Run echo one > ${fifo}
\ ${ret}= Wait For Process custom
\ Log ${ret.stderr}
\ Should Be Equal ${ret.stdout} one
\ Should Be Equal As Integers ${ret.rc} 0
\ Should Be Empty ${ret.stderr}
Run rm -rf ${tmp}
Attach with short output
Run docker %{VCH-PARAMS} pull busybox
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create busybox echo one
Should Be Equal As Integers ${rc} 0
:FOR ${idx} IN RANGE 0 5
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start -a ${containerID}
\ Should Be Equal As Integers ${rc} 0
\ Should Be Equal ${output} one
Attach with short output with tty
Run docker %{VCH-PARAMS} pull busybox
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create -t busybox echo one
Should Be Equal As Integers ${rc} 0
:FOR ${idx} IN RANGE 0 5
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start -a ${containerID}
\ Should Be Equal As Integers ${rc} 0
\ Should Be Equal ${output} one

View File

@@ -0,0 +1,107 @@
Test 1-10 - Docker PS
=======
# Purpose:
To verify that docker ps command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/ps/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker ps
3. Issue docker create busybox /bin/top
4. Issue docker start <containerID>
5. Issue docker create busybox ls
6. Issue docker start <containerID>
7. Issue docker create busybox dmesg
8. Issue docker ps
9. Issue docker ps -a
10. Issue docker create --name jojo busybox /bin/top
11. PowerOn container jojo-* out of band via govc
12. Issue docker ps -q
13. Issue docker create --name koko busybox /bin/top
14. Issue docker start koko
15. Issue docker ps -q
16. PowerOff container koko* out of band via govc
17. Issue docker ps -q
18. Issue docker create -p 8000:80 -p 8443:443 nginx
19. Issue docker ps -a
20. Issue docker run -d -p 6379 redis:alpine
21. Issue docker ps
22. Issue docker create --name lolo busybox /bin/top
23. Issue docker start lolo
24. Issue docker stop lolo
25. Issue docker ps -aq
26. Destroy container lolo* out of band via govc
27. Issue docker ps -aq
28. Issue docker ps -l
29. Issue docker ps -n=2
30. Issue docker ps -ls
31. Issue docker ps -aq
32. Create 3 containers
33. Issue docker ps -aq
34. Issue docker ps -f status=created
35. Issue docker create --name abe --label prod busybox /bin/top
36. Issue docker ps -a -f label=prod
37. Issue docker ps -a -f name=abe
38. Issue docker create -v foo:/dir --name fooContainer busybox
39. Issue docker ps -a -f volume=foo
40. Issue docker ps -a -f volume=foo -f volume=bar
41. Issue docker ps -a -f volume=fo
42. Issue docker network create fooNet
43. Issue docker create --net=fooNet --name fooNetContainer busybox
44. Issue docker ps -a -f network=fooNet
45. Issue docker ps -a -f network=fooNet -f network=barNet
46. Issue docker ps -a -f network=fo
47. Issue docker ps -a -f volume=foo -f network=bar
48. Issue docker ps -a -f network=bar -f volume=foo
49. Issue docker ps -a -f volume=foo -f volume=buz -f network=bar
50. Issue docker create -v buz:/dir --net=fooNet --name buzFooContainer busybox
51. Issue docker ps -a -f volume=buz -f network=fooNet
# Expected Outcome:
* Steps 2-13 should all return without error
* Step 2 should return with only the printed ps command header and no containers
* Step 8 should return with only the information for the /bin/top container
* Step 9 should return with the information for all 3 containers
* Step 10-11 should return without error
* Step 12 should include jojo-* containerVM
* Steps 13-16 should return without error
* Step 17 should not include koko and have one less container than in Step 15
* Step 18 should return without error
* Step 19 should include the port-mappings of Step 18's container
* Step 20 should return without error
* Step 21 should include the port-mappings of Step 20's container
* Steps 22-25 should return without errors
* Step 26 should succeed on ESXi and fail on vCenter with the error:
```
govc: ServerFaultCode: The method is disabled by 'VIC'
```
* Step 27 should include one less container than in Step 25
* Step 28 should include only redis
* Step 29 should include only redis and nginx
* Step 30 should include only redis with SIZE present
* Steps 31-32 should return with error
* Step 33 should include 3 more containers than in Step 31
* Step 34 should include 4 created containers
* Step 35 should return without error
* Step 36 should include only abe
* Step 37 should include only abe
* Step 38 should return without error
* Step 39 should include only fooContainer
* Step 40 should include only fooContainer
* Step 41 should not include any containers
* Steps 42-43 should return without error
* Step 44 should include only fooNetContainer
* Step 45 should include only fooNetContainer
* Step 46 should not include any containers
* Steps 47-49 should not include any containers
* Step 50 should return without error
* Step 51 should include only buzFooContainer
# Possible Problems:
None

View File

@@ -0,0 +1,364 @@
# 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 1-10 - Docker PS
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Assert VM Power State
[Arguments] ${name} ${state}
${rc} ${output}= Run And Return Rc And Output govc vm.info -json ${name}-* | jq -r .VirtualMachines[].Runtime.PowerState
Should Be Equal As Integers ${rc} 0
Should Be Equal ${output} ${state}
Create several containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${container2}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} ls
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container2}
Should Be Equal As Integers ${rc} 0
${rc} ${container1}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container1}
Should Be Equal As Integers ${rc} 0
${rc} ${container3}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} dmesg
Should Be Equal As Integers ${rc} 0
${container2shortID}= Get container shortID ${container2}
Wait Until VM Powers Off *-${container2shortID}*
Assert Number Of Containers
[Arguments] ${num} ${type}=-q
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps ${type}
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
Length Should Be ${output} ${num}
Check Length Of PS
[Arguments] ${len}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps
Should Be Equal As Integers ${rc} 0
Should Contain ${output} /bin/top
${output}= Split To Lines ${output}
Length Should Be ${output} ${len}
*** Test Cases ***
Empty docker ps command
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps
Should Be Equal As Integers ${rc} 0
Should Contain ${output} CONTAINER ID
Should Contain ${output} IMAGE
Should Contain ${output} COMMAND
Should Contain ${output} CREATED
Should Contain ${output} STATUS
Should Contain ${output} PORTS
Should Contain ${output} NAMES
${output}= Split To Lines ${output}
Length Should Be ${output} 1
Docker ps only running containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
${len}= Get Length ${output}
Create several containers
Wait Until Keyword Succeeds 5x 5 seconds Check Length of PS ${len+1}
Docker ps all containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
${len}= Get Length ${output}
Create several containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Should Be Equal As Integers ${rc} 0
Should Contain ${output} /bin/top
Should Contain ${output} dmesg
Should Contain ${output} ls
${output}= Split To Lines ${output}
Length Should Be ${output} ${len+3}
Docker ps powerOn container OOB
# supply an IP address or the container will not have one bound and will only report as Starting, not showing in plain ps output
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name jojo --ip=172.16.0.50 ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -q
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
${len}= Get Length ${output}
Power On VM OOB jojo*
Wait Until Keyword Succeeds 10x 6s Assert Number Of Containers ${len+1}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop jojo
Should Be Equal As Integers ${rc} 0
Docker ps powerOff container OOB
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name koko ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start koko
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -q
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
${len}= Get Length ${output}
Power Off VM OOB koko*
Wait Until Keyword Succeeds 10x 6s Assert Number Of Containers ${len-1}
Docker ps ports output
${rc}= Run And Return Rc docker %{VCH-PARAMS} pull ${nginx}
Should Be Equal As Integers ${rc} 0
# forwarding via the endpointVM
${rc} ${containerA}= Run And Return Rc And Output docker %{VCH-PARAMS} create -p 8000:80 -p 8443:443 ${nginx}
Should Be Equal As Integers ${rc} 0
# published via the container-network with no port redirect
${rc} ${containerB}= Run And Return Rc And Output docker %{VCH-PARAMS} create -p 8000 --net=public ${nginx}
Should Be Equal As Integers ${rc} 0
# published via the container-network with port redirect
${rc} ${containerC}= Run And Return Rc And Output docker %{VCH-PARAMS} create -p 8001:80 --net=public ${nginx}
Should Be Equal As Integers ${rc} 0
# published via the endpointVM but connected to container-network
${rc} ${containerD}= Run And Return Rc And Output docker %{VCH-PARAMS} create -p 8002:80 ${nginx}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker %{VCH-PARAMS} network connect public ${containerD}
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
## Check that ports are not displayed before start
Should Not Contain ${output} 80/tcp
Should Not Contain ${output} 443/tcp
Should Not Contain ${output} 8000/tcp
Should Not Contain ${output} :8001->80/tcp
Should Not Contain ${output} :8002->80/tcp
## Check ports are displayed once started
${rc}= Run And Return Rc docker %{VCH-PARAMS} start ${containerA} ${containerB} ${containerC} ${containerD}
Should Be Equal As Integers ${rc} 0
${ipB}= Get Container IP %{VCH-PARAMS} ${containerB} public
${ipC}= Get Container IP %{VCH-PARAMS} ${containerC} public
${ipD}= Get Container IP %{VCH-PARAMS} ${containerD} public
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Should Be Equal As Integers ${rc} 0
Should Contain ${output} %{EXT-IP}:8000->80/tcp
Should Contain ${output} %{EXT-IP}:8443->443/tcp
Should Contain ${output} ${ipB}:8000->8000/tcp
Should Contain ${output} ${ipC}:8001->80/tcp
Should Contain ${output} %{EXT-IP}:8002->80/tcp
Should Not Contain ${output} ${ipD}:8002->80/tcp
## Stop the containers and ensure ports are not listed
${rc}= Run And Return Rc docker %{VCH-PARAMS} stop ${containerA} ${containerB} ${containerC} ${containerD}
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
# forwarding via endpointVM.
Should Not Contain ${output} 80/tcp
Should Not Contain ${output} 443/tcp
Should Not Contain ${output} 8000/tcp
Should Not Contain ${output} 8001->80/tcp
Should Not Contain ${output} 8002->80/tcp
Create reference containers for last container and status tests
# used as a reference during the status filter test
${rc} ${containerA}= Run And Return Rc And Output docker %{VCH-PARAMS} create -p 8000:80 -p 8443:443 ${nginx}
Should Be Equal As Integers ${rc} 0
# Used as a reference after the OOB test
${rc} ${containerB}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d -p 6379 redis:alpine
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ->6379/tcp
Docker ps Remove container OOB
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name lolo ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start lolo
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop lolo
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -aq
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
${len}= Get Length ${output}
# Remove container VM out-of-band
${rc} ${output}= Run And Return Rc And Output govc vm.destroy "lolo*"
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Be Equal As Integers ${rc} 0
Run Keyword If '%{HOST_TYPE}' == 'VC' Should Not Be Equal As Integers ${rc} 0
Run Keyword If '%{HOST_TYPE}' == 'VC' Should Contain ${output} govc: ServerFaultCode: The method is disabled by 'VIC'
# Remove the 'lolo' container on VC so it does not affect subsequent test cases
${rc} ${output}= Run Keyword If '%{HOST_TYPE}' == 'VC' Run And Return Rc And Output docker %{VCH-PARAMS} rm -f lolo
Pass Execution If '%{HOST_TYPE}' == 'VC' Remaining steps not applicable on VC - skipping
Wait Until VM Is Destroyed "lolo*"
Wait Until Keyword Succeeds 10x 6s Assert Number Of Containers ${len-1} -aq
${rc} ${output}= Run Keyword If '%{DATASTORE_TYPE}' == 'VSAN' Run And Return Rc And Output govc datastore.ls | grep "lolo*" | xargs -n1 govc datastore.rm
Run Keyword If '%{DATASTORE_TYPE}' == 'VSAN' Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run Keyword If '%{DATASTORE_TYPE}' == 'Non_VSAN' Run And Return Rc And Output govc datastore.ls | grep ${container} | xargs -n1 govc datastore.rm
Run Keyword If '%{DATASTORE_TYPE}' == 'Non_VSAN' Should Be Equal As Integers ${rc} 0
Docker ps last container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -l
Should Be Equal As Integers ${rc} 0
Should Contain ${output} redis
${output}= Split To Lines ${output}
Length Should Be ${output} 2
Docker ps two containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -n=2
Should Be Equal As Integers ${rc} 0
Should Contain ${output} redis
Should Contain ${output} nginx
${output}= Split To Lines ${output}
Length Should Be ${output} 3
Docker ps last container with size
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} SIZE
Should Contain ${output} redis
${output}= Split To Lines ${output}
Length Should Be ${output} 2
Docker ps all containers with only IDs
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -aq
${output}= Split To Lines ${output}
${len}= Get Length ${output}
Create several containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -aq
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} CONTAINER ID
Should Not Contain ${output} /bin/top
Should Not Contain ${output} dmesg
Should Not Contain ${output} ls
${output}= Split To Lines ${output}
Length Should Be ${output} ${len+3}
Docker ps with status filter
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -f status=created
Should Be Equal As Integers ${rc} 0
Should Contain ${output} nginx
${output}= Split To Lines ${output}
Length Should Be ${output} 5
Docker ps with label and name filter
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name abe --label prod ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f label=prod
Should Be Equal As Integers ${rc} 0
Should Contain ${output} busybox
${output}= Split To Lines ${output}
Length Should Be ${output} 2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f name=abe
Should Be Equal As Integers ${rc} 0
Should Contain ${output} busybox
${output}= Split To Lines ${output}
Length Should Be ${output} 2
Docker ps with volume filter
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v foo:/dir --name fooContainer ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f volume=foo
Should Be Equal As Integers ${rc} 0
Should Contain ${output} fooContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f volume=foo -f volume=bar
Should Be Equal As Integers ${rc} 0
Should Contain ${output} fooContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f volume=fo
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} fooContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 1
Docker ps with network filter
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create fooNet
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --net=fooNet --name fooNetContainer ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f network=fooNet
Should Be Equal As Integers ${rc} 0
Should Contain ${output} fooNetContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f network=fooNet -f network=barNet
Should Be Equal As Integers ${rc} 0
Should Contain ${output} fooNetContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f network=fo
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} fooNetContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 1
Docker ps with volume and network filters
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f volume=foo -f network=bar
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} fooContainer
Should Not Contain ${output} fooNetContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f network=bar -f volume=foo
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} fooContainer
Should Not Contain ${output} fooNetContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f volume=foo -f volume=buz -f network=bar
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} fooContainer
Should Not Contain ${output} fooNetContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v buz:/dir --net=fooNet --name buzFooContainer ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a -f volume=buz -f network=fooNet
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} fooContainer
Should Not Contain ${output} fooNetContainer
Should Contain ${output} buzFooContainer
${output}= Split To Lines ${output}
Length Should Be ${output} 2

View File

@@ -0,0 +1,71 @@
Test 1-11 - Docker RM
=======
# Purpose:
To verify that docker rm command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/rm/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker create busybox dmesg to the VIC appliance
3. Issue docker rm <containerID> to the VIC appliance
4. Issue docker create busybox ls to the VIC appliance
5. Issue docker start <containerID> to the VIC appliance
6. Issue docker rm <containerID> to the VIC appliance
7. Issue docker create busybox /bin/top to the VIC appliance
8. Issue docker start <containerID> to the VIC appliance
9. Issue docker rm <containerID> to the VIC appliance
10. Issue docker rm -f <containerID> to the VIC appliance
11. Issue docker rm fakeContainer to the VIC appliance
12. Issue docker create --name test busybox to the VIC appliance
13. Remove the containerVM out-of-band using govc
14. Issue docker rm test to the VIC appliance
15. Issue docker rm to container created with an unknown executable
16. Create a container with an anonymous and a named volume
17. Issue docker rm -v to the container from Step 16
18. Issue volume ls to the VIC appliance
19. Create a container with an anonymous volume
20. Create a container with Step 19's anonymous volume as a named volume
21. Issue docker rm -v to the container from Step 19
22. Issue volume ls to the VIC appliance
23. Issue docker rm -v to the container from Step 20
24. Issue volume ls to the VIC appliance
25. Run a container with the volume from Step 19's volume
26. Issue docker rm -f to the container from Step 25
27. Create a new named volume
28. Create a mongo container with the above named volume (mapped to an image volume path) and an anonymous volume
29. Run docker volume ls
30. Run docker rm -v for the container created in Step 28
31. Run docker volume ls
# Expected Outcome:
* Steps 2-8,12,15-31 should complete without error
* Step 3,6,10 should result in the container being removed from the VIC appliance
* Step 9 should result in the following error:
```
Error response from daemon: Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f
```
* Step 11 should result in the following error:
```
Error response from daemon: No such container: fakeContainer
```
* Step 13 should succeed on ESXi and fail on vCenter with the following error:
```
govc: ServerFaultCode: The method is disabled by 'VIC'
```
* When run on standalone ESXi, step 14 should result in the following error:
```
Error response from daemon: No such container: test
```
* Step 17's output should contain the named volume but not the anonymous volume from Step 16
* Step 22's output should contain the volume used in steps 19 and 20
* Step 24's output should contain the volume used in steps 19 and 20
* Step 29's and 31's output should contain the named volume used in step 28
# Possible Problems:
None

View File

@@ -0,0 +1,169 @@
# 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 1-11 - Docker RM
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Check That VM Is Removed
[Arguments] ${container}
${id}= Get container shortID ${container}
${rc} ${output}= Run And Return Rc And Output govc ls vm
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} ${id}
Check That Datastore Is Cleaned
[Arguments] ${container}
${rc} ${output}= Run And Return Rc And Output govc datastore.ls
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} ${container}
*** Test Cases ***
Basic docker remove container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} dmesg
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm ${container}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 10x 6s Check That VM Is Removed ${container}
Wait Until Keyword Succeeds 10x 6s Check That Datastore Is Cleaned ${container}
Remove a stopped container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} ls
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
Wait Until Container Stops ${container}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm ${container}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 10x 6s Check That VM Is Removed ${container}
Wait Until Keyword Succeeds 10x 6s Check That Datastore Is Cleaned ${container}
Remove a running container
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm ${container}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: You cannot remove a running container. Stop the container before attempting removal or use -f
Force remove a running container
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f ${container}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 10x 6s Check That VM Is Removed ${container}
Wait Until Keyword Succeeds 10x 6s Check That Datastore Is Cleaned ${container}
Remove a fake container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm fakeContainer
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: No such container: fakeContainer
Remove a container deleted out of band
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name testRMOOB -p 80:8080 ${busybox}
Should Be Equal As Integers ${rc} 0
# Remove container VM out-of-band
${rc} ${output}= Run And Return Rc And Output govc vm.destroy "testRMOOB*"
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Be Equal As Integers ${rc} 0
Run Keyword If '%{HOST_TYPE}' == 'VC' Should Not Be Equal As Integers ${rc} 0
Run Keyword If '%{HOST_TYPE}' == 'VC' Should Contain ${output} govc: ServerFaultCode: The method is disabled by 'VIC'
Pass Execution If '%{HOST_TYPE}' == 'VC' Remaining steps not applicable on VC - skipping
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm testRMOOB
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: No such container: testRMOOB
# now recreate the same container to ensure it's completely deleted
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name testRMOOB -p 80:8080 ${busybox}
Should Be Equal As Integers ${rc} 0
Remove a container created with unknown executable
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} xxxx
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm ${container}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 10x 6s Check That VM Is Removed ${container}
Remove a container and its anonymous volumes
${suffix}= Evaluate '%{DRONE_BUILD_NUMBER}-' + str(random.randint(1000,9999)) modules=random
Set Test Variable ${namedvol} namedvol-${suffix}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
# Verify that for a container with an anon and a named vol, only the anon vol gets removed
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create ${namedvol}
Should Be Equal As Integers ${rc} 0
${rc} ${c1}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v /foo -v ${namedvol}:/bar ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${c1} | jq -c '.[0].Mounts'
Should Be Equal As Integers ${rc} 0
${rc} ${vol1}= Run And Return Rc And Output echo '${output}' | jq -r '.[0].Name'
Should Be Equal As Integers ${rc} 0
${rc} ${vol2}= Run And Return Rc And Output echo '${output}' | jq -r '.[1].Name'
Should Be Equal As Integers ${rc} 0
${anonvol}= Set Variable If '${vol1}' == '${namedvol}' ${vol2} ${vol1}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -v ${c1}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} ${anonvol}
Should Contain ${output} ${namedvol}
# Verify that for a container with an anon vol and another container with that vol as a named vol, the vol isn't removed
${rc} ${c2}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v /foo ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${anonvol}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${c2} | jq -r '.[0].Mounts[0].Name'
Should Be Equal As Integers ${rc} 0
${rc} ${c3}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v ${anonvol}:/bar ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -v ${c2}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Contain ${output} ${anonvol}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -v ${c3}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Contain ${output} ${anonvol}
# Verify that the above volume can be used by containers
${rc} ${c4}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d -v ${anonvol}:/bar ${busybox} /bin/ls
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f ${c4}
Should Be Equal As Integers ${rc} 0
# Verify that only anonymous volumes are removed when superseding an image volume with a named volume
${suffix}= Evaluate '%{DRONE_BUILD_NUMBER}-' + str(random.randint(1000,9999)) modules=random
Set Test Variable ${namedImageVol} non-anonymous-image-volume-${suffix}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name ${namedImageVol}
Should Be Equal As Integers ${rc} 0
Set Test Variable ${imageVolumeContainer} I-Have-Two-Anonymous-Volumes-${suffix}
${rc} ${c5}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name ${imageVolumeContainer} -v ${namedImageVol}:/data/db -v /I/AM/ANONYMOOOOSE mongo
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Contain ${output} ${namedImageVol}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -v ${imageVolumeContainer}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Contain ${output} ${namedImageVol}

View File

@@ -0,0 +1,50 @@
Test 1-12 - Docker RMI
=======
# Purpose:
To verify that docker rmi command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/rmi/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker pull busybox to the VIC appliance
3. Issue docker rmi busybox to the VIC appliance
4. Issue docker pull busybox to the VIC appliance
5. Issue docker create busybox /bin/top to the VIC appliance
6. Issue docker rm <containerID> to the VIC appliance
7. Issue docker rmi busybox to the VIC appliance
8. Issue docker pull busybox to the VIC appliance
9. Issue docker create busybox /bin/top to the VIC appliance
10. Issue docker rmi busybox to the VIC appliance
11. Issue docker rmi -f busybox to the VIC appliance
12. Issue docker rmi fakeImage to the VIC appliance
13. Issue a docker pull by digest
14. Issue a docker rmi by digest
15. Issue docker pull for busybox and alpine
16. Reboot the VCH and wait for it to initialize
17. Obtain the image short ID for busybox
18. Issue docker rmi using the short ID for busybox
19. Obtain the image long ID for alpine
20. Issue docker rmi using the long ID for alpine
# Expected Outcome:
* Step 3 and 7 should result in success and the image should be removed from inventory
* Step 10 should result in failure and the error message below:
```
Failed to remove image (busybox): Error response from daemon: conflict: unable to remove repository reference "busybox" (must force) - container 6a26c7deb9b7 is using its referenced image 47bcc53f74dc
```
* Step 11 should result in success and the image should be removed from inventory
* Step 12 should result in an error with the following message:
```
Failed to remove image (fakeImage): Error response from daemon: No such image: fakeImage:latest
```
* Steps 13-14 should result in success and the output of step 14 should contain the digest of the rmi'd image
* Steps 15-20 should succeed
# Possible Problems:
None

View File

@@ -0,0 +1,119 @@
# 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 1-12 - Docker RMI
Resource ../../resources/Util.robot
Suite Setup Run Keywords Conditional Install VIC Appliance To Test Server Remove All Containers
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Basic docker pull, restart, and remove image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${alpine}
Should Be Equal As Integers ${rc} 0
# Gather logs before rebooting
Run Keyword And Continue On Failure Gather Logs From Test Server -before-reboot-1
Reboot VM %{VCH-NAME}
Wait For VCH Initialization 30x 10 seconds
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rmi ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images ${busybox}:latest
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} busybox
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images ${alpine}:latest
Should Be Equal As Integers ${rc} 0
Should Contain ${output} alpine
Remove image with a removed container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rmi ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images ${busybox}:latest
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} busybox
Remove image with a container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rmi ${busybox}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Failed to remove image "${busybox}"
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ${busybox}
# Cleanup container for future test-cases that use ${busybox}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f ${container}
Should Be Equal As Integers ${rc} 0
Remove a fake image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rmi fakeImage
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: Error parsing reference: "fakeImage" is not a valid repository/tag
Remove an image pulled by digest
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rmi ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
Remove images by short and long ID after VCH restart
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${alpine}
Should Be Equal As Integers ${rc} 0
# Gather logs before rebooting
Run Keyword And Continue On Failure Gather Logs From Test Server -before-reboot-2
Reboot VM %{VCH-NAME}
Wait For VCH Initialization 30x 10 seconds
# Remove image by short ID
${rc} ${busybox-shortID}= Run And Return Rc And Output docker %{VCH-PARAMS} images -q ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rmi ${busybox-shortID}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images -q ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} ${busybox-shortID}
# Remove image by long ID
${rc} ${alpine-shortID}= Run And Return Rc And Output docker %{VCH-PARAMS} images -q ${alpine}
Should Be Equal As Integers ${rc} 0
${rc} ${alpineID}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${alpine} | jq -r '.[0].Id'
Should Be Equal As Integers ${rc} 0
${alpine-longID}= Fetch From Right ${alpineID} sha256:
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rmi ${alpine-longID}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} images -q ${alpine}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} ${alpine-shortID}

View File

@@ -0,0 +1,33 @@
Test 1-13 - Docker Version
=======
# Purpose:
To verify that docker version command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/version/)
# Environment:
This test requires that a vSphere server is running and available.
# Test Steps:
1. Deploy VIC appliance to the vSphere server
2. Issue a docker version command to the new VIC appliance
3. Issue a docker version --format '{{.Client.Version}}' command to the new VIC appliance
4. Issue a docker1.11 version --format '{{.Client.APIVersion}}' command to the new VIC appliance
5. Issue a docker1.13 version --format '{{.Client.APIVersion}}' command to the new VIC appliance
6. Issue a docker version --format '{{.Client.GoVersion}}' command to the new VIC appliance
7. Issue a docker version --format '{{.Server.Version}}' command to the new VIC appliance
8. Issue a docker1.11 version --format '{{.Server.APIVersion}}' command to the new VIC appliance
9. Issue a docker1.13 version --format '{{.Server.APIVersion}}' command to the new VIC appliance
10. Issue a docker1.13 version --format '{{.Server.MinAPIVersion}}' command to the new VIC appliance
11. Issue a docker version --format '{{.Server.GoVersion}}' command to the new VIC appliance
12. Issue a docker version --format '{{.fakeItem}}' command to the new VIC appliance
# Expected Outcome:
* VIC appliance should respond with a properly formatted version response, it should be capable of returning each individual field as well without error.
* The server version field should indicate that it is VIC.
* Step 6 should result in an error indicating: fakeItem is not a field of struct type types.VersionResponse
# Possible Problems:
None

View File

@@ -0,0 +1,79 @@
# 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 1-13 - Docker Version
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Simple Docker Version
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} version
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Client:
Should Contain ${output} Server:
Should Contain ${output} Version:
Should Contain ${output} Built:
Docker Version Format Client Version
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} version --format '{{.Client.Version}}'
Should Be Equal As Integers ${rc} 0
Should Not Be Empty ${output}
Docker1.11 Version Format Client API Version
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} version --format '{{.Client.APIVersion}}'
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} 1.23
Docker1.13 Version Format Client API Version
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} version --format '{{.Client.APIVersion}}'
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} 1.25
Docker Version Format Client Go Version
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} version --format '{{.Client.GoVersion}}'
Should Be Equal As Integers ${rc} 0
Should Not Be Empty ${output}
Docker Version Format Server Version
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} version --format '{{.Server.Version}}'
Should Be Equal As Integers ${rc} 0
Should Not Be Empty ${output}
Docker1.11 Version Format Server API Version
${rc} ${output}= Run And Return Rc And Output docker1.11 %{VCH-PARAMS} version --format '{{.Server.APIVersion}}'
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} 1.25
Docker1.13 Version Format Server API Version
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} version --format '{{.Server.APIVersion}}'
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} 1.25
Docker1.13 Version Format Server Minimum API Version
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} version --format '{{.Server.MinAPIVersion}}'
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} 1.19
Docker Version Format Server Go Version
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} version --format '{{.Server.GoVersion}}'
Should Be Equal As Integers ${rc} 0
Should Not Be Empty ${output}
Docker Version Format Bad Field
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} version --format '{{.fakeItem}}'
Should Be Equal As Integers ${rc} 1
Should Contain ${output} can't evaluate field fakeItem in type types.VersionResponse

View File

@@ -0,0 +1,38 @@
Test 1-14 - Docker Kill
=======
# Purpose:
To verify that docker kill command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/kill/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker create busybox sleep 300 to the VIC appliance
3. Issue docker start <containerID> to the VIC appliance
4. Issue docker kill <containerID> to the VIC appliance
5. Issue docker start <containerID> to the VIC appliance
6. Issue docker kill -s HUP <containerID> to the VIC appliance
7. Issue docker kill -s TERM <containerID> to the VIC appliance
8. Issue docker kill fakeContainer to the VIC appliance
9. Issue docker create nginx to the VIC appliance
10. Issue docker start <containerID to the VIC appliance
11. Issue docker kill <containerID> to the VIC appliance
# Expected Outcome:
* Steps 2-7 should all return without error and provide the container ID in the response
* Step 4 should result in the container stopping immediately
* Step 6 should result in the container continuing to run
* Step 7 should result in the container stopping immediately
* Step 8 should result in an error and the following message:
```
Failed to kill container (fakeContainer): Error response from daemon: Cannot kill container fakeContainer: No such container: fakeContainer
```
* Step 11 should result in the container stopped
# Possible Problems:
None

View File

@@ -0,0 +1,118 @@
# 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 1-14 - Docker Kill
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Trap Signal Command
# Container command runs an infinite loop, trapping and logging the given signal name
[Arguments] ${sig}
[Return] ${busybox} sh -c "trap 'echo KillSignal${sig}' ${sig}; echo READY; while true; do date && sleep 1; done"
Nested Trap Signal Command
# Container command runs an infinite loop, trapping and logging the given signal name in a nested shell
# This is to test process group behaviours - same command as above, but nested in another shell
[Arguments] ${sig}
[Return] ${busybox} sh -c "trap 'echo KillSignalParent${sig}' ${sig}; sh -c \\"trap 'echo KillSignalChild${sig}' ${sig}; echo READY; while true; do date && sleep 1; done\\""
Assert Container Output
[Arguments] ${id} ${match}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${id}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ${match}
Check That Container Was Killed
[Arguments] ${container}
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f {{.State.Running}} ${container}
Log ${out}
Should Contain ${out} false
Should Be Equal As Integers ${rc} 0
*** Test Cases ***
Signal a container with default kill signal
${rc}= Run And Return Rc docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${trap}= Trap Signal Command HUP
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${trap}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${id}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Assert Container Output ${id} READY
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill ${id}
Should Be Equal As Integers ${rc} 0
# Wait for container VM to stop/powerOff
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow ${id}
# Cannot send signal to a powered off container VM
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill ${id}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Cannot kill container ${id}
Signal a container with SIGHUP
${rc}= Run And Return Rc docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${trap}= Trap Signal Command HUP
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${trap}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${id}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Assert Container Output ${id} READY
# Expect failure with unknown signal name
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill -s NOPE ${id}
Should Be Equal As Integers ${rc} 1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill -s HUP ${id}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Assert Container Output ${id} KillSignalHUP
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill -s TERM ${id}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow ${id}
Confirm signal delivered to entire process group
${rc}= Run And Return Rc docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${trap}= Nested Trap Signal Command HUP
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${trap}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${id}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Assert Container Output ${id} READY
# Expect failure with unknown signal name
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill -s NOPE ${id}
Should Be Equal As Integers ${rc} 1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill -s HUP ${id}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 20x 200 milliseconds Assert Container Output ${id} KillSignalChildHUP
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill -s TERM ${id}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow ${id}
Signal a non-existent container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill fakeContainer
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such container: fakeContainer
Signal a tough to kill container - nginx
${rc}= Run And Return Rc docker %{VCH-PARAMS} pull ${nginx}
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${nginx}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${id}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} kill ${id}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds 10x 6s Check That Container Was Killed ${id}

View File

@@ -0,0 +1,39 @@
Test 1-15 - Docker Network Create
=======
# Purpose:
To verify that docker network create command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/network_create/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker network create test-network to the VIC appliance
3. Issue docker network create --label=foo=bar label-network to the VIC appliance
4. Issue docker network inspect -f '{{.Labels}}' label-network to the VIC appliance
5. Issue docker network create test-network to the VIC appliance
6. Issue docker network create -d overlay test-network2 to the VIC appliance
7. Issue docker network create --internal internal-network
8. Issue docker network inspect -f '{{.Internal}}' internal-network
# Expected Outcome:
* Step 2 should complete successfully and a new network should be created named test-network
* Step 3 should complete successfully and a new network should be created named label-network
* Step 4 should complete successfully and the output should show label-network's label
* Step 5 should result in an error with the following message:
```
Error response from daemon: network with name test-network already exists
```
* Step 6 should result in an error with the following message:
```
Error response from daemon: failed to parse pool request for address space "GlobalDefault" pool "" subpool "": cannot find address space GlobalDefault (most likely the backing datastore is not configured)
```
* Step 7 should return without an error
* Step 8's output should be equal to 'true'
# Possible Problems:
None

View File

@@ -0,0 +1,58 @@
# 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 1-15 - Docker Network Create
Resource ../../resources/Util.robot
Suite Setup Run Keywords Conditional Install VIC Appliance To Test Server Remove All Container Networks
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Basic network create
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create test-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} test-network
Network create with label
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create --label=foo=bar label-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} label-network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network inspect -f '{{.Labels}}' label-network
Should Be Equal As Integers ${rc} 0
Should Contain ${output} map[foo:bar]
Create already created network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create test-network
Should Be Equal As Integers ${rc} 1
Should Contain ${output} already exists
Create overlay network
${status}= Get State Of Github Issue 1222
Run Keyword If '${status}' == 'closed' Fail Test 1-15-Docker-Network-Create.robot needs to be updated now that Issue #1222 has been resolved
Log Issue \#1222 is blocking implementation WARN
#${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create -d overlay test-network2
#Should Be Equal As Integers ${rc} 1
#Should Contain ${output} Error response from daemon: failed to parse pool request for address space "GlobalDefault" pool "" subpool "": cannot find address space GlobalDefault (most likely the backing datastore is not configured)
Create internal network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create --internal internal-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network inspect -f '{{.Internal}}' internal-network
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} true

View File

@@ -0,0 +1,33 @@
Test 1-16 - Docker Network LS
=======
# Purpose:
To verify that docker network ls command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/network_ls/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker network ls to the VIC appliance
3. Issue docker network ls -q to the VIC appliance
4. Issue docker network ls -f name=bridge to the VIC appliance
5. Issue docker network ls -f name=fakeName to the VIC appliance
6. Issue docker network create --label=foo foo-network to the VIC appliance
7. Issue docker network ls -f label=foo to the VIC appliance
8. Issue docker network ls --no-trunc to the VIC appliance
# Expected Outcome:
* Step 2 should return at the least the default networks
* Step 3 should return the networks ID only
* Step 4 should return only the bridge network
* Step 5 should return no networks listed
* Step 6 should return without errors
* Step 7 should return only the foo-network network
* Step 8 should return all of the networks with their full IDs
# Possible Problems:
None

View File

@@ -0,0 +1,63 @@
# 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 1-16 - Docker Network LS
Resource ../../resources/Util.robot
Suite Setup Run Keywords Conditional Install VIC Appliance To Test Server Remove All Container Networks
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Basic network ls
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} bridge
Docker network ls -q
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls -q
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} NAME
Should Not Contain ${output} DRIVER
Should Not Contain ${output} bridge
Docker network ls filter by name
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls -f name=bridge
Should Be Equal As Integers ${rc} 0
Should Contain ${output} bridge
@{lines}= Split To Lines ${output}
Length Should Be ${lines} 2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls -f name=fakeName
Should Be Equal As Integers ${rc} 0
@{lines}= Split To Lines ${output}
Length Should Be ${lines} 1
Should Contain @{lines}[0] NAME
Docker network ls filter by label
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create --label=foo foo-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls -f label=foo
Should Be Equal As Integers ${rc} 0
Should Contain ${output} foo-network
@{lines}= Split To Lines ${output}
Length Should Be ${lines} 2
Docker network ls --no-trunc
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls --no-trunc
Should Be Equal As Integers ${rc} 0
@{lines}= Split To Lines ${output}
@{line}= Split String @{lines}[1]
Length Should Be @{line}[0] 64

View File

@@ -0,0 +1,90 @@
Test 1-17 - Docker Network Connect
=======
# Purpose:
To verify that docker network connect command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/network_connect/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker network create cross1-network
3. Issue docker network create cross1-network2
4. Issue docker create --net cross1-network --name cross1-container busybox /bin/top
5. Issue docker network connect cross1-network2 <containerID>
6. Issue docker start <containerID>
7. Issue docker create --net cross1-network --name cross1-container2 debian ping -c2 cross1-container
8. Issue docker network connect cross1-network2 <containerID>
9. Issue docker start <containerID>
10. Issue docker logs --follow cross1-container2
11. Issue docker create --name cross1-container3 --net cross1-network busybox ping -c2 cross1-container3
12. Issue docker network connect cross1-network2 cross1-container3
13. Issue docker start cross1-container3
14. Issue docker logs --follow cross1-container3
15. Issue docker network create test-network
16. Issue docker create busybox ifconfig
17. Issue docker network connect test-network <containerID>
18. Issue docker start <containerID>
19. Issue docker logs <containerID>
20. Issue docker network connect test-network fakeContainer
21. Issue docker network connect fakeNetwork <containerID>
22. Issue docker network create cross2-network
23. Issue docker network create cross1-network2
24. Issue docker run -itd --net cross2-network --name cross2-container busybox /bin/top
25. Get the above container's IP - ${ip}
26. Issue docker run --net cross2-network2 --name cross2-container2 debian ping -c2 ${ip}
27. Issue docker logs --follow cross2-container2
28. Issue docker run -d --net cross2-network -p 8080:80 nginx
29. Get the above container's IP - ${ip}
30. Issue docker run --net cross2-network2 --name cross2-container3 debian ping -c2 ${ip}
31. Issue docker logs --follow cross2-container3
32. Issue docker network create --internal internal-net
33. Issue docker run --net internal-net busybox ping -c1 www.google.com
34. Issue docker network create public-net
35. Issue docker run --net internal-net --net public-net busybox ping -c2 www.google.com
36. Issue docker run -itd --net internal-net busybox
37. Get the above container's IP - ${ip}
38. Issue docker run --net internal-net busybox ping -c2 ${ip}
39. Issue docker network create foonet
40. Issue docker network create barnet
41. Issue docker network create baznet
42. Issue docker pull busybox and docker create
43. Issue docker network connect to connect the above container to the networks in Steps 39-41 concurrently
44. Issue docker inspect to check that the container is connected to the networks
45. Issue docker start and then rm -f for the container for a quick lifecycle check
# Expected Outcome:
* Steps 2-9 should return without errors
* Step 10's output should contain "2 packets transmitted, 2 packets received"
* Steps 11-13 should return without errors
* Step 14's output should contain "2 packets transmitted, 2 packets received"
* Step 15-17 should complete successfully
* Step 19 should print the results of the ifconfig command and there should be two network interfaces in the container(eth0, eth1)
* Step 20 should result in an error with the following message:
```
Error response from daemon: No such container: fakeContainer
```
* Step 21 should result in an error with the following message:
```
Error response from daemon: network fakeNetwork not found
```
* Steps 22-26 should return without errors
* Step 27's output should contain "2 packets transmitted, 0 packets received, 100% packet loss"
* Steps 28-30 should return without errors
* Step 31's output should include "2 packets transmitted, 0 packets received, 100% packet loss"
* Step 32 should return without an error
* Step 33 should return with a non-zero exit code and the output should contain "Network is unreachable"
* Step 34 should return without an error
* Step 35's output should contain "2 packets transmitted, 2 packets received"
* Steps 36-37 should return without errors
* Step 38's output should contain "2 packets transmitted, 2 packets received"
* Steps 39-43 should succeed
* Step 44's output should contain "foonet", "barnet" and "baznet"
* Step 45 should succeed
# Possible Problems:
None

View File

@@ -0,0 +1,201 @@
# 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 1-17 - Docker Network Connect
Resource ../../resources/Util.robot
Suite Setup Run Keywords Conditional Install VIC Appliance To Test Server Remove All Container Networks
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Connect containers to multiple bridge networks overlapping
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create cross1-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create cross1-network2
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${debian}
Should Be Equal As Integers ${rc} 0
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create --net cross1-network --name cross1-container ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect cross1-network2 ${containerID}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${containerID}
Should Be Equal As Integers ${rc} 0
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create --net cross1-network --name cross1-container2 ${debian} ping -c2 cross1-container
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect cross1-network2 ${containerID}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${containerID}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow cross1-container2
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 2 packets received
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name cross1-container3 --net cross1-network ${busybox} ping -c2 cross1-container3
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect cross1-network2 cross1-container3
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start cross1-container3
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow cross1-container3
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 2 packets received
Connect container to a new network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create test-network
Should Be Equal As Integers ${rc} 0
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} ip -4 addr show eth0
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect test-network ${containerID}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${containerID}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow ${containerID}
Should Be Equal As Integers ${rc} 0
${ips}= Get Lines Containing String ${output} inet
@{lines}= Split To Lines ${ips}
Length Should Be ${lines} 2
Connect to non-existent container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect test-network fakeContainer
Should Be Equal As Integers ${rc} 1
Should Contain ${output} not found
Connect to non-existent network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name connectTest3 ${busybox} ifconfig
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect fakeNetwork connectTest3
Should Be Equal As Integers ${rc} 1
Should Contain ${output} not found
Connect containers to multiple networks non-overlapping
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create cross2-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create cross2-network2
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${debian}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${nginx}
Should Be Equal As Integers ${rc} 0
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd --net cross2-network --name cross2-container ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${ip}= Get Container IP %{VCH-PARAMS} ${containerID} cross2-network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net cross2-network2 --name cross2-container2 ${debian} ping -c2 ${ip}
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 0 packets received, 100% packet loss
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow cross2-container2
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 0 packets received, 100% packet loss
# verify that an exposed port on the container does not break down bridge isolation
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net cross2-network -p 8080:80 ${nginx}
Should Be Equal As Integers ${rc} 0
${ip}= Get Container IP %{VCH-PARAMS} ${containerID} cross2-network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net cross2-network2 --name cross2-container3 ${debian} ping -c2 ${ip}
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 0 packets received, 100% packet loss
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs --follow cross2-container3
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 0 packets received, 100% packet loss
Connect containers to an internal network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create --internal internal-net
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net internal-net ${busybox} ping -c1 www.google.com
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} Network is unreachable
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create public-net
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net internal-net --net public-net ${busybox} ping -c2 www.google.com
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 2 packets received
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd --net internal-net ${busybox}
Should Be Equal As Integers ${rc} 0
${ip}= Get Container IP %{VCH-PARAMS} ${containerID} internal-net
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net internal-net ${busybox} ping -c2 ${ip}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 2 packets received
Check Name Resolution Between Containers On Internal Network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create --internal mynet
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create pubnet
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --name foo --net mynet alpine:latest sleep 10000
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i --name baz --net pubnet -p 80 alpine:latest ping -c3 foo
Log ${output}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect mynet baz
Log ${output}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start -i baz
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} PING foo
Should Contain ${output} 3 packets transmitted, 3 packets received
Connect container to multiple networks concurrently
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create foonet
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create barnet
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create baznet
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${c1}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox}
Should Be Equal As Integers ${rc} 0
${pid1}= Start Process docker %{VCH-PARAMS} network connect foonet ${c1} shell=True
${pid2}= Start Process docker %{VCH-PARAMS} network connect barnet ${c1} shell=True
${pid3}= Start Process docker %{VCH-PARAMS} network connect baznet ${c1} shell=True
${res1}= Wait For Process ${pid1}
${res2}= Wait For Process ${pid2}
${res3}= Wait For Process ${pid3}
Should Be Equal As Integers ${res1.rc} 0
Should Be Equal As Integers ${res2.rc} 0
Should Be Equal As Integers ${res3.rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${c1} | jq -c '.[0].NetworkSettings.Networks'
Should Be Equal As Integers ${rc} 0
Should Contain ${output} foonet
Should Contain ${output} barnet
Should Contain ${output} baznet
${rc} ${c1}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${c1}
Should Be Equal As Integers ${rc} 0
${rc} ${c1}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f ${c1}
Should Be Equal As Integers ${rc} 0

View File

@@ -0,0 +1,43 @@
Test 1-18 - Docker Network RM
=======
# Purpose:
To verify that docker network rm command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/network_rm/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker network create test-network to the VIC appliance
3. Issue docker network create test-network2 to the VIC appliance
4. Issue docker network create test-network3 to the VIC appliance
5. Issue docker rm test-network to the VIC appliance
6. Issue docker rm test-network2 <ID of test-network3> to the VIC appliance
7. Issue docker rm test-network to the VIC appliance
8. Issue docker network create test-network
9. Issue docker create busybox /bin/top
10. Issue docker network connect test-network <containerID>
11. Issue docker start <containerID>
12. Issue docker network rm test-network
13. Issue docker stop <containerID>
14. Issue docker rm <containerID>
15. Issue docker network rm test-network
# Expected Outcome:
* Steps 5 and 6 should completely successfully and all three network should be removed
* Step 7 should result in an error and show the following error message:
```
Error response from daemon: network test-network not found
```
* Step 12 should result in an error with the following message:
```
Error response from daemon: network test-network has active endpoints
```
* Step 15 should result in success and the network should be removed
# Possible Problems:
None

View File

@@ -0,0 +1,86 @@
# 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 1-18 - Docker Network RM
Resource ../../resources/Util.robot
Suite Setup Run Keywords Conditional Install VIC Appliance To Test Server Remove All Container Networks
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Basic network remove
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create test-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network rm test-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} test-network
Multiple network remove
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create test-network2
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create test-network3
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network rm test-network2 ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} test-network2
Should Not Contain ${output} test-network3
Remove already removed network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network rm test-network
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: network test-network not found
Remove network with running container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create test-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect test-network ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network rm test-network
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: test-network has active endpoints
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm ${container}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network rm test-network
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} test-network
Add and remove network multiple times
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
: FOR ${INDEX} IN RANGE 1 30
\ ${rc}= Run And Return Rc docker %{VCH-PARAMS} network create foo
\ Should Be Equal As Integers ${rc} 0
\ ${rc}= Run And Return Rc docker %{VCH-PARAMS} network rm foo
\ Should Be Equal As Integers ${rc} 0
${rc} ${output2}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Be Equal ${output} ${output2}

View File

@@ -0,0 +1,63 @@
Test 1-19 - Docker Volume Create
=======
# Purpose:
To verify that docker volume create command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/volume_create/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker volume create to the VIC appliance
2. Create container with volume mounted over /etc and ensure that name resolution functions as expected
3. Issue docker volume create --name=test to the VIC appliance
4. Issue docker volume create --name=test to the VIC appliance
5. Issue docker volume create -d fakeDriver --name=test2
6. Issue docker volume create --name=test3 --opt VolumeStore=fakeStore
7. Issue docker volume create --name=test4 --opt Capacity=100
8. Issue docker volume create --name=test5 --opt Capacity=0
9. Issue docker volume create --name=test6 --opt Capacity=-1
10. Issue docker volume create --name=test7 --opt Capacity=2147483647
11. Issue docker volume create --name=test8 --opt Capacity=9999999999
12. Issue docker volume create --name=test???
13. Issue docker volume create --name=multipleX --opt Capacity=2MB ten times rapidly
14. Create container with an anonymous volume in the Dockerfile, and verify that the files in the volume exist
15. Create container with a named volume and verify that base image files are copied to the named volume
16. Create container with a named volume. Modify the copied image file. Remount the volume in a new container.
17. Run container with a volume, and run another container with same volume
# Expected Outcome:
* Steps 2 and 3 should complete successfully and return the name of the volume created, you should then be able to see the volume has been created
* Step 4 should result in error with the following error message:
```
Error response from daemon: A volume named test already exists. Choose a different volume name.
```
* Step 5 should result in error with the following error message:
```
error looking up volume plugin fakeDriver: plugin not found
```
* Step 6 should result in error with the following message:
```
Error looking up volume store fakeStore: datastore not found
```
* Step 7 should result in success and the volume created should be 100MB in size
* Step 8 should result in error and indicate that the capacity suggested is invalid
* Step 9 should result in error and indicate that the capacity suggested is invalid
* Step 10 should result in error and indicate that the datastore cannot create that big of a volume
* Step 11 should result in error and indicate that the capacity suggested in invalid
* Step 12 should result in error with the following message:
```
Error response from daemon: create test???: "test???" includes invalid characters for a local volume name, only "\[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed
```
* Step 13 should not result in any of the volume create operations failing
* Step 14 should result in success and print data in the volume
* Step 15 should result in success and print data in the volume
* Step 16 should result in success and the second container should contain the modified file contents
* Step 17 should result in error with message `devices <volume id> in use`
# Possible Problems:
* VIC requires you to specify storage on creation of the VCH that volumes can be created from, so when installing the VCH make sure to specify this parameter: --volume-store=

View File

@@ -0,0 +1,218 @@
# 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 1-19 - Docker Volume Create
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Simple docker volume create
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create
Should Be Equal As Integers ${rc} 0
Set Suite Variable ${ContainerName} unnamedSpecVolContainer
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name ${ContainerName} -d -v ${output}:/mydata ${busybox} /bin/df -Ph
Should Be Equal As Integers ${rc} 0
${ContainerRC} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} wait ${ContainerName}
Should Be Equal As Integers ${ContainerRC} 0
Should Not Contain ${output} Error response from daemon
${rc} ${disk-size}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${ContainerName} | grep by-label | awk '{print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${disk-size} 975.9M
Simple volume mounted over managed files
${status}= Get State Of Github Issue 5731
Run Keyword If '${status}' == 'closed' Fail Test should pass now that Issue #5731 has been resolved
#${rc} ${target}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit busybox
#Should Be Equal As Integers ${rc} 0
#${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -v /etc busybox ping -c2 ${target}
#Should Be Equal As Integers ${ContainerRC} 0
#Should Contain ${output} 2 packets transmitted, 2 packets received
Docker volume create named volume
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} test
Set Suite Variable ${ContainerName} specVolContainer
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name ${ContainerName} -d -v ${output}:/mydata ${busybox} /bin/df -Ph
Should Be Equal As Integers ${rc} 0
${ContainerRC} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} wait ${ContainerName}
Should Be Equal As Integers ${ContainerRC} 0
Should Not Contain ${output} Error response from daemon
${rc} ${disk-size}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${ContainerName} | grep by-label | awk '{print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${disk-size} 975.9M
Docker volume create image volume
Set Suite Variable ${ContainerName} imageVolContainer
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name ${ContainerName} -d mongo /bin/df -Ph
Should Be Equal As Integers ${rc} 0
${ContainerRC} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} wait ${ContainerName}
Should Be Equal As Integers ${ContainerRC} 0
Should Not Contain ${output} Error response from daemon
${rc} ${disk-size}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${ContainerName} | grep by-label | awk '{print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${disk-size} 976M
Docker volume create anonymous volume
Set Suite Variable ${ContainerName} anonVolContainer
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name ${ContainerName} -d -v /mydata ${busybox} /bin/df -Ph
Should Be Equal As Integers ${rc} 0
${ContainerRC} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} wait ${ContainerName}
Should Be Equal As Integers ${ContainerRC} 0
Should Not Contain ${output} Error response from daemon
${rc} ${disk-size}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${ContainerName} | grep by-label | awk '{print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${disk-size} 975.9M
Docker volume create already named volume
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: A volume named test already exists. Choose a different volume name.
Docker volume create volume with bad driver
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create -d fakeDriver --name=test2
Should Be Equal As Integers ${rc} 1
Should Contain ${output} error looking up volume plugin fakeDriver: plugin not found
Docker volume create with bad volumestore
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test3 --opt VolumeStore=fakeStore
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No volume store named (fakeStore) exists
Docker volume create with bad driver options
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test3 --opt bogus=foo
Should Be Equal As Integers ${rc} 1
Should Contain ${output} bogus is not a supported option
Docker volume create with mis-capitalized valid driver option
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test4 --opt cAPACITy=10000
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} test4
Set Suite Variable ${ContainerName} capacityVolContainer
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name ${ContainerName} -d -v ${output}:/mydata ${busybox} /bin/df -Ph
Should Be Equal As Integers ${rc} 0
${ContainerRC} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} wait ${ContainerName}
Should Be Equal As Integers ${ContainerRC} 0
Should Not Contain ${output} Error response from daemon
${rc} ${disk-size}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${ContainerName} | grep by-label | awk '{print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${disk-size} 9.5G
Docker volume create with specific capacity no units
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test5 --opt Capacity=100000
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} test5
Set Suite Variable ${ContainerName} capacityVolContainer2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name ${ContainerName} -d -v ${output}:/mydata ${busybox} /bin/df -Ph
Should Be Equal As Integers ${rc} 0
${ContainerRC} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} wait ${ContainerName}
Should Be Equal As Integers ${ContainerRC} 0
Should Not Contain ${output} Error response from daemon
${rc} ${disk-size}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${ContainerName} | grep by-label | awk '{print $2}'
Should Be Equal As Integers ${rc} 0
Should Contain ${disk-size} 96.0G
Docker volume create large volume specifying units
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=unitVol1 --opt Capacity=10G
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} unitVol1
Set Suite Variable ${ContainerName} unitContainer
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name ${ContainerName} -d -v ${output}:/mydata ${busybox} /bin/df -Ph
Should Be Equal As Integers ${rc} 0
${ContainerRC} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} wait ${ContainerName}
Should Be Equal As Integers ${ContainerRC} 0
Should Not Contain ${output} Error response from daemon
${disk-size}= Run docker %{VCH-PARAMS} logs ${ContainerName} | grep by-label | awk '{print $2}'
Should Contain ${disk-size} 9.5G
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=unitVol2 --opt Capacity=10000
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} unitVol2
Set Suite Variable ${ContainerName} unitContainer2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name ${ContainerName} -d -v ${output}:/mydata ${busybox} /bin/df -Ph
Should Be Equal As Integers ${rc} 0
${ContainerRC} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} wait ${ContainerName}
Should Be Equal As Integers ${ContainerRC} 0
Should Not Contain ${output} Error response from daemon
${disk-size}= Run docker %{VCH-PARAMS} logs ${ContainerName} | grep by-label | awk '{print $2}'
Should Contain ${disk-size} 9.5G
Docker volume create with zero capacity
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test5 --opt Capacity=0
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: bad driver value - Invalid size: 0
Docker volume create with negative one capacity
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test6 --opt Capacity=-1
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: bad driver value - Invalid size: -1
Docker volume create with capacity too big
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test7 --opt Capacity=9223372036854775808
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: bad driver value - Capacity value too large: 9223372036854775808
Docker volume create with capacity exceeding int size
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test8 --opt Capacity=9999999999999999999
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: bad driver value - Capacity value too large: 9999999999999999999
Docker volume create with possibly invalid name
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test???
Should Be Equal As Integers ${rc} 1
Should Be Equal As Strings ${output} Error response from daemon: volume name "test???" includes invalid characters, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed
Docker volume verify anonymous volume contains base image files
${status}= Get State Of Github Issue 7365
Run Keyword If '${status}' == 'closed' Fail Test 1-19-Docker-Volume-Create.robot needs to be updated now that Issue #7365 has been resolved
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name verify-anon-1 jakedsouza/group-1-19-docker-verify-volume-files:1.0 ls /etc/example
# Should Be Equal As Integers ${rc} 0
# Should Contain ${output} thisshouldexist
# Should Contain ${output} testfile.txt
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name verify-anon-2 jakedsouza/group-1-19-docker-verify-volume-files:1.0 cat /etc/example/testfile.txt
# Should Be Equal As Integers ${rc} 0
# Should Contain ${output} TestFile
#Docker volume verify named volume contains base image files
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name verify-named-1 -v test15:/etc/example jakedsouza/group-1-19-docker-verify-volume-files:1.0 cat /etc/example/testfile.txt
# Should Be Equal As Integers ${rc} 0
# Should Contain ${output} TestFile
# Verify file is copied to volumeA
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name verify-named-2 -v test15:/mnt/test15 jakedsouza/group-1-19-docker-verify-volume-files:1.0 cat /mnt/test15/testfile.txt
# Should Be Equal As Integers ${rc} 0
# Should Contain ${output} TestFile
#Docker volume verify files are not copied again in a non empty volume
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -v test16:/etc/example jakedsouza/group-1-19-docker-verify-volume-files:1.0 sh -c "echo test16modified >> /etc/example/testfile.txt"
# Should Be Equal As Integers ${rc} 0
# Verify modified file remains
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -v test16:/etc/example jakedsouza/group-1-19-docker-verify-volume-files:1.0 cat /etc/example/testfile.txt
# Should Be Equal As Integers ${rc} 0
# Should Contain ${output} test16modified
Docker volume conflict in new container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create
Should Be Equal As Integers ${rc} 0
Set Suite Variable ${volID} ${output}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit -v ${volID}:/mydata ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit -v ${volID}:/mydata ${busybox}
Should Be Equal As Integers ${rc} 125
Should Contain ${output} Error response from daemon
Should Contain ${output} device ${volID} in use

View File

@@ -0,0 +1,27 @@
Test 1-20 - Docker Volume Inspect
=======
# Purpose:
To verify that docker volume inspect command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/volume_inspect/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker volume create --name=test to the VIC appliance
3. Issue docker volume inspect test to the VIC appliance
4. Issue docker volume inspect fakeVolume to the VIC appliance
# Expected Outcome:
* Step 3 should result in a properly formatted JSON response
* Step 4 should result in an error with the following message:
```
Error: No such volume: fakeVolume
```
# Possible Problems:
None

View File

@@ -0,0 +1,35 @@
# 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 1-20 - Docker Volume Inspect
Resource ../../resources/Util.robot
Suite Setup Run Keywords Conditional Install VIC Appliance To Test Server Remove All Volumes
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Simple docker volume inspect
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name test
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume inspect test
Should Be Equal As Integers ${rc} 0
${output}= Evaluate json.loads(r'''${output}''') json
${id}= Get From Dictionary ${output[0]} Name
Should Be Equal As Strings ${id} test
Docker volume inspect invalid object
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume inspect fakeVolume
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error: No such volume: fakeVolume

View File

@@ -0,0 +1,48 @@
Test 1-21 - Docker Volume LS
=======
# Purpose:
To verify that docker volume ls command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/volume_ls/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker volume create --name=testVol
3. Issue docker volume ls
4. Issue docker volume ls -q
5. Issue docker volume ls -f bogusfilter=test
6. Issue docker create --name=danglingVol
7. Issue docker create -v testVol:/test busybox
8. Issue docker volume ls -f dangling=true
9. Issue docker volume ls -f dangling=false
10. Issue docker volume ls -f name=dang
11. Issue docker volume ls -f driver=vsphere
12. Issue docker volume ls -f driver=vsph
13. Issue docker volume create --name=labelVol --label=labeled
14. Issue docker volume ls -f label=labeled
15. Issue docker volume ls -f dangling=true -f name=dang
16. Issue docker volume ls -f dangling=false -f name=dang
# Expected Outcome:
* Step 3 should result in each volume being listed with both driver and volume name
* Step 4 should result in each volume being listed with only the volume name being listed
* Step 5 should result in the following error:
```
Error response from daemon: Invalid filter 'bogusfilter'
```
* Step 8 should result in only danglingVol being listed
* Step 9 should result in only testVol being listed
* Step 10 should result in only danglingVol being listed
* Step 11 should result in danglingVol and testVol being listed
* Step 12 should result in no volumes being listed
* Step 14 should result in only labelVol being listed
* Step 15 should result in only danglingVol being listed
* Step 16 should result in no volumes being listed
# Possible Problems:
* VIC requires you to specify storage on creation of the VCH that volumes can be created from, so when installing the VCH make sure to specify this parameter: --volume-store=

View File

@@ -0,0 +1,97 @@
# 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 1-21 - Docker Volume LS
Resource ../../resources/Util.robot
Suite Setup Run Keywords Conditional Install VIC Appliance To Test Server Remove All Volumes
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Simple volume ls
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=testVol
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} testVol
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Be Equal As Integers ${rc} 0
Should Contain ${output} vsphere
Should Contain ${output} testVol
Should Contain ${output} DRIVER
Should Contain ${output} VOLUME NAME
Volume ls quiet
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -q
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} vsphere
Should Contain ${output} testVol
Should Not Contain ${output} DRIVER
Should Not Contain ${output} VOLUME NAME
Volume ls invalid filter
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -f bogusfilter=test
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: Invalid filter 'bogusfilter'
Volume ls filter by dangling
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=danglingVol
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v testVol:/test busybox
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -f dangling=true
Should Be Equal As Integers ${rc} 0
Should Contain ${output} danglingVol
Should Not Contain ${output} testVol
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -f dangling=false
Should Be Equal As Integers ${rc} 0
Should Contain ${output} testVol
Should Not Contain ${output} danglingVol
Volume ls filter by name
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -f name=dang
Should Be Equal As Integers ${rc} 0
Should Contain ${output} danglingVol
Should Not Contain ${output} testVol
Volume ls filter by driver
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -f driver=vsphere
Should Be Equal As Integers ${rc} 0
Should Contain ${output} danglingVol
Should Contain ${output} testVol
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -f driver=vsph
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} danglingVol
Should Not Contain ${output} testVol
Volume ls filter by label
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=labelVol --label=labeled
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -f label=labeled
Should Be Equal As Integers ${rc} 0
Should Contain ${output} labelVol
Should Not Contain ${output} danglingVol
Should Not Contain ${output} testVol
Volume ls multiple filters
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -f dangling=true -f name=dang
Should Be Equal As Integers ${rc} 0
Should Contain ${output} danglingVol
Should Not Contain ${output} testVol
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls -f dangling=false -f name=dang
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} danglingVol
Should Not Contain ${output} testVol

View File

@@ -0,0 +1,37 @@
Test 1-22 - Docker Volume RM
=======
# Purpose:
To verify that docker volume rm command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/volume_rm/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker volume create --name=test to the VIC appliance
3. Issue docker volume create --name=test2 to the VIC appliance
4. Issue docker volume rm test to the VIC appliance
5. Issue docker create -v test2:/test busybox to the VIC appliance
6. Issue docker volume rm test2 to the VIC appliance
7. Issue docker volume rm test3 to the VIC appliance
8. Issue docker rm <containerID from Step 5> to the VIC appliance
9. Issue docker volume rm test2 to the VIC appliance
# Expected Outcome:
* Step 4 should result in success and the volume should not be listed anymore
* Step 6 should result in error with the following message:
```
Error response from daemon: Conflict: remove test2: volume is in use - [<containerID>]
```
* Step 7 should result in error with the following message:
```
Error response from daemon: get test3: no such volume
```
* Step 9 should result in success and the volume should no longer be listed
# Possible Problems:
* VIC requires you to specify storage on creation of the VCH that volumes can be created from, so when installing the VCH make sure to specify this parameter: --volume-store=

View File

@@ -0,0 +1,63 @@
# 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 1-22 - Docker Volume RM
Resource ../../resources/Util.robot
Suite Setup Run Keywords Conditional Install VIC Appliance To Test Server Remove All Volumes
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Simple volume rm
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} test
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test2
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} test2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume rm test2
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} test2
Volume rm when in use
${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} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v test:/test ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume rm test
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: volume test in use by
Volume rm invalid volume
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume rm test3
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error response from daemon: Get test3: no such volume
Volume rm freed up volume
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=test4
Should Be Equal As Integers ${rc} 0
Should Be Equal As Strings ${output} test4
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create -v test4:/test4 ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm ${containerID}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume rm test4
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} test4

View File

@@ -0,0 +1,61 @@
Test 1-23 - Docker Inspect
=======
# Purpose:
To verify that docker inspect command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/inspect/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker pull busybox to the VIC appliance
3. Issue docker inspect busybox to the VIC appliance
4. Issue docker inspect --type=image busybox to the VIC appliance
5. Issue docker inspect --type=container busybox to the VIC appliance
6. Issue docker create busybox to the VIC appliance
7. Issue docker inspect <containerID> to the VIC appliance
8. Issue docker inspect --type=container <containerID> to the VIC appliance
9. Issue docker inspect <containerID> to the VIC appliance and verify the Cmd and Image fields
10. Issue docker inspect --type=image <containerID> to the VIC appliance
11. Issue docker network create net-one
12. Issue docker network create net-two
13. Issue docker create --network net-one --name two-net-test busybox
14. Issue docker network connect net-two two-net-test
15. Issue docker start two-net-test
16. Issue docker inspect -f '{{range $key, $value := .NetworkSettings.Networks}}{{$key}}{{end}}' two-net-test
17. Issue docker inspect fake to the VIC appliance
18. Issue docker create -v /var/lib/test busybox
19. Issue docker inspect -f {{.Config.Volumes}} <containerID>
20. Issue docker inspect test-with-volume | jq '.[]|.["Config"]|.["Volumes"]|keys[0]' and docker volume ls
21. Issue docker inspect busybox -f '{{.RepoDigest}}'
22. Issue docker inspect on container with both an anonymous and named volume bound to mount points
23. Issue docker inspect container status across container lifecycle (created, running, exited)
# Expected Outcome:
* Step 3,4,7,8 should result in success and a properly formatted JSON response
* Step 5 should result in an error with the following message:
```
Error: No such container: busybox
```
* Step 9 should result in success with the correct values in the Cmd and Image fields
* Step 10 should result in an error with the following message:
```
Error: No such image: <containerID>
```
* Step 16 should result in two networks listed in the inspect data
* Step 17 should result in an error with the following message:
```
Error: No such image or container: fake
```
* Step 19 should result in the map returned containing /var/lib/test
* Step 20 should find matching volume ID matching in docker inspect in volume ls
* Step 21 should result in a valid digest, previously cached
* Step 22 should result in valid Mounts data
* Step 23 should result in correct container status values (created, running, exited)
# Possible Problems:
None

View File

@@ -0,0 +1,157 @@
# 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 1-23 - Docker Inspect
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Get container inspect status
[Arguments] ${container}
${rc} ${status}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${container} -f '{{.State.Status}}'
Should Be Equal As Integers ${rc} 0
[Return] ${status}
*** Test Cases ***
Simple docker inspect of image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${busybox}
Should Be Equal As Integers ${rc} 0
${output}= Evaluate json.loads(r'''${output}''') json
${id}= Get From Dictionary ${output[0]} Id
Docker inspect image specifying type
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect --type=image ${busybox}
Should Be Equal As Integers ${rc} 0
${output}= Evaluate json.loads(r'''${output}''') json
${id}= Get From Dictionary ${output[0]} Id
Docker inspect image specifying incorrect type
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect --type=container ${busybox}
Should Be Equal As Integers ${rc} 1
${out}= Run Keyword If '${busybox}' == 'busybox' Should Contain ${output} Error: No such container: busybox
${out}= Run Keyword Unless '${busybox}' == 'busybox' Should Contain ${output} Error: No such container: wdc-harbor-ci.eng.vmware.com/default-project/busybox
Simple docker inspect of container
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${container}
Should Be Equal As Integers ${rc} 0
${output}= Evaluate json.loads(r'''${output}''') json
${id}= Get From Dictionary ${output[0]} Id
Docker inspect container specifying type
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect --type=container ${container}
Should Be Equal As Integers ${rc} 0
${output}= Evaluate json.loads(r'''${output}''') json
${id}= Get From Dictionary ${output[0]} Id
Docker inspect container check cmd and image name
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/bash
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect ${container}
Should Be Equal As Integers ${rc} 0
${output}= Evaluate json.loads(r'''${output}''') json
${config}= Get From Dictionary ${output[0]} Config
${image}= Get From Dictionary ${config} Image
Should Contain ${image} busybox
${cmd}= Get From Dictionary ${config} Cmd
Should Be Equal As Strings ${cmd} [u'/bin/bash']
Docker inspect container specifying incorrect type
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect --type=image ${container}
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error: No such image: ${container}
Docker inspect container with multiple networks
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} network create net-one
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} network create net-two
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name=two-net-test --net=net-one busybox
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} network connect net-two two-net-test
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} start two-net-test
Should Be Equal As Integers ${rc} 0
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{range $key, $value := .NetworkSettings.Networks}}{{$key}}{{end}}' two-net-test
Should Contain ${out} net-two
Should Contain ${out} net-one
Should Be Equal As Integers ${rc} 0
Docker inspect invalid object
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect fake
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Error: No such object: fake
Docker inspect non-nil volume
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name=test-with-volume -v /var/lib/test busybox
Should Be Equal As Integers ${rc} 0
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{.Config.Volumes}}' test-with-volume
Should Be Equal As Integers ${rc} 0
Should Contain ${out} /var/lib/test
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect test-with-volume | jq '.[]|.["Config"]|.["Volumes"]|keys[0]'
Should Be Equal As Integers ${rc} 0
${mount}= Split String ${out} :
${volID}= Get Substring @{mount}[0] 1
Log To Console Find volume ${volID} in container inspect
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} volume ls
Should Be Equal As Integers ${rc} 0
Should Contain ${out} ${volID}
Inspect RepoDigest is valid
${rc} Run And Return Rc docker %{VCH-PARAMS} rmi ${busybox}
${rc} ${busybox_digest}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox} | grep Digest | awk '{print $2}'
Should Be Equal As Integers ${rc} 0
Should Not Be Empty ${busybox_digest}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{.RepoDigests}}' ${busybox}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ${busybox_digest}
Docker inspect mount data
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create --name=named-volume
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name=mount-data-test -v /mnt/test -v named-volume:/mnt/named busybox
Should Be Equal As Integers ${rc} 0
${rc} ${out}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{.Mounts}}' mount-data-test
Should Be Equal As Integers ${rc} 0
Should Contain ${out} /mnt/test
Should Contain ${out} /mnt/named
Docker inspect container status
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} create ${busybox} /bin/sh -c 'a=0; while [ $a -lt 90 ]; do echo "line $a"; a=`expr $a + 1`; sleep 2; done;'
Should Be Equal As Integers ${rc} 0
# keyword at top of file
${created}= Get container inspect status ${container}
Should Contain ${created} created
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${container}
Should Be Equal As Integers ${rc} 0
# keyword at top of file
${running}= Get container inspect status ${container}
Should Contain ${running} running
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} stop ${container}
Should Be Equal As Integers ${rc} 0
# keyword at top of file
${stopped}= Get container inspect status ${container}
Should Contain ${stopped} exited

View File

@@ -0,0 +1,28 @@
Test 1-24 - Docker Link
=======
# Purpose:
To verify that docker --link/--net-alias commands are supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/run/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker network create jedi
3. Issue docker pull busybox
4. Issue docker run -it -d --net jedi --name first busybox
5. Issue docker run -it --net jedi busybox ping -c3 first
6. Issue docker run -it --net jedi --link first:1st busybox ping -c3 1st
7. Issue docker run -it -d --net jedi --net-alias 2nd busybox
8. Issue docker run -it --net jedi busybox ping -c3 2nd
# Expected Outcome:
* Every step should result in success
# Possible Problems:
None

View File

@@ -0,0 +1,93 @@
# 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 1-24 - Docker Link
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Link and alias
# link support for container on bridge network only
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd --name foo busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --link foo:bar busybox ping -c1 bar
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create jedi
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${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} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${debian}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -it -d --net jedi --name first busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net jedi debian ping -c1 first
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
# cannot reach first from another network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run debian ping -c1 first
Should Not Be Equal As Integers ${rc} 0
Should contain ${output} unknown host
# the link
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net jedi --link first:1st debian ping -c1 1st
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
# cannot reach first using c1 from another container
# first run a container that has the alias "c1" for the "first" container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd --net jedi --link first:1st busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
# check if we can use alias "c1" from another container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net jedi debian ping -c1 1st
Should Not Be Equal As Integers ${rc} 0
Should contain ${output} unknown host
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -it -d --net jedi --net-alias 2nd busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
# the alias
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net jedi debian ping -c1 2nd
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
# another container with same network alias
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -it -d --net jedi --net-alias 2nd busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net jedi --name lookup busybox nslookup 2nd
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs lookup
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Address 1
Should Contain ${output} Address 2

View File

@@ -0,0 +1,119 @@
Test 1-25 - Docker Port Mapping
=======
# Purpose:
To verify that docker create works with the -p option
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/create/)
# Environment:
This test requires that a vSphere server is running and available
# Test Cases
## Create container with port mappings
1. Deploy VIC appliance to vSphere server
2. Issue `docker create -it -p 10000:80 -p 10001:80 --name webserver nginx`
3. Issue `docker start webserver`
4. Issue `curl vch-ip:10000 --connect-timeout 20`
5. Issue `curl vch-ip:10001 --connect-timeout 20`
6. Issue `docker stop webserver`
7. Issue `curl vch-ip:10000`
8. Issue `curl vch-ip:10001`
### Expected Outcome:
* Steps 2-6 should all return without error
* Steps 7-8 should both return error
## Create container with conflicting port mapping
1. `Issue docker create -it -p 8083:80 --name webserver2 nginx`
2. `Issue docker create -it -p 8083:80 --name webserver3 nginx`
3. `Issue docker start webserver2`
4. `Issue docker start webserver3`
### Expected Outcome:
* Steps 1-3 should all return without error
* Step 4 should return error
## Create container with port range
1. Issue `docker create -it -p 8081-8088:80 --name webserver5 nginx`
### Expected Outcome:
* Step 1 should return error
## Create container with host IP
1. Issue `docker create -it -p 10.10.10.10:8088:80 --name webserver5 nginx`
### Expected Outcome:
* Step 1 should return error
## Create container without specifying host port
1. Issue `docker create -it -p 6379 --name test-redis redis:alpine`
2. Issue `docker start test-redis`
3. Issue `docker stop test-redis`
### Expected Outcome:
* Steps 1-3 should return without error
## Run after exit remapping mapped ports
1. Deploy VIC appliance to vSphere server
2. Issue `docker run -i -p 1900:9999 -p 2200:2222 busybox /bin/top`
3. Issue `q` to the container
4. Issue `docker run -i -p 1900:9999 -p 3300:3333 busybox /bin/top`
5. Issue `q` to the container
### Expected Outcome:
* All steps should return without error
## Remap mapped ports after OOB Stop
1. Deploy VIC appliance to vSphere server
2. Issue `docker create -it -p 10000:80 -p 10001:80 busybox`
3. Issue `docker start <containerID>` to the VIC appliance
4. Power off the container with govc
5. Issue `docker create -it -p 10000:80 -p 20000:2222 busybox`
6. Issue `docker start <containerID>` to the VIC appliance
### Expected Outcome:
* All steps should return without error
## Remap mapped ports after OOB Stop and Remove
1. Issue `docker run -itd -p 5001:80 --name nginx1 nginx`
2. Hit Nginx Endpoint at VCH-IP:5001
3. Power off the container with govc
4. Issue `docker rm nginx1`
5. Issue `docker run -itd -p 5001:80 --name nginx2 nginx`
6. Hit Nginx Endpoint at VCH-IP:5001
### Expected Outcome:
* All steps should return without error
## Container to container traffic via VCH public interface
1. Deploy VIC appliance to vSphere server
2. Issue `docker create -p 8080:80 --net bridge nginx`
3. Issue `docker start <containerID>` to the VIC appliance
4. Issue `docker run busybox /bin/ash -c wget -O index.html <VCH IP>:8085; md5sum index.html`
6. Verify the contents of `index.html`
7. Issue `docker run busybox /bin/ash -c wget -O index.html <server IP>:80; md5sum index.html`
8. Verify the contents of `index.html`
### Expected Outcome:
* All steps should return without error
## Remap mapped port after stop container, and then remove stopped container
1. Issue `docker run -itd -p 6001:80 --name remap1 nginx`
2. Hit Nginx Endpoint at VCH-IP:6001
3. Issue `docker stop remap1`
4. Issue `docker run -itd -p 6001:80 --name remap2 nginx`
5. Issue `docker rm remap1`
6. Hit Nginx Endpoint at VCH-IP:6001
### Expected Outcome:
* All steps should return without error

View File

@@ -0,0 +1,217 @@
# 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 1-25 - Docker Port Map
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Create container with port mappings
${rc} ${output}= Run And Return Rc And Output docker %{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 docker %{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 %{EXT-IP} 10000
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{EXT-IP} 10001
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop webserver
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output curl %{EXT-IP}:10000 --connect-timeout 5
Should Not Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output curl %{EXT-IP}:10001 --connect-timeout 5
Should Not Be Equal As Integers ${rc} 0
Create container with conflicting port mapping
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p 8083:80 --name webserver2 ${nginx}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p 8083:80 --name webserver3 ${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 webserver2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start webserver3
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} port 8083 is not available
Create container with port range
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p 8081-8088:80 --name webserver5 ${nginx}
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} host port ranges are not supported for port bindings
Create container with host ip
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p 10.10.10.10:8088:80 --name webserver5 ${nginx}
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} host IP for port bindings is only supported for 0.0.0.0 and the public interface IP address
Create container with host ip equal to 0.0.0.0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p 0.0.0.0:8088:80 --name webserver5 ${nginx}
Should Be Equal As Integers ${rc} 0
Create container with host ip equal to public IP
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p %{EXT-IP}:8089:80 --name webserver6 ${nginx}
Should Be Equal As Integers ${rc} 0
Create container without specifying host port
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p 6379 --name test-redis redis:alpine
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start test-redis
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop test-redis
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Run after exit remapping mapped ports
Pass Execution Disabled until we can figure out how to do attach in Robot tests
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f $(docker %{VCH-PARAMS} ps -aq)
${rc} ${output}= Run And Return Rc And Output mkfifo /tmp/fifo1
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -id --name ctr1 -p 1900:9999 -p 2200:2222 busybox /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} attach ctr1 < /tmp/fifo1
Should Be Equal As Integers ${rc} 0
Sleep 5
${rc} ${output}= Run And Return Rc And Output echo q > /tmp/fifo1
${result}= Wait for process sh1
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Log ${output}
Should Not Contain ${output} Running
${rc} ${output}= Run And Return Rc And Output mkfifo /tmp/fifo2
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -id --name ctr2 -p 1900:9999 -p 3300:3333 busybox /bin/top
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} attach ctr2 < /tmp/fifo2
Should Be Equal As Integers ${rc} 0
Sleep 5
${rc} ${output}= Run And Return Rc And Output echo q > /tmp/fifo2
${result}= Wait for process sh2
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -a
Log ${output}
Should Not Contain ${output} Running
Remap mapped ports after OOB Stop
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f $(docker %{VCH-PARAMS} ps -aq)
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p 10000:80 -p 10001:80 --name ctr3 busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ctr3
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Power Off VM OOB ctr3*
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -it -p 10000:80 -p 20000:22222 --name ctr4 busybox
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ctr4
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Remap mapped ports after OOB Stop and Remove
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f $(docker %{VCH-PARAMS} ps -aq)
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd -p 5001:80 --name nginx1 ${nginx}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{VCH-IP} 5001
Power Off VM OOB nginx1*
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm nginx1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd -p 5001:80 --name nginx2 ${nginx}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{VCH-IP} 5001
Container to container traffic via VCH public interface
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f $(docker %{VCH-PARAMS} ps -aq)
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${nginx}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox
Should Be Equal As Integers ${rc} 0
${rc} ${containerID}= Run And Return Rc And Output docker %{VCH-PARAMS} create --net bridge -p 8085:80 ${nginx}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${containerID}
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Sleep 10
${rc} ${ip}= Run And Return Rc And Output docker %{VCH-PARAMS} network inspect bridge | jq '.[0].Containers."${containerID}".IPv4Address'
${ip}= Split String ${ip} /
${nginx-ip}= Set Variable @{ip}[0]
${nginx-ip}= Strip String ${nginx-ip} characters="
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name anjunabeats busybox /bin/ash -c "wget -O index.html %{EXT-IP}:8085; md5sum index.html"
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
# Verify hash of nginx default index.html
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs anjunabeats
Log ${output}
Should Contain ${output} e3eb0a1df437f3f97a64aca5952c8ea0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name abgt250 busybox /bin/ash -c "wget -O index.html ${nginx-ip}:80; md5sum index.html"
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
# Verify hash of nginx default index.html
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs abgt250
Log ${output}
Should Contain ${output} e3eb0a1df437f3f97a64aca5952c8ea0
Remap mapped port after stop container, and then remove stopped container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f $(docker %{VCH-PARAMS} ps -aq)
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd -p 6001:80 --name remap1 ${nginx}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{VCH-IP} 6001
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop remap1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -itd -p 6001:80 --name remap2 ${nginx}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{VCH-IP} 6001
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm remap1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Wait Until Keyword Succeeds 20x 5 seconds Hit Nginx Endpoint %{VCH-IP} 6001

View File

@@ -0,0 +1,21 @@
Test 1-26 - Docker Hello World
=======
# Purpose:
To verify that VIC appliance can work with the most basic docker demonstration
# References:
[1 - Docker Hello World](https://hub.docker.com/_/hello-world/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker run hello-world to the new VIC appliance
# Expected Outcome:
* The command should successfully return the hello world message from docker
# Possible Problems:
None

View File

@@ -0,0 +1,33 @@
# 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 1-26 - Docker Hello World
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Hello world
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run hello-world
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} https://docs.docker.com/engine/userguide/
Hello world with -t
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -t hello-world
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} https://docs.docker.com/engine/userguide/

View File

@@ -0,0 +1,29 @@
Test 1-27 - Docker Login
=======
# Purpose:
To verify that VIC appliance can log into registries and pull private and public images
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/login/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker pull private image on docker.io
3. Issue docker pull public image on docker.io
4. Issue docker login on docker.io with invalid credentials
5. Issue docker login on docker.io with valid credentials
6. Issue docker pull private image on docker.io
7. Issue docker logout on docker.io
# Expected Outcome:
* Step 2 should result in an error without login
* Step 4 should result in an error of invalid credentials
* Step 3, 5-7 should each succeed
# Possible Problems:
Test will fail if docker account victest is disabled, or if connection to docker.io cannot be
established.

View File

@@ -0,0 +1,38 @@
# 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 1-27 - Docker Login
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Docker login and pull from docker.io
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull victest/busybox
Should Be Equal As Integers ${rc} 1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull victest/public-hello-world
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} login --username=victest --password=incorrectPassword
Should Contain ${output} incorrect username or password
Should Be Equal As Integers ${rc} 1
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} login --username=victest --password=%{REGISTRY_PASSWORD}
Should Contain ${output} Login Succeeded
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull victest/busybox
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logout
Should Be Equal As Integers ${rc} 0

View File

@@ -0,0 +1,24 @@
Test 1-28 - Docker Secret
=======
# Purpose:
To verify that VIC appliance responds appropriately to docker secrets APIs.
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/secret/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker secret ls
3. Issue docker secret create
4. Issue docker secret inspect
5. Issue docker secret rm
# Expected Outcome:
* Step 2-5 should result in an error of not supported
# Possible Problems:
None

View File

@@ -0,0 +1,46 @@
# 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 1-28 - Docker Secret
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Variables ***
${fake-secret} test
*** Test Cases ***
Docker secret ls
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} secret ls
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker secret create
Run echo '${fake-secret}' > secret.file
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} secret create mysecret ./secret.file
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker secret inspect
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} secret inspect my_secret
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker secret rm
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} secret rm my_secret
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported

View File

@@ -0,0 +1,23 @@
Test 1-29 - Docker Checkpoint
=======
# Purpose:
To verify that VIC appliance responds appropriately to docker checkpoint APIs
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/checkpoint/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker checkpoint create
3. Issue docker checkpoint ls
4. Issue docker checkpoint rm
# Expected Outcome:
* Step 2-4 should result in an error of not supported
# Possible Problems:
None

View File

@@ -0,0 +1,40 @@
# 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 1-29 - Docker Checkpoint
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Docker checkpoint create
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} create --name=test-busybox ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} checkpoint create test-busybox new-checkpoint
Should Be Equal As Integers ${rc} 1
Should Contain ${output} vSphere Integrated Containers does not yet implement checkpointing
Docker checkpoint ls
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} checkpoint ls test-busybox
Should Be Equal As Integers ${rc} 1
Should Contain ${output} vSphere Integrated Containers does not yet implement checkpointing
Docker checkpoint rm
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} checkpoint rm test-busybox new-checkpoint
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such container

View File

@@ -0,0 +1,21 @@
Test 1-30 - Docker Deploy
=======
# Purpose:
To verify that VIC appliance responds appropriately to docker deploy APIs
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/deploy/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker deploy
# Expected Outcome:
* Step 2 should result in an error of not supported
# Possible Problems:
None

View File

@@ -0,0 +1,27 @@
# 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 1-30 - Docker Deploy
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Docker deploy
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} deploy %{GOPATH}/src/github.com/vmware/vic/demos/compose/voting-app/votingapp.dab
Should Be Equal As Integers ${rc} 1
Should Contain ${output} only supported with experimental daemon

View File

@@ -0,0 +1,28 @@
Test 1-31 - Docker Node
=======
# Purpose:
To verify that VIC appliance responds appropriately to docker node APIs
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/node/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker node demote
3. Issue docker node ls
4. Issue docker node promote
5. Issue docker node rm
6. Issue docker node update
7. Issue docker node ps
8. Issue docker node inspect
# Expected Outcome:
* Step 2-6 should result in an error that contains Docker Swarm is not yet supported
* Step 7-8 should result in an error that contains No such node
# Possible Problems:
None

View File

@@ -0,0 +1,57 @@
# 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 1-31 - Docker Node
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Docker node demote
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} node demote self
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such node: self
Docker node ls
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} node ls
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker node promote
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} node promote self
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such node: self
Docker node rm
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} node rm self
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker node update
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} node update self
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such node: self
Docker node ps
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} node ps
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such node
Docker node inspect
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} node inspect self
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such node

View File

@@ -0,0 +1,29 @@
Test 1-32 - Docker Plugin
=======
# Purpose:
To verify that VIC appliance responds appropriately to docker plugin APIs
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/plugin_create/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker plugin install
3. Issue docker plugin create
4. Issue docker plugin enable
5. Issue docker plugin disable
6. Issue docker plugin inspect
7. Issue docker plugin ls
8. Issue docker plugin push
9. Issue docker plugin rm
10. Issue docker plugin set
# Expected Outcome:
* Step 2-10 should result in an error that contains does not yet support plugins
# Possible Problems:
None

View File

@@ -0,0 +1,66 @@
# 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 1-32 - Docker plugin
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Docker plugin install
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} plugin install vieux/sshfs
Should Be Equal As Integers ${rc} 1
Should Contain ${output} does not yet implement plugins
Docker plugin create
Run echo '{}' > config.json
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} plugin create test-plugin .
Should Be Equal As Integers ${rc} 1
Should Contain ${output} does not yet implement plugins
Docker plugin enable
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} plugin enable test-plugin
Should Be Equal As Integers ${rc} 1
Should Contain ${output} does not yet implement plugins
Docker plugin disable
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} plugin disable test-plugin
Should Be Equal As Integers ${rc} 1
Should Contain ${output} does not yet implement plugins
Docker plugin inspect
${status}= Get State Of Github Issue 4464
Run Keyword If '${status}' == 'closed' Fail Test 1-32-Docker-Plugin.robot needs to be updated now that Issue #4464 has been resolved
Docker plugin ls
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} plugin ls
Should Be Equal As Integers ${rc} 1
Should Contain ${output} does not yet implement plugins
Docker plugin push
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} plugin push test-plugin
Should Be Equal As Integers ${rc} 1
Should Contain ${output} does not yet implement plugins
Docker plugin rm
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} plugin rm test-plugin
Should Be Equal As Integers ${rc} 1
Should Contain ${output} does not yet implement plugins
Docker plugin set
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} plugin set test-plugin test-data
Should Be Equal As Integers ${rc} 1
Should Contain ${output} does not yet implement plugins

View File

@@ -0,0 +1,29 @@
Test 1-33 - Docker Service
=======
# Purpose:
To verify that VIC appliance responds appropriately to docker service APIs
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/service/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker service create
3. Issue docker service inspect
4. Issue docker service ls
5. Issue docker service ps
6. Issue docker service rm
7. Issue docker service scale
8. Issue docker service update
9. Issue docker service logs
# Expected Outcome:
* Step 2-8 should result in an error that contains Docker Swarm is not yet supported
* Step 9 should result in an error that contains only supported with experimental daemon
# Possible Problems:
None

View File

@@ -0,0 +1,57 @@
# 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 1-33 - Docker Service
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Docker service create
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} service create test-service
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker service ls
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} service ls
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker service ps
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} service ps test-service
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such service: test-service
Docker serivce rm
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} service rm test-service
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker service scale
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} service scale test-service=3
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such service: test-service
Docker service update
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} service update test-service
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such service: test-service
Docker service logs
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} service logs test
Should Be Equal As Integers ${rc} 1
Should Contain ${output} only supported with experimental daemon

View File

@@ -0,0 +1,25 @@
Test 1-34 - Docker Node
=======
# Purpose:
To verify that VIC appliance responds appropriately to docker stack APIs
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/stack/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker stack deploy
3. Issue docker stack ls
4. Issue docker stack ps
5. Issue docker stack rm
6. Issue docker stack services
# Expected Outcome:
* Step 2-6 should result in an error that contains Docker Swarm is not yet supported
# Possible Problems:
None

View File

@@ -0,0 +1,48 @@
# 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 1-34 - Docker Stack
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
#Docker stack deploy
#${rc} ${output}= Run And Return Rc And Output wget #https://raw.githubusercontent.com/vfarcic/docker-flow-proxy/master/docker-compose-stack.yml
#Should Be Equal As Integers ${rc} 0
#${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} stack deploy -c #./docker-compose-stack.yml proxy
#Should Be Equal As Integers ${rc} 1
#Should Contain ${output} Docker Swarm is not yet supported
Docker stack ls
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} stack ls
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker stack ps
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} stack ps test-stack
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker stack rm
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} stack rm test-stack
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker stack services
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} stack services test-stack
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported

View File

@@ -0,0 +1,27 @@
Test 1-35 - Docker Swarm
=======
# Purpose:
To verify that VIC appliance responds appropriately to docker swarm APIs
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/node/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker swarm init
3. Issue docker swarm join
4. Issue docker swarm join-token
5. Issue docker swarm leave
6. Issue docker swarm unlock
7. Issue docker swarm unlock-key
8. Issue docker swarm update
# Expected Outcome:
* Step 2-8 should result in an error that contains Docker Swarm is not yet supported
# Possible Problems:
None

View File

@@ -0,0 +1,55 @@
# 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 1-35 - Docker Swarm
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Docker swarm init
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} swarm init
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker swarm join
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} swarm join 127.0.0.1:2375
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker swarm join-token
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} swarm join-token worker
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} swarm join-token manager
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker swarm leave
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} swarm leave
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker swarm unlock-key
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} swarm unlock-key
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported
Docker swarm update
${rc} ${output}= Run And Return Rc And Output docker1.13 %{VCH-PARAMS} swarm update --autolock
Should Be Equal As Integers ${rc} 1
Should Contain ${output} Docker Swarm is not yet supported

View File

@@ -0,0 +1,79 @@
Test 1-36 - Docker Rename
=======
# Purpose:
To verify that the docker rename command is supported by VIC appliance.
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/rename)
# Environment:
This test requires that a vSphere server is running and available.
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker rename foo bar
3. Issue docker pull busybox
4. Issue docker create --name cont1-name1 busybox
5. Issue docker rename cont1-name1 cont1-name2
6. Verify that the container was renamed by checking ps, inspect and govc vm.info
7. Issue docker run -dit --name cont2-name1 busybox
8. Issue docker rename cont2-name1 cont2-name2
9. Verify that the container was renamed by checking ps, inspect and govc vm.info
10. Issue docker run -dit --name cont3-name1 busybox
11. Issue docker stop cont3-name1
12. Issue docker rename cont3-name1 cont3-name2
13. Issue docker start cont3-name2
14. Verify that the container was renamed by checking ps, inspect and govc vm.info
15. Issue docker create --name cont4 busybox
16. Issue docker rename cont4 ""
17. Issue docker create --name cont5 busybox
18. Issue docker create --name cont6 busybox
19. Issue docker rename cont5 cont5
20. Issue docker rename cont5 cont6
21. Issue docker create --name cont7-name1 busybox
22. Issue docker rename cont7-name1 cont7-name2
23. Issue docker start cont7-name1
24. Issue docker run --link cont7-name2:cont7alias busybox ping -c2 cont7alias
25. Issue docker run busybox ping -c2 cont7-name2
26. Issue docker run -dit --name cont8-name1 busybox
27. Issue docker rename cont8-name1 cont8-name2
28. Issue docker stop cont8-name2
29. Issue docker start cont7-name2
30. Issue docker run --link cont8-name2:cont8alias busybox ping -c2 cont8alias
31. Issue docker run busybox ping -c2 cont8-name2
32. Issue docker run -dit --name cont9-name1 busybox
33. Issue docker rename cont9-name1 cont9-name2
34. Issue docker run --link cont9-name2:cont9alias busybox ping -c2 cont9alias
35. Issue docker run busybox ping -c2 cont9-name2
# Expected Outcome:
* Step 2 should result in an error with the following message:
```
Error: No such container: foo
```
* Steps 3-15 should return without errors
* Step 16 should result in an error containing the following message:
```
Neither old nor new names may be empty
```
* Steps 17 and 18 should return without errors
* Step 19 and 20 should return with errors
* Steps 21-23 should return without errors
* Steps 24 and 25 should succeed and their output should contain:
```
2 packets transmitted, 2 packets received
```
* Steps 25-29 should return without errors
* Steps 30 and 31 should succeed and their output should contain:
```
2 packets transmitted, 2 packets received
```
* Steps 32 and 33 should return without errors
* Steps 34 and 35 should succeed and their output should contain:
```
2 packets transmitted, 2 packets received
```
# Possible Problems:
None

View File

@@ -0,0 +1,138 @@
# 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 1-36 - Docker Rename
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Rename a non-existent container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename foo bar
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} No such container: foo
Rename a created container
${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 cont1-name1 ${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 cont1-name1 cont1-name2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Verify Container Rename cont1-name1 cont1-name2 ${contID}
Rename a running container
${rc} ${contID}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit --name cont2-name1 ${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 cont2-name1 cont2-name2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Verify Container Rename cont2-name1 cont2-name2 ${contID}
Rename a stopped container
${rc} ${contID}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit --name cont3-name1 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${contID} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop cont3-name1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename cont3-name1 cont3-name2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start cont3-name2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Verify Container Rename cont3-name1 cont3-name2 ${contID}
Rename a container with an empty name
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name cont4 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename cont4 ""
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} Neither old nor new names may be empty
Rename a container with a claimed name
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name cont5 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name cont6 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename cont5 cont5
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename cont5 cont6
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} Error
Name resolution for a created container after renaming+starting it
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name cont7-name1 ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename cont7-name1 cont7-name2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start cont7-name2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --link cont7-name2:cont7alias ${busybox} ping -c2 cont7alias
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 2 packets received
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${busybox} ping -c2 cont7-name2
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 2 packets received
Name resolution for a running container after renaming+restarting it
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit --name cont8-name1 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename cont8-name1 cont8-name2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop cont8-name2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} start cont8-name2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --link cont8-name2:cont8alias ${busybox} ping -c2 cont8alias
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 2 packets received
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run ${busybox} ping -c2 cont8-name2
Should Be Equal As Integers ${rc} 0
Should Contain ${output} 2 packets transmitted, 2 packets received
Name resolution for a running container after renaming it
${status}= Get State Of Github Issue 4375
Run Keyword If '${status}' == 'closed' Fail Test 1-35-Docker-Rename needs to be updated now that #4375 is closed
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit --name cont9-name1 busybox
# Should Be Equal As Integers ${rc} 0
# Should Not Contain ${output} Error
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rename cont9-name1 cont9-name2
# Should Be Equal As Integers ${rc} 0
# Should Not Contain ${output} Error
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --link cont9-name2:cont9alias busybox ping -c2 cont9alias
# Should Be Equal As Integers ${rc} 0
# Should Contain ${output} 2 packets transmitted, 2 packets received
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run busybox ping -c2 cont9-name2
# Should Be Equal As Integers ${rc} 0
# Should Contain ${output} 2 packets transmitted, 2 packets received

View File

@@ -0,0 +1,34 @@
Test 1-37 - Docker USER
=======
# Purpose:
To ensure that `docker run -u` and `USER` inside of a Dockerfile are respected on VIC.
# References:
[1 - Dockerfile Reference -- USER directive]( https://docs.docker.com/engine/reference/builder/#user )
[2 - Docker command line reference (run options; look for --user)](https://docs.docker.com/engine/reference/commandline/run/#options)
# Environment:
This test requires that a vSphere server is running and available
It also expects 3 Docker images exist, built from the Dockerfiles in vic/tests/resources/dockerfiles and published to a Docker image repository reachable by the machine running tests.
# Test Steps:
1. Run a container that was built with a `USER` directive using a user created with `RUN adduser`
2. Run a container that specifies the user should have UID 2000 and doesn't specify GID
3. Run a container that does not specify a user and set it manually with `docker run -u`
4. Run a container that specifies UID 2000 and GID 2000
5. Run a container that does not specify a user or group but set them manually with `docker run -u`
6. Try to run a container with `-u` specifying a nonexistent user
7. Try to run a container with `-u` specifying a nonexistent group
8. Run a container specifying `-u 0:0`
# Expected Outcome:
1-5 should run successfully with the options specified taking effect inside the container and reflected via `id` or `whoami` output
6 & 7 will fail with exit code 125 and an error message
8 will run successfully and `whoami` will report the user `root`
# Possible Problems:
Docker image repository downtime or unreachability will cause failure on the tests that pull images from Docker Hub

View File

@@ -0,0 +1,61 @@
# 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 1-37 - Docker Run As USER
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Run Image Specifying NewUser in NewGroup
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run gigawhitlocks/1-37-docker-user-newuser-newgroup:latest
Should Be Equal As Integers ${rc} 0
Should Match Regexp ${output} uid=\\d+\\\(newuser\\\)\\s+gid=\\d+\\\(newuser\\\)\\s+groups=\\d+\\\(newuser\\\)
Run Image Specifying UID 2000
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run gigawhitlocks/1-37-docker-user-uid-2000:latest
Should Be Equal As Integers ${rc} 0
Should Contain ${output} uid=2000 gid=0(root)
Run Specifying UID 2000 With -u
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -u 2000 busybox id
Should Be Equal As Integers ${rc} 0
Should Contain ${output} uid=2000 gid=0(root)
Run Image Specifying UID:GID 2000:2000
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run gigawhitlocks/1-37-docker-user-uid-gid-2000-2000:latest
Should Be Equal As Integers ${rc} 0
Should Contain ${output} uid=2000 gid=2000
Run Specifying UID:GID 2000:2000 With -u
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -u 2000:2000 busybox id
Should Be Equal As Integers ${rc} 0
Should Contain ${output} uid=2000 gid=2000
Run as Nonexistent User With -u
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -u nonexistent busybox whoami
Should Be Equal As Integers ${rc} 125
Should Contain ${output} Unable to find user nonexistent
Run as Root with Nonexistent User With -u
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -u root:nonexistent busybox whoami
Should Be Equal As Integers ${rc} 125
Should Contain ${output} Unable to find group nonexistent
Run as uid 0 group 0 With -u
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -u 0:0 busybox whoami
Should Be Equal As Integers ${rc} 0
Should Contain ${output} root

View File

@@ -0,0 +1,27 @@
Test 1-38 - Docker Exec
=======
# Purpose:
To verify that docker exec command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/exec/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker run -d busybox /bin/top
3. Issue docker exec <containerID> /bin/echo ID - 5 times with incrementing ID
4. Issue docker exec -i <containerID> /bin/echo ID - 5 times with incrementing ID
5. Issue docker exec -t <containerID> /bin/echo ID - 5 times with incrementing ID
6. Issue docker exec -it <containerID> /bin/echo ID - 5 times with incrementing ID
7. Issue docker exec -it <containerID> NON_EXISTING_COMMAND
# Expected Outcome:
* Step 2-6 should echo the ID given
* Step 7 should return an error
# Possible Problems:
None

View File

@@ -0,0 +1,148 @@
# 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 1-38 - Docker Exec
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Exec -d
${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} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top -d 600
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec -d ${id} /bin/touch tmp/force
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec ${id} /bin/ls -al /tmp/force
Should Be Equal As Integers ${rc} 0
Should Contain ${output} force
Exec Echo
${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} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top -d 600
Should Be Equal As Integers ${rc} 0
:FOR ${idx} IN RANGE 0 5
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec ${id} /bin/echo "Help me, Obi-Wan Kenobi. You're my only hope."
\ Should Be Equal As Integers ${rc} 0
\ Should Be Equal As Strings ${output} Help me, Obi-Wan Kenobi. You're my only hope.
Exec Echo -i
${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} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top -d 600
Should Be Equal As Integers ${rc} 0
:FOR ${idx} IN RANGE 0 5
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec -i ${id} /bin/echo "Your eyes can deceive you. Don't trust them."
\ Should Be Equal As Integers ${rc} 0
\ Should Be Equal As Strings ${output} Your eyes can deceive you. Don't trust them.
Exec Echo -t
${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} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top -d 600
Should Be Equal As Integers ${rc} 0
:FOR ${idx} IN RANGE 0 5
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec -t ${id} /bin/echo "Do. Or do not. There is no try."
\ Should Be Equal As Integers ${rc} 0
\ Should Be Equal As Strings ${output} Do. Or do not. There is no try.
Exec Sort
${status}= Get State Of Github Issue 5479
Run Keyword If '${status}' == 'closed' Fail Test 1-38-Docker-Exec.robot needs to be updated now that Issue #5479 has been resolved
#${rc} ${tmp}= Run And Return Rc And Output mktemp -d -p /tmp
#Should Be Equal As Integers ${rc} 0
#${fifo}= Catenate SEPARATOR=/ ${tmp} fifo
#${rc} ${output}= Run And Return Rc And Output mkfifo ${fifo}
#Should Be Equal As Integers ${rc} 0
#${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} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d busybox /bin/top -d 600
#Should Be Equal As Integers ${rc} 0
#:FOR ${idx} IN RANGE 0 5
#\ Start Process docker %{VCH-PARAMS} exec ${output} /bin/sort < ${fifo} shell=True alias=custom
#\ Run echo one > ${fifo}
#\ ${ret}= Wait For Process custom
#\ Log ${ret.stderr}
#\ Should Be Empty ${ret.stdout}
#\ Should Be Equal As Integers ${ret.rc} 0
#\ Should Be Empty ${ret.stderr}
#Run rm -rf ${tmp}
Exec Sort -i
${status}= Get State Of Github Issue 5479
Run Keyword If '${status}' == 'closed' Fail Test 1-38-Docker-Exec.robot needs to be updated now that Issue #5479 has been resolved
#${rc} ${tmp}= Run And Return Rc And Output mktemp -d -p /tmp
#Should Be Equal As Integers ${rc} 0
#${fifo}= Catenate SEPARATOR=/ ${tmp} fifo
#${rc} ${output}= Run And Return Rc And Output mkfifo ${fifo}
#Should Be Equal As Integers ${rc} 0
#${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} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d busybox /bin/top -d 600
#Should Be Equal As Integers ${rc} 0
#:FOR ${idx} IN RANGE 0 5
#\ Start Process docker %{VCH-PARAMS} exec -i ${output} /bin/sort < ${fifo} shell=True alias=custom
#\ Run echo one > ${fifo}
#\ ${ret}= Wait For Process custom
#\ Log ${ret.stderr}
#\ Should Be Equal ${ret.stdout} one
#\ Should Be Equal As Integers ${ret.rc} 0
#\ Should Be Empty ${ret.stderr}
#Run rm -rf ${tmp}
Exec NonExisting
${status}= Get State Of Github Issue 5479
Run Keyword If '${status}' == 'closed' Fail Test 1-38-Docker-Exec.robot needs to be updated now that Issue #5479 has been resolved
#${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} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d busybox /bin/top -d 600
#Should Be Equal As Integers ${rc} 0
#:FOR ${idx} IN RANGE 0 5
#\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec ${id} /NonExisting
#\ Should Be Equal As Integers ${rc} 0
#\ Should Contain ${output} no such file or directory
Exec During PowerOff
${status}= Get State Of Github Issue 6744
Run Keyword If '${status}' == 'closed' Fail Test 1-38-Docker-Exec.robot needs to be updated now that Issue #6744 has been resolved
#${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} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d ${busybox} /bin/top
#Should Be Equal As Integers ${rc} 0
#:FOR ${idx} IN RANGE 1 10
#\ Start Process docker %{VCH-PARAMS} exec ${id} /bin/top alias=exec-%{VCH-NAME}-${idx} shell=true
#
#Start Process docker %{VCH-PARAMS} stop ${id} alias=stop-%{VCH-NAME}-${id} shell=true
#${stopResult}= Wait For Process stop-%{VCH-NAME}-${id}
#Should Be Equal As Integers ${stopResult.rc} 0
#
#${combinedoutput}= Set Variable
#
#:FOR ${idx} IN RANGE 1 10
#\ ${result}= Wait For Process exec-%{VCH-NAME}-${idx} timeout=2 mins
#\ ${combinedOutput}= Catenate ${combinedOutput} ${result.stderr}${\n}
#
#Should Contain ${combinedOutput} Cannot complete the operation, container ${id} has been powered off during execution

View File

@@ -0,0 +1,36 @@
Test 1-39 - Docker Stats
=======
# Purpose:
To verify that `docker stats` is supported and works as expected.
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Run a busybox container and create a busybox container
2. Run Stats no-stream for running container
3. Run Stats with no-stream all which will return stats for running and stopped containers
4. Verify the API memory output against govc
5. Verify the API CPU output
6. Run Stats with no-stream for a non-existent container
7. Run Stats with no-stream for a stopped container
8. Verify basic API network and disk output
# Expected Outcome:
1. Fails if two containers are not created
2. Return stats for a running container and validate memory -- will fail if there is a variation
of greater than 5%
3. Return stats for all containers -- will fail if output is missing either container
4. Compare API results vs. govc result for memory accuracy -- will fail if variation greater than 1000 bytes
5. Verify that CPU fields are present - fails if missing
6. Failure with error message
7. Output should include the stopped container short id
8. Fails if either the default network or disk are missing
# Possible Problems:
Stats are created by the ESXi host every 20s -- if there are long pauses between calls
in a single test the results could be incorrect and a failure could occur.

View File

@@ -0,0 +1,133 @@
# 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 1-39 - Docker Stats
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Keywords ***
Get Average Active Memory
[Arguments] ${vm} ${samples}=6
${rc} ${memValues}= Run And Return Rc And Output govc metric.sample -n ${samples} -json ${vm} mem.active.average | jq -r .Sample[].Value[].Value[]
Should Be Equal As Integers ${rc} 0
@{memList}= Split To Lines ${memValues}
:FOR ${mem} IN @{memList}
\ ${num}= Convert To Integer ${mem}
\ ${vmomiMemory}= Set Variable If ${num} > 0 ${num} 0
[Return] ${vmomiMemory}
Create test containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --name stresser ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Set Environment Variable STRESSED ${output}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name stopper ${busybox} /bin/top
Should Be Equal As Integers ${rc} 0
Set Environment Variable STOPPER ${output}
${stress}= Get Container ShortID %{STRESSED}
Set Environment Variable VM-PATH vm/*${stress}
Check Memory Usage
${vmomiMemory}= Get Average Active Memory %{VM-PATH}
Should Be True ${vmomiMemory} > 0
[Return] ${vmomiMemory}
Get Memory From Stats
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stats --no-stream %{STRESSED}
Should Be Equal As Integers ${rc} 0
${output}= Get Line ${output} -1
${short}= Get Container ShortID %{STRESSED}
Should Contain ${output} ${short}
${vals}= Split String ${output}
${vicMemory}= Get From List ${vals} 7
# only care about the integer value of memory usage
${vicMemory}= Fetch From Left ${vicMemory} .
[Return] ${vicMemory}
Check Memory From Stats
${vicMemory}= Get Memory From Stats
Should Be True ${vicMemory} > 0
[Return] ${vicMemory}
*** Test Cases ***
Stats No Stream
Create test containers
${vicMemory}= Wait Until Keyword Succeeds 5x 20s Check Memory From Stats
# get the latest memory value for the "stresser" vm
${vmomiMemory}= Wait Until Keyword Succeeds 5x 20s Check Memory Usage
# convert to percent and move decimal
${percent}= Evaluate ${vmomiMemory}/20480
${diff}= Evaluate abs(${percent}-${vicMemory})
# due to timing we could see some variation, but shouldn't exceed 5%
Should Be True ${diff} < 5
Stats No Stream All Containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stats --no-stream -a
Should Be Equal As Integers ${rc} 0
${stress}= Get Container ShortID %{STRESSED}
${stop}= Get Container ShortID %{STOPPER}
Should Contain ${output} ${stress}
Should Contain ${output} ${stop}
Stats API Memory Validation
${status}= Run Keyword And Return Status Environment Variable Should Be Set DOCKER_CERT_PATH
${certs}= Set Variable If ${status} --cert %{DOCKER_CERT_PATH}/cert.pem --key %{DOCKER_CERT_PATH}/key.pem ${EMPTY}
${rc} ${apiMem}= Run And Return Rc And Output curl -sk ${certs} -H "Accept: application/json" -H "Content-Type: application/json" -X GET https://%{VCH-IP}:%{VCH-PORT}/containers/%{STRESSED}/stats?stream=false | jq -r .memory_stats.usage
Should Be Equal As Integers ${rc} 0
${stress}= Get Container ShortID %{STRESSED}
${vmomiMemory}= Get Average Active Memory %{VM-PATH}
Should Be Equal As Integers ${rc} 0
${vmomiMemory}= Evaluate ${vmomiMemory}*1024
${diff}= Evaluate ${apiMem}-${vmomiMemory}
${diff}= Set Variable abs(${diff})
Should Be True ${diff} < 1000
Stats API CPU Validation
${status}= Run Keyword And Return Status Environment Variable Should Be Set DOCKER_CERT_PATH
${certs}= Set Variable If ${status} --cert %{DOCKER_CERT_PATH}/cert.pem --key %{DOCKER_CERT_PATH}/key.pem ${EMPTY}
${rc} ${apiCPU}= Run And Return Rc And Output curl -sk ${certs} -H "Accept: application/json" -H "Content-Type: application/json" -X GET https://%{VCH-IP}:%{VCH-PORT}/containers/%{STRESSED}/stats?stream=false
Should Be Equal As Integers ${rc} 0
Should Contain ${apiCPU} cpu_stats
Should Contain ${apiCPU} cpu_usage
Should Contain ${apiCPU} total_usage
Stats No Stream Non-Existent Container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stats --no-stream fake
Should Be Equal As Integers ${rc} 1
Should Contain ${output} No such container: fake
Stats No Stream Specific Stopped Container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stats --no-stream %{STOPPER}
Should Be Equal As Integers ${rc} 0
${stop}= Get Container ShortID %{STOPPER}
Should Contain ${output} ${stop}
Stats API Disk and Network Validation
${status}= Run Keyword And Return Status Environment Variable Should Be Set DOCKER_CERT_PATH
${certs}= Set Variable If ${status} --cert %{DOCKER_CERT_PATH}/cert.pem --key %{DOCKER_CERT_PATH}/key.pem ${EMPTY}
${rc} ${api}= Run And Return Rc And Output curl -sk ${certs} -H "Accept: application/json" -H "Content-Type: application/json" -X GET https://%{VCH-IP}:%{VCH-PORT}/containers/%{STRESSED}/stats?stream=false
Should Be Equal As Integers ${rc} 0
Should Contain ${api} ethernet
Should Contain ${api} Read
Should Contain ${api} Write
Should Contain ${api} op
Should Contain ${api} major
Should Contain ${api} minor

View File

@@ -0,0 +1,25 @@
Test 1-40 - Docker Restart
=======
# Purpose:
To verify that `docker restart` is supported and works as expected.
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Run a busybox container and create a busybox container
2. Run restart for running container
3. Run restart for created container
4. Run restart for stopped container
# Expected Outcome:
1. Fails if two containers are not created
2. Successfully stop and restart container - failure on op failure or ip address change
3. Successfully start created container - failure if container doesn't start
4. Successfully stop running container and then restart stopped container - failure on op failure or ip address change
# Possible Problems:

View File

@@ -0,0 +1,103 @@
# Copyright 2017-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 1-40 - Docker Restart
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 30 minutes
*** Keywords ***
Create test containers
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d busybox /bin/top
Should Be Equal As Integers ${rc} 0
Set Environment Variable RUNNER ${output}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create busybox /bin/top
Should Be Equal As Integers ${rc} 0
Set Environment Variable CREATOR ${output}
*** Test Cases ***
Restart Running Container
Create test containers
# grab the containerVM ip address - will compare after restart to ensure it remains the same
${rc} ${originalIP}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' %{RUNNER}
Should Be Equal As Integers ${rc} 0
Should Contain ${originalIP} 172
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} restart %{RUNNER}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} %{RUNNER}
# verify that IP address didn't chnage during restart
${rc} ${restartIP}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' %{RUNNER}
Should Be Equal As Integers ${rc} 0
Should Be Equal ${originalIP} ${restartIP}
# verify that the containerVM started
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -f id=%{RUNNER} -f status=running
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
Length Should Be ${output} 2
Restart Created Container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} restart %{CREATOR}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} %{CREATOR}
# verify that the containerVM started
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -f id=%{CREATOR} -f status=running
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
Length Should Be ${output} 2
Restart Stopped Container
# grab the containerVM ip address - will compare after restart to ensure it remains the same
${rc} ${originalIP}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' %{RUNNER}
Should Be Equal As Integers ${rc} 0
Should Contain ${originalIP} 172
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop %{RUNNER}
Should Be Equal As Integers ${rc} 0
# verify that the containerVM exited
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -f id=%{RUNNER} -f status=exited
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
Length Should Be ${output} 2
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} restart %{RUNNER}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} %{RUNNER}
# verify that the containerVM started
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} ps -f id=%{RUNNER} -f status=running
Should Be Equal As Integers ${rc} 0
${output}= Split To Lines ${output}
Length Should Be ${output} 2
# verify that IP address didn't chnage during restart
${rc} ${restartIP}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' %{RUNNER}
Should Be Equal As Integers ${rc} 0
Should Be Equal ${originalIP} ${restartIP}
Restart with start-stop stress
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
${rc} ${container}= Run And Return Rc And Output docker %{VCH-PARAMS} run -dit ${busybox}
# Set the timeout to 5s - this should be enough to allow the docker stop to pre-empt the stop portion of restart
# but not so long we have massive variance based on which process wins the race for each iteration
${restart-pid}= Start Process while true; do docker %{VCH-PARAMS} restart -t 5 ${container}; done shell=${true}
${restart-pid2}= Start Process while true; do docker %{VCH-PARAMS} restart -t 5 ${container}; done shell=${true}
${loopOutput}= Create List
:FOR ${idx} IN RANGE 0 150
\ ${out}= Run (docker %{VCH-PARAMS} start ${container} && docker %{VCH-PARAMS} stop -t1 ${container})
\ Append To List ${loopOutput} ${out}
Terminate Process ${restart-pid}
Terminate Process ${restart-pid2}
Log ${loopOutput}
Should Not Contain Match ${loopOutput} *EOF*

View File

@@ -0,0 +1,34 @@
Test 1-41 - Docker Commit
=======
# Purpose:
To verify that `docker commit` is supported and works as expected.
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/commit/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Create a new debian container
2. Install nano into the container
3. Stop the container and commit the changes to the image
4. Start a new container based on the new image, checking that nano is installed already
5. Start another container then stop the container and commit an environment variable to the image using `docker commit -c ENV TEST 'test string'`
6. Start a new container based on the new image, checking that the environment variable is set
7. Attempt to commit an unsupported command into the image like `RUN`
8. Stop the container and commit another environment variable into the image with the author set and commit message set
9. Attempt to commit to a container that doesn't exist
# Expected Outcome:
* Steps 1-3 should succeed
* Step 4 nano should now be found in the image
* Step 5-6 TEST should now be an environment variable in the container
* Step 7 should return an error:
`Error response from daemon: run is not a valid change command`
* Step 8 should be able to be verified that the author and message are set when you inspect the image afterwards
* Step 9 should return error and indicate the container does not exist
# Possible Problems:
* This test relies on our implementation of docker exec in order to work, if there is a problem in exec then these test results will likely not be valid

View File

@@ -0,0 +1,73 @@
# 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 1-41 - Docker Commit
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Commit nano to image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --name commit1 ${debian} tail -f /dev/null
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec commit1 apt-get update
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec commit1 apt-get install nano
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop -t1 commit1
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} commit commit1 debian-nano
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run debian-nano whereis nano
Should Be Equal As Integers ${rc} 0
Should Contain ${output} /bin/nano
Commit env variable to image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --name commit2 ${debian} tail -f /dev/null
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop -t1 commit2
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} commit -c "ENV TEST commitEnvTest" commit2 debian-env
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run debian-env env
Should Be Equal As Integers ${rc} 0
Should Contain ${output} TEST\=commitEnvTest
Unsupported commit command
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --name commit3 ${debian} tail -f /dev/null
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop -t1 commit3
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} commit -c "RUN apt-get install nginx" commit3 debian-env
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} Error response from daemon: run is not a valid change command
Commit with author and message
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --name commit4 ${debian} tail -f /dev/null
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop -t1 commit4
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} commit -a Robot -m "Robot made a commit" -c "ENV TEST commitEnvTest" commit4 debian-auth
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} inspect debian-auth
Should Be Equal As Integers ${rc} 0
Should Contain ${output} "Author": "Robot"
Should Contain ${output} "Comment": "Robot made a commit"
Commit to nonexistent container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} commit -c "ENV TEST commitEnvTest" fakeContainer image-fake
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} Error response from daemon: No such container: fakeContainer

View File

@@ -0,0 +1,26 @@
Test 1-42 - Docker Diff
=======
# Purpose:
To verify that docker diff command is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/diff/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server
2. Issue docker create busybox /bin/sh -c "touch a b c; rm -rf /tmp; adduser -D krusty"
3. Issue docker start <containerID> to the VIC appliance
4. Issue docker diff <containerID> to the VIC appliance
5. Verify a, b, c were created, /tmp was deleted and /etc/hosts was modified
# Expected Outcome:
* Step 2 should complete without error, and the response should be the containerID
* Step 3 should run to completion without output
* Step 4 should produce the expected output reflecting the container filesystem changes
# Possible Problems:
None

View File

@@ -0,0 +1,49 @@
# 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 1-42 - Docker Diff
Resource ../../resources/Util.robot
Suite Setup Conditional Install VIC Appliance To Test Server
Suite Teardown Cleanup VIC Appliance On Test Server
Test Timeout 20 minutes
*** Test Cases ***
Make changes to busybox image
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull busybox
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} create busybox /bin/sh -c "touch a b c; rm -rf /tmp; adduser -D krusty"
Should Be Equal As Integers ${rc} 0
${rc} ${id}= Run And Return Rc And Output docker %{VCH-PARAMS} start ${id}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} diff ${id}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} A /a
Should Contain ${output} A /b
Should Contain ${output} A /c
Should Contain ${output} D /tmp
Should Contain ${output} C /etc/passwd
Should Contain ${output} C /etc
Should Contain ${output} C /etc/group
Should Contain ${output} A /etc/group-
Should Contain ${output} C /etc/passwd
Should Contain ${output} A /etc/passwd-
Should Contain ${output} C /etc/shadow
Should Contain ${output} A /etc/shadow-
Should Contain ${output} C /home
Should Contain ${output} A /home/krusty
Should Not Contain ${output} hostname
Should Not Contain ${output} hosts
Should Not Contain ${output} resolv.conf
Should Not Contain ${output} .tether

View File

@@ -0,0 +1,77 @@
Test 1-43 - Docker CP Offline
=======
# Purpose:
To verify that docker cp command for offline containers is supported by VIC appliance
# References:
[1 - Docker Command Line Reference](https://docs.docker.com/engine/reference/commandline/cp/)
# Environment:
This test requires that a vSphere server is running and available
# Test Steps:
1. Deploy VIC appliance to vSphere server and set up test files, directories and volumes
2. Pull busybox image and create a container named offline
3. Issue docker cp foo.txt offline:/ to the new VIC appliance
4. Start offline and verify that foo.txt exists in the offline:/
5. Clean up offline:/foo.txt
6. Create a directory named testdir in offline:/ and create a fakefile in offline:/testdir
7. Stop offline and issue docker cp offline:/testdir . to the new VIC appliance
8. Verify that testdir and its content is successfully copied to the host
9. Issue docker cp bar offline:/bar to the new VIC appliance
10. Start offline and verify that bar exists in offline:/
11. Stop offline
12. Issue docker cp offline:/dne/dne . to the new VIC appliance
13. Issue docker cp offline:/dne/. . to the new VIC appliance
14. Issue docker cp dne/ offline:/ to the new VIC appliance
15. Remove offline container
16. Create a container with a small volume attached to it
17. Issue docker cp largefile.txt ${cid}:/small to the new VIC appliance
18. Remove offline container
19. Create a container with a single volume attached to it
20. Issue docker cp foo.txt ${cid}:/vol1 to the new VIC appliance
21. Start ${cid} and verify that the copy operation succeeded
22. Remove ${cid} container
23. Create a container with two volumes attached to it, vol2 nested in vol1
24. Issue docker cp foo.txt ${cid}:/vol1/vol2 to the new VIC appliance
25. Start ${cid} and verify that the copy operation succeeded
26. Remove ${cid} container
27. Create a container with three volumes attached to it, vol2 nested in vol1, vol3 nested in vol2
28. Issue docker cp foo.txt ${cid}:/vol1/vol2/vol3 to the new VIC appliance
29. Start ${cid} and verify that the copy operation succeeded
30. Remove ${cid} container
31. Create a container named concurrent with a single volume attached to it
32. Start 10 background processes that issues docker cp foo.txt concurrent:/foo-${idx} to the new VIC appliance
33. Wait for these processes to finish
34. Start and inspect concurrent:/ to verify that copy operation succeeded
35. Stop concurrent
36. Start 10 background processes that issues docker cp largefile.txt concurrent:/vol1/lg-${idx} to the new VIC appliance
37. Wait for these processes to finish
38. Start and inspect concurrent:/vol1 to verify that copy operation succeeded
39. Stop concurrent
40. Start 10 background processes that issues docker cp concurrent:/vol1/lg-${idx} . to the new VIC appliance
41. Wait for these processes to finish
42. Verify that the copy operation succeeded and clean up all the files copied to the host
43. Remove concurrent
44. Create a container called subVol with 2 volumes attached to it
45. Issue docker cp ./mnt subVol:/ to the new VIC appliance
46. Start subVol and inspect its /mnt, /mnt/vol1 and /mnt/vol2 to verify that copy operation succeeded
47. Stop subVol
48. Issue docker cp subVol:/mnt ./result to the new VIC appliance
49. Verify that the files from each sub volumes are copied to host properly
50. Remove subvol
51. Clean up created files and directories
# Expected Outcome:
* Step 1-11 should all succeed
* Step 12-14 should all fail with no such directory error
* Step 15-16 should all succeed
* Step 17 should fail
* Step 18-30 should all succeed
* Step 31-43 should all succeed
* Step 44-51 should all succeed
# Possible Problems:
* 17 should fail with not enough disk space, but currently returns a broken pipe
* 31-43 are offline concurrent cp tests and may be unstable

View File

@@ -0,0 +1,285 @@
# 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 1-43 - Docker CP Offline
Resource ../../resources/Util.robot
Suite Setup Set up test files and install VIC appliance to test server
Suite Teardown Clean up test files and VIC appliance to test server
Test Timeout 20 minutes
*** Keywords ***
Set up test files and install VIC appliance to test server
Conditional Install VIC Appliance To Test Server
Remove All Volumes
Create File ${CURDIR}/foo.txt hello world
Create File ${CURDIR}/content fake file content for testing only
Create Directory ${CURDIR}/bar
Create Directory ${CURDIR}/mnt
Create Directory ${CURDIR}/mnt/vol1
Create Directory ${CURDIR}/mnt/vol2
Create File ${CURDIR}/mnt/root.txt rw layer file
Create File ${CURDIR}/mnt/vol1/v1.txt vol1 file
Create File ${CURDIR}/mnt/vol2/v2.txt vol2 file
${rc} ${output}= Run And Return Rc And Output dd if=/dev/urandom of=${CURDIR}/largefile.txt count=4096 bs=4096
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create vol1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create vol2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create vol3
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} volume create smallVol --opt Capacity=1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Clean up test files and VIC appliance to test server
Run Keyword and Continue on Failure Remove File ${CURDIR}/foo.txt
Run Keyword and Continue on Failure Remove File ${CURDIR}/content
Run Keyword and Continue on Failure Remove File ${CURDIR}/largefile.txt
Run Keyword and Continue on Failure Remove Directory ${CURDIR}/bar recursive=True
Run Keyword and Continue on Failure Remove Directory ${CURDIR}/mnt recursive=True
Cleanup VIC Appliance On Test Server
*** Test Cases ***
Try To Exploit VCH With Offline Copy of Malicious Tarball
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} pull ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create --name exploitme ${busybox}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output cat ${CURDIR}/../../resources/archive.tar.gz | docker %{VCH-PARAMS} cp - exploitme:/
Should Not Contain ${output} No such file or directory
Enable VCH SSH
${rc} ${output}= Run And Return Rc And Output sshpass -ppassword ssh %{VCH-IP} -lroot -C -oStrictHostKeyChecking=no "ls /tmp | grep pingme"
Log ${output}
Should Not Be Equal As Integers ${rc} 0
Should Not Contain ${output} pingme
Copy a file from host to offline container root dir
${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} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i --name offline ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp ${CURDIR}/foo.txt offline:/
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${output}= Start Container and Exec Command offline ls /
Should Contain ${output} foo.txt
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec offline sh -c 'rm /foo.txt'
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Copy a directory from offline container to host cwd
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} exec offline sh -c 'mkdir testdir && echo "file content" > /testdir/fakefile'
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop offline
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp offline:/testdir ${CURDIR}/
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
OperatingSystem.Directory Should Exist ${CURDIR}/testdir
OperatingSystem.File Should Exist ${CURDIR}/testdir/fakefile
Remove Directory ${CURDIR}/testdir recursive=True
Copy a directory from host to offline container, dst path doesn't exist
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp ${CURDIR}/bar offline:/bar
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${output}= Start Container and Exec Command offline ls /
Should Contain ${output} bar
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop offline
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Copy a non-existent file out of an offline container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp offline:/dne/dne ${CURDIR}
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} Error
Copy a non-existent directory out of an offline container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp offline:/dne/. ${CURDIR}
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} Error
Copy a non-existent directory into an offline container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp ${CURDIR}/dne/ offline:/
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} no such file or directory
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f offline
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Copy a large file that exceeds the container volume into an offline container
${rc} ${cid}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i -v smallVol:/small ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${cid} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp ${CURDIR}/largefile.txt ${cid}:/small
Should Not Be Equal As Integers ${rc} 0
Should Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f ${cid}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Copy a file from host to offline container, dst is a volume
${rc} ${cid}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i -v vol1:/vol1 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${cid} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp ${CURDIR}/foo.txt ${cid}:/vol1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${output}= Start Container and Exec Command ${cid} ls /vol1
Should Contain ${output} foo.txt
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f ${cid}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Copy a file from host to offline container, dst is a nested volume with 2 levels
${rc} ${cid}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i -v vol1:/vol1 -v vol2:/vol1/vol2 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${cid} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp ${CURDIR}/foo.txt ${cid}:/vol1/vol2
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${output}= Start Container and Exec Command ${cid} ls /vol1/vol2
Should Contain ${output} foo.txt
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f ${cid}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Copy a file from host to offline container, dst is a nested volume with 3 levels
${rc} ${cid}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i -v vol1:/vol1 -v vol2:/vol1/vol2 -v vol3:/vol1/vol2/vol3 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${cid} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp ${CURDIR}/foo.txt ${cid}:/vol1/vol2/vol3
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${output}= Start Container and Exec Command ${cid} ls /vol1/vol2/vol3
Should Contain ${output} foo.txt
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f ${cid}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Concurrent copy: create processes to copy a small file from host to offline container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i --name concurrent -v vol1:/vol1 ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${pids}= Create List
Log To Console \nIssue 10 docker cp commands for small file
:FOR ${idx} IN RANGE 0 10
\ ${pid}= Start Process docker %{VCH-PARAMS} cp ${CURDIR}/foo.txt concurrent:/foo-${idx} shell=True
\ Append To List ${pids} ${pid}
Log To Console \nWait for them to finish and check their RC
:FOR ${pid} IN @{pids}
\ Log To Console \nWaiting for ${pid}
\ ${res}= Wait For Process ${pid}
\ Log ${res.stdout}
\ Should Be Equal As Integers ${res.rc} 0
${output}= Start Container and Exec Command concurrent ls /
Log To Console \nCheck if the copy operations succeeded
:FOR ${idx} IN RANGE 0 10
\ Should Contain ${output} foo-${idx}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop concurrent
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Concurrent copy: repeat copy a large file from host to offline container several times
${pids}= Create List
Log To Console \nIssue 10 docker cp commands for large file
:FOR ${idx} IN RANGE 0 10
\ ${pid}= Start Process docker %{VCH-PARAMS} cp ${CURDIR}/largefile.txt concurrent:/vol1/lg-${idx} shell=True
\ Append To List ${pids} ${pid}
Log To Console \nWait for them to finish and check their RC
:FOR ${pid} IN @{pids}
\ Log To Console \nWaiting for ${pid}
\ ${res}= Wait For Process ${pid}
\ Log ${res.stdout}
\ Should Be Equal As Integers ${res.rc} 0
${output}= Start Container and Exec Command concurrent ls /vol1
Log To Console \nCheck if the copy operations succeeded
:FOR ${idx} IN RANGE 0 10
\ Should Contain ${output} lg-${idx}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop concurrent
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
# NOTE: this test depends on the prior test passing as it uses the copied files from that test as the source files for this test
Concurrent copy: repeat copy a large file from offline container to host several times
${pids}= Create List
Log To Console \nIssue 10 docker cp commands for large file
:FOR ${idx} IN RANGE 0 10
\ ${pid}= Start Process docker %{VCH-PARAMS} cp concurrent:/vol1/lg-${idx} ${CURDIR} shell=True
\ Append To List ${pids} ${pid}
Log To Console \nWait for them to finish and check their RC
:FOR ${pid} IN @{pids}
\ Log To Console \nWaiting for ${pid}
\ ${res}= Wait For Process ${pid}
\ Log ${res.stdout}
\ Should Be Equal As Integers ${res.rc} 0
Log To Console \nCheck if the copy operations succeeded
:FOR ${idx} IN RANGE 0 10
\ OperatingSystem.File Should Exist ${CURDIR}/lg-${idx}
\ Remove File ${CURDIR}/lg-${idx}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f concurrent
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Sub volumes: copy from host to offline container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} create -i -v vol1:/mnt/vol1 -v vol2:/mnt/vol2 --name subVol ${busybox}
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp ${CURDIR}/mnt subVol:/
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
${output}= Start Container and Exec Command subVol find /mnt
Should Contain ${output} /mnt/root.txt
Should Contain ${output} /mnt/vol1/v1.txt
Should Contain ${output} /mnt/vol2/v2.txt
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} stop subVol
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Sub volumes: copy from offline container to host
Operating System.List Directory ${CURDIR}/
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp subVol:/mnt ${CURDIR}/result
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
# Needed to help diagnose failures
${rc} ${output}= Run And Return Rc And Output find ${CURDIR}/result -ls
Log ${output}
Remove Directory ${CURDIR}/result recursive=True
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} cp subVol:/mnt ${CURDIR}/result
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
OperatingSystem.Directory Should Exist ${CURDIR}/result/vol1
OperatingSystem.Directory Should Exist ${CURDIR}/result/vol2
OperatingSystem.File Should Exist ${CURDIR}/result/root.txt
OperatingSystem.File Should Exist ${CURDIR}/result/vol1/v1.txt
OperatingSystem.File Should Exist ${CURDIR}/result/vol2/v2.txt
Remove Directory ${CURDIR}/result recursive=True
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f subVol
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error

Some files were not shown because too many files have changed in this diff Show More