Skip to content

Commit 0ec0f3a

Browse files
authored
Add support fortest cases for as custom iso (#8381)
* 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.
1 parent 36aa3b3 commit 0ec0f3a

File tree

5 files changed

+99
-3
lines changed

5 files changed

+99
-3
lines changed

tests/integration-test.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ if (echo $prBody | grep -q "\[shared datastore="); then
4444
export TEST_DATASTORE=$datastore
4545
fi
4646

47+
bootstrapiso='bin/bootstrap-centos-6.9.iso'
48+
bootstrapdir='centos6.9'
49+
function test_custom_iso(){
50+
#Currently we only test 3 cases for custom-bootstrap-iso
51+
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
52+
}
53+
4754
jobs="2"
4855
if (echo $prBody | grep -q "\[parallel jobs="); then
4956
parallel=$(echo $prBody | grep "\[parallel jobs=")
@@ -53,28 +60,33 @@ fi
5360
if [[ $DRONE_BRANCH == "master" || $DRONE_BRANCH == "releases/"* ]] && [[ $DRONE_REPO == "vmware/vic" ]] && [[ $DRONE_BUILD_EVENT == "push" ]]; then
5461
echo "Running full CI for $DRONE_BUILD_EVENT on $DRONE_BRANCH"
5562
pabot --verbose --processes $jobs --removekeywords TAG:secret --exclude skip tests/test-cases
63+
test_custom_iso
5664
elif [[ $DRONE_REPO == "vmware/vic" ]] && [[ $DRONE_BUILD_EVENT == "tag" ]]; then
5765
echo "Running only Group11-Upgrade and 7-01-Regression for $DRONE_BUILD_EVENT on $DRONE_BRANCH"
5866
pabot --verbose --processes $jobs --removekeywords TAG:secret --suite Group11-Upgrade --suite 7-01-Regression tests/test-cases
5967
elif (echo $prBody | grep -q "\[full ci\]"); then
6068
echo "Running full CI as per commit message"
6169
pabot --verbose --processes $jobs --removekeywords TAG:secret --exclude skip tests/test-cases
70+
test_custom_iso
6271
elif (echo $prBody | grep -q "\[specific ci="); then
6372
echo "Running specific CI as per commit message"
6473
buildtype=$(echo $prBody | grep "\[specific ci=")
6574
testsuite=$(echo $buildtype | awk -F"\[specific ci=" '{sub(/\].*/,"",$2);print $2}')
6675
pabot --verbose --processes $jobs --removekeywords TAG:secret --suite $testsuite --suite 7-01-Regression tests/test-cases
76+
pabot --verbose --processes $jobs --removekeywords TAG:secret -v BOOTSTRAP-ISO:$bootstrapiso --outputdir $bootstrapdir --suite $testsuite --suite 7-01-Regression tests/test-cases
6777
else
6878
echo "Running regressions"
6979
pabot --verbose --processes $jobs --removekeywords TAG:secret --exclude skip --include regression tests/test-cases
80+
test_custom_iso
7081
fi
7182

7283
rc="$?"
7384

7485
timestamp=$(date +%s)
7586
outfile="integration_logs_"$DRONE_BUILD_NUMBER"_"$DRONE_COMMIT".zip"
7687

77-
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
88+
( cd $bootstrapdir && for f in *; do mv $f ../$bootstrapdir"_"$f; done)
89+
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
7890

7991
# GC credentials
8092
keyfile="/root/vic-ci-logs.key"

tests/resources/VCH-Util.robot

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*** Settings ***
1616
Documentation This resource contains all keywords related to creating, deleting, maintaining VCHs
1717
18+
*** Variables ***
19+
${BOOTSTRAP-ISO} bin/bootstrap.iso
20+
1821
*** Keywords ***
1922
Set Test Environment Variables
2023
# Finish setting up environment variables
@@ -311,15 +314,15 @@ Conditional Install VIC Appliance To Test Server
311314
Run Keyword If ${init} Set Environment Variable TARGET_VCH %{VCH-NAME}
312315

313316
Install VIC Appliance To Test Server
314-
[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}
317+
[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}
315318
Set Test Environment Variables
316319
${opsuser-args}= Get Ops User Args
317320
${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}
318321
Log ${output}
319322
[Return] ${output}
320323

321324
Install VIC Appliance To Test Server With Current Environment Variables
322-
[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}
325+
[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}
323326
# disable firewall
324327
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.esxcli network firewall set -e false
325328
# Attempt to cleanup old/canceled tests
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Test 1-45 - Docker Container Network
2+
====================================
3+
4+
# Purpose:
5+
To verify that when containerVM is based on custom iso, the tomcat
6+
application on docker hub works as expected on VIC. And verify that
7+
tomcat on vic-specific container-network works as expected.
8+
9+
# References:
10+
[1 - Docker Hub tomcat Official Repository](https://hub.docker.com/_/tomcat/)
11+
12+
# Environment:
13+
This test requires that a vSphere server is running and available
14+
15+
# Test Steps:
16+
1. Deploy VIC appliance to the vSphere server with custom iso as containerVM
17+
2. Run an tomcat container with a mapped port and verify the server is up and running:
18+
`docker run --name tomcat1 -d -p 8080:8080 tomcat:alpine`
19+
3. Run an tomcat container on the specific container network:
20+
`docker run --name tomcat2 -d --net=public tomcat:alpine`
21+
4. Run an tomcat container with a mapped port on the specific container network:
22+
`docker run --name tomcat3 -d -p 8083:8080 --net=public tomcat:alpine`
23+
24+
# Expected Outcome:
25+
* Each step should succeed, tomcat should be running without error in each case
26+
27+
# Possible Problems:
28+
None
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2016-2018 VMware, Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License
14+
15+
*** Settings ***
16+
Documentation Test 1-45 - Docker Container Network
17+
Resource ../../resources/Util.robot
18+
Suite Setup Install VIC Appliance To Test Server additional-args=--container-network-firewall=%{PUBLIC_NETWORK}:open
19+
Suite Teardown Cleanup VIC Appliance On Test Server
20+
Default Tags
21+
22+
*** Keywords ***
23+
Curl tomcat endpoint
24+
[Arguments] ${endpoint}
25+
${rc} ${output}= Run And Return Rc And Output curl ${endpoint}
26+
Should Be Equal As Integers ${rc} 0
27+
[Return] ${output}
28+
29+
*** Test Cases ***
30+
Tomcat with port mapping
31+
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name tomcat1 -d -p 8082:8080 tomcat:alpine
32+
Log ${output}
33+
Should Be Equal As Integers ${rc} 0
34+
${output}= Wait Until Keyword Succeeds 10x 10s Curl tomcat endpoint %{VCH-IP}:8082
35+
Should Contain ${output} Apache Tomcat
36+
37+
Tomcat in container-network
38+
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name tomcat2 -d --net=public tomcat:alpine
39+
Log ${output}
40+
Should Be Equal As Integers ${rc} 0
41+
${ip}= Get Container IP %{VCH-PARAMS} tomcat2 public
42+
${output}= Wait Until Keyword Succeeds 10x 10s Curl tomcat endpoint ${ip}:8080
43+
Should Contain ${output} Apache Tomcat
44+
45+
Tomcat with port mapping in container-network
46+
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --name tomcat3 -d -p 8083:8080 --net=public tomcat:alpine
47+
Log ${output}
48+
Should Be Equal As Integers ${rc} 0
49+
${ip}= Get Container IP %{VCH-PARAMS} tomcat3 public
50+
${output}= Wait Until Keyword Succeeds 10x 10s Curl tomcat endpoint ${ip}:8083
51+
Should Contain ${output} Apache Tomcat

tests/test-cases/Group1-Docker-Commands/TestCases.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,5 @@ Group 1 - Docker Commands
8383
[Test 1-43 - Docker CP Offline](1-43-Docker-CP-Offline.md)
8484
-
8585
[Test 1-44 - Docker CP Online](1-44-Docker-CP-Online.md)
86+
-
87+
[Test 1-45 - Docker Container Network](1-45-Docker-Container-Network.md)

0 commit comments

Comments
 (0)