diff --git a/tests/integration-test.sh b/tests/integration-test.sh index 79a291ff72..7aa4918907 100755 --- a/tests/integration-test.sh +++ b/tests/integration-test.sh @@ -44,6 +44,13 @@ if (echo $prBody | grep -q "\[shared datastore="); then export TEST_DATASTORE=$datastore fi +bootstrapiso='bin/bootstrap-centos-6.9.iso' +bootstrapdir='centos6.9' +function test_custom_iso(){ + #Currently we only test 3 cases for custom-bootstrap-iso + pabot --verbose --processes $jobs --removekeywords TAG:secret -v BOOTSTRAP-ISO:$bootstrapiso --outputdir $bootstrapdir --suite 1-45-Docker-Container-Network --suite 1-19-Docker-Volume-Create --suite 7-01-Regression tests/test-cases +} + jobs="2" if (echo $prBody | grep -q "\[parallel jobs="); then parallel=$(echo $prBody | grep "\[parallel jobs=") @@ -53,20 +60,24 @@ fi if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == "releases/"* ]] && [[ $DRONE_REPO == "vmware/vic" ]] && [[ $DRONE_BUILD_EVENT == "push" ]]; then echo "Running full CI for $DRONE_BUILD_EVENT on $DRONE_BRANCH" pabot --verbose --processes $jobs --removekeywords TAG:secret --exclude skip tests/test-cases + test_custom_iso elif [[ $DRONE_REPO == "vmware/vic" ]] && [[ $DRONE_BUILD_EVENT == "tag" ]]; then echo "Running only Group11-Upgrade and 7-01-Regression for $DRONE_BUILD_EVENT on $DRONE_BRANCH" pabot --verbose --processes $jobs --removekeywords TAG:secret --suite Group11-Upgrade --suite 7-01-Regression tests/test-cases elif (echo $prBody | grep -q "\[full ci\]"); then echo "Running full CI as per commit message" pabot --verbose --processes $jobs --removekeywords TAG:secret --exclude skip tests/test-cases + test_custom_iso elif (echo $prBody | grep -q "\[specific ci="); then echo "Running specific CI as per commit message" buildtype=$(echo $prBody | grep "\[specific ci=") testsuite=$(echo $buildtype | awk -F"\[specific ci=" '{sub(/\].*/,"",$2);print $2}') pabot --verbose --processes $jobs --removekeywords TAG:secret --suite $testsuite --suite 7-01-Regression tests/test-cases + pabot --verbose --processes $jobs --removekeywords TAG:secret -v BOOTSTRAP-ISO:$bootstrapiso --outputdir $bootstrapdir --suite $testsuite --suite 7-01-Regression tests/test-cases else echo "Running regressions" pabot --verbose --processes $jobs --removekeywords TAG:secret --exclude skip --include regression tests/test-cases + test_custom_iso fi rc="$?" @@ -74,7 +85,8 @@ rc="$?" timestamp=$(date +%s) outfile="integration_logs_"$DRONE_BUILD_NUMBER"_"$DRONE_COMMIT".zip" -zip -9 -j $outfile output.xml log.html report.html package.list *container-logs*.zip *.log /var/log/vic-machine-server/vic-machine-server.log *.debug +( cd $bootstrapdir && for f in *; do mv $f ../$bootstrapdir"_"$f; done) +zip -9 -j $outfile $bootstrapdir"_"* output.xml log.html report.html package.list *container-logs*.zip *.log /var/log/vic-machine-server/vic-machine-server.log *.debug # GC credentials keyfile="/root/vic-ci-logs.key" diff --git a/tests/resources/VCH-Util.robot b/tests/resources/VCH-Util.robot index e6209095da..737064dc7e 100644 --- a/tests/resources/VCH-Util.robot +++ b/tests/resources/VCH-Util.robot @@ -15,6 +15,9 @@ *** Settings *** Documentation This resource contains all keywords related to creating, deleting, maintaining VCHs +*** Variables *** +${BOOTSTRAP-ISO} bin/bootstrap.iso + *** Keywords *** Set Test Environment Variables # Finish setting up environment variables @@ -311,7 +314,7 @@ Conditional Install VIC Appliance To Test Server Run Keyword If ${init} Set Environment Variable TARGET_VCH %{VCH-NAME} Install VIC Appliance To Test Server - [Arguments] ${vic-machine}=bin/vic-machine-linux ${appliance-iso}=bin/appliance.iso ${bootstrap-iso}=bin/bootstrap.iso ${certs}=${true} ${vol}=default ${cleanup}=${true} ${debug}=1 ${additional-args}=${EMPTY} + [Arguments] ${vic-machine}=bin/vic-machine-linux ${appliance-iso}=bin/appliance.iso ${bootstrap-iso}=${BOOTSTRAP-ISO} ${certs}=${true} ${vol}=default ${cleanup}=${true} ${debug}=1 ${additional-args}=${EMPTY} Set Test Environment Variables ${opsuser-args}= Get Ops User Args ${output}= Install VIC Appliance To Test Server With Current Environment Variables ${vic-machine} ${appliance-iso} ${bootstrap-iso} ${certs} ${vol} ${cleanup} ${debug} ${opsuser-args} ${additional-args} @@ -319,7 +322,7 @@ Install VIC Appliance To Test Server [Return] ${output} Install VIC Appliance To Test Server With Current Environment Variables - [Arguments] ${vic-machine}=bin/vic-machine-linux ${appliance-iso}=bin/appliance.iso ${bootstrap-iso}=bin/bootstrap.iso ${certs}=${true} ${vol}=default ${cleanup}=${true} ${debug}=1 ${opsuser-args}=${EMPTY} ${additional-args}=${EMPTY} + [Arguments] ${vic-machine}=bin/vic-machine-linux ${appliance-iso}=bin/appliance.iso ${bootstrap-iso}=${BOOTSTRAP-ISO} ${certs}=${true} ${vol}=default ${cleanup}=${true} ${debug}=1 ${opsuser-args}=${EMPTY} ${additional-args}=${EMPTY} # disable firewall Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.esxcli network firewall set -e false # Attempt to cleanup old/canceled tests diff --git a/tests/test-cases/Group1-Docker-Commands/1-45-Docker-Container-Network.md b/tests/test-cases/Group1-Docker-Commands/1-45-Docker-Container-Network.md new file mode 100644 index 0000000000..6b971055ae --- /dev/null +++ b/tests/test-cases/Group1-Docker-Commands/1-45-Docker-Container-Network.md @@ -0,0 +1,28 @@ +Test 1-45 - Docker Container Network +==================================== + +# Purpose: +To verify that when containerVM is based on custom iso, the tomcat +application on docker hub works as expected on VIC. And verify that +tomcat on vic-specific container-network works as expected. + +# References: +[1 - Docker Hub tomcat Official Repository](https://hub.docker.com/_/tomcat/) + +# Environment: +This test requires that a vSphere server is running and available + +# Test Steps: +1. Deploy VIC appliance to the vSphere server with custom iso as containerVM +2. Run an tomcat container with a mapped port and verify the server is up and running: +`docker run --name tomcat1 -d -p 8080:8080 tomcat:alpine` +3. Run an tomcat container on the specific container network: +`docker run --name tomcat2 -d --net=public tomcat:alpine` +4. Run an tomcat container with a mapped port on the specific container network: +`docker run --name tomcat3 -d -p 8083:8080 --net=public tomcat:alpine` + +# Expected Outcome: +* Each step should succeed, tomcat should be running without error in each case + +# Possible Problems: +None diff --git a/tests/test-cases/Group1-Docker-Commands/1-45-Docker-Container-Network.robot b/tests/test-cases/Group1-Docker-Commands/1-45-Docker-Container-Network.robot new file mode 100644 index 0000000000..99f598a19c --- /dev/null +++ b/tests/test-cases/Group1-Docker-Commands/1-45-Docker-Container-Network.robot @@ -0,0 +1,51 @@ +# 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-45 - Docker Container Network +Resource ../../resources/Util.robot +Suite Setup Install VIC Appliance To Test Server additional-args=--container-network-firewall=%{PUBLIC_NETWORK}:open +Suite Teardown Cleanup VIC Appliance On Test Server +Default Tags + +*** Keywords *** +Curl tomcat endpoint + [Arguments] ${endpoint} + ${rc} ${output}= Run And Return Rc And Output curl ${endpoint} + Should Be Equal As Integers ${rc} 0 + [Return] ${output} + +*** Test Cases *** +Tomcat with port mapping + ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name tomcat1 -d -p 8082:8080 tomcat:alpine + Log ${output} + Should Be Equal As Integers ${rc} 0 + ${output}= Wait Until Keyword Succeeds 10x 10s Curl tomcat endpoint %{VCH-IP}:8082 + Should Contain ${output} Apache Tomcat + +Tomcat in container-network + ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name tomcat2 -d --net=public tomcat:alpine + Log ${output} + Should Be Equal As Integers ${rc} 0 + ${ip}= Get Container IP %{VCH-PARAMS} tomcat2 public + ${output}= Wait Until Keyword Succeeds 10x 10s Curl tomcat endpoint ${ip}:8080 + Should Contain ${output} Apache Tomcat + +Tomcat with port mapping in container-network + ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name tomcat3 -d -p 8083:8080 --net=public tomcat:alpine + Log ${output} + Should Be Equal As Integers ${rc} 0 + ${ip}= Get Container IP %{VCH-PARAMS} tomcat3 public + ${output}= Wait Until Keyword Succeeds 10x 10s Curl tomcat endpoint ${ip}:8083 + Should Contain ${output} Apache Tomcat diff --git a/tests/test-cases/Group1-Docker-Commands/TestCases.md b/tests/test-cases/Group1-Docker-Commands/TestCases.md index 0a3320e999..430dc3183b 100644 --- a/tests/test-cases/Group1-Docker-Commands/TestCases.md +++ b/tests/test-cases/Group1-Docker-Commands/TestCases.md @@ -83,3 +83,5 @@ Group 1 - Docker Commands [Test 1-43 - Docker CP Offline](1-43-Docker-CP-Offline.md) - [Test 1-44 - Docker CP Online](1-44-Docker-CP-Online.md) +- +[Test 1-45 - Docker Container Network](1-45-Docker-Container-Network.md)