Skip to content

Commit

Permalink
Integrate Selenium-Grid into NSXT env
Browse files Browse the repository at this point in the history
  • Loading branch information
luwang-vmware committed Dec 21, 2018
1 parent e2f1b28 commit ef72ec9
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ This test requires to use VDNET 3.0 for vCenter, ESXi and NSX-T creation and cus
2. Create two overlay logical switches for bridge and container network
3. Install VIC appliance and deploy a VCH
4. Run a variety of docker commands on the VCH appliance
5. Destroy the created VIC appliance and VCH
6. Create a new logical switches for bridge
7. Install VIC appliance and deploy a VCH
8. Deploy a selenium grid hub
9. Deploy 30 selenium workers of various types
10. Verify each of the workers are deployed properly and connect to the hub

5. Destroy testbeds

# Expected Outcome:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
Documentation Test 5-29 - Opaque Network
Resource ../../resources/Util.robot
Suite Setup Vdnet NSXT Topology Setup
Suite Teardown Vdnet NSXT Topology Cleanup ${NIMBUS_POD} ${testrunid}
#Suite Teardown Vdnet NSXT Topology Cleanup ${NIMBUS_POD} ${testrunid}

*** Variables ***
${NIMBUS_LOCATION} sc
${NIMBUS_LOCATION_FULL} NIMBUS_LOCATION=${NIMBUS_LOCATION}
${VDNET_LAUNCHER_HOST} 10.160.201.180
${VDNET_LAUNCHER_HOST} 10.193.10.33
${USE_LOCAL_TOOLCHAIN} 0
${VDNET_MC_SETUP} 0
${NIMBUS_BASE} /mts/git
Expand Down Expand Up @@ -91,32 +91,81 @@ Vdnet NSXT Topology Cleanup
Execute Command ${NIMBUS_LOCATION_FULL} nimbus-ctl --nimbus=${pod_name} kill *isolated-06-gw
Close Connection

Wait Until Selenium Hub Is Ready
:FOR ${idx} IN RANGE 1 10
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs selenium-hub
\ ${status}= Run Keyword And Return Status Should Contain ${output} Selenium Grid hub is up and running
\ Return From Keyword If ${status}
\ Sleep 3
Fail Selenium Hub failed to start properly

Wait Until Selenium Node Is Ready
[Arguments] ${node-name}
:FOR ${idx} IN RANGE 1 10
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${node-name}
\ ${status}= Run Keyword And Return Status Should Contain ${output} The node is registered to the hub and ready to use
\ Return From Keyword If ${status}
\ Sleep 3
Fail Selenium node ${node-name} failed to start properly

*** Test Cases ***
Basic VIC Tests with NSXT Topology
Log To Console \nStarting test...
${bridge_ls_name}= Evaluate 'vic-bridge-ls'
Selenium Grid Test in NSXT
Log To Console Starting Selenium Grid test in NSXT...
${bridge_ls_name}= Evaluate 'vic-selenium-bridge-ls'
${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${bridge_ls_name}
Should Not Be Equal ${result} null
${container_ls_name}= Evaluate 'vic-container-ls'
${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${container_ls_name}
Should Not Be Equal ${result} null
sleep 300

Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name}
Set Environment Variable CONTAINER_NETWORK ${container_ls_name}
#Wait for 5 mins to make sure the logical switches is synchronized with vCenter
Sleep 300
Install VIC Appliance To Test Server

Install VIC Appliance To Test Server additional-args=--container-network-firewall=%{CONTAINER_NETWORK}:open --container-network-ip-range %{CONTAINER_NETWORK}:50.0.9.100-50.0.9.200 --container-network-gateway %{CONTAINER_NETWORK}:50.0.9.1/24
Run Regression Tests

#Validate containers' connection when using container network
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -it -d --net=public --name first ${busybox}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create grid
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error

${ip}= Get Container IP %{VCH-PARAMS} first public
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=public ${debian} ping -c1 ${ip}
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d -p 4444:4444 --net grid --name selenium-hub selenium/hub:3.9.1
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} Error
Wait Until Selenium Hub Is Ready

:FOR ${idx} IN RANGE 1 15
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net grid -e HOME=/home/seluser -e HUB_HOST=selenium-hub --name chrome${idx} selenium/node-chrome:3.9.1
\ Should Be Equal As Integers ${rc} 0

:FOR ${idx} IN RANGE 1 15
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --net grid -e HOME=/home/seluser -e HUB_HOST=selenium-hub --name firefox${idx} selenium/node-firefox:3.9.1
\ Should Be Equal As Integers ${rc} 0

:FOR ${idx} IN RANGE 1 15
\ Wait Until Selenium Node Is Ready chrome${idx}

:FOR ${idx} IN RANGE 1 15
\ Wait Until Selenium Node Is Ready firefox${idx}

Run Keyword And Continue On Failure Cleanup VIC Appliance On Test Server

#Basic VIC Tests with NSXT Topology
# Log To Console \nStarting test...
# ${bridge_ls_name}= Evaluate 'vic-bridge-ls'
# ${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${bridge_ls_name}
# Should Not Be Equal ${result} null
# ${container_ls_name}= Evaluate 'vic-container-ls'
# ${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${container_ls_name}
# Should Not Be Equal ${result} null
# Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name}
# Set Environment Variable CONTAINER_NETWORK ${container_ls_name}
# #Wait for 5 mins to make sure the logical switches is synchronized with vCenter
# Sleep 300
#
# Install VIC Appliance To Test Server additional-args=--container-network-firewall=%{CONTAINER_NETWORK}:open --container-network-ip-range %{CONTAINER_NETWORK}:50.0.9.100-50.0.9.200 --container-network-gateway %{CONTAINER_NETWORK}:50.0.9.1/24
# Run Regression Tests
#
# #Validate containers' connection when using container network
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -it -d --net=public --name first ${busybox}
# Should Be Equal As Integers ${rc} 0
# Should Not Contain ${output} Error
#
# ${ip}= Get Container IP %{VCH-PARAMS} first public
# ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run --net=public ${debian} ping -c1 ${ip}
# Should Be Equal As Integers ${rc} 0
# Should Not Contain ${output} Error
#
# Run Keyword And Continue On Failure Cleanup VIC Appliance On Test Server
#

0 comments on commit ef72ec9

Please sign in to comment.