Skip to content

Commit

Permalink
Add support fortest cases for as custom iso (#8381)
Browse files Browse the repository at this point in the history
* Add two test cases for centos-6.9 as custom iso

Two centos6.9 cases into Group26-Custom-ISO: network and volume.
The network test verifying port mapping and container network.
The volume test is just copied from 1-19-Docekr-Volume-Create.
Both test cases require a vch with custom-isos.
  • Loading branch information
YanzhaoLi authored Nov 30, 2018
1 parent 36aa3b3 commit 0ec0f3a
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 3 deletions.
14 changes: 13 additions & 1 deletion tests/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=")
Expand All @@ -53,28 +60,33 @@ 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="$?"

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"
Expand Down
7 changes: 5 additions & 2 deletions tests/resources/VCH-Util.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -311,15 +314,15 @@ 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}
Log ${output}
[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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions tests/test-cases/Group1-Docker-Commands/TestCases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 0ec0f3a

Please sign in to comment.