From ef72ec99928536800e77ebd0a82d7be433d9375f Mon Sep 17 00:00:00 2001 From: luwang-vmware Date: Thu, 20 Dec 2018 10:55:49 +0800 Subject: [PATCH] Integrate Selenium-Grid into NSXT env --- .../5-29-Opaque-Network.md | 7 ++ .../5-29-Opaque-Network.robot | 91 ++++++++++++++----- 2 files changed, 77 insertions(+), 21 deletions(-) diff --git a/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.md b/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.md index bd79eeb2d1..0d0afaa6f1 100644 --- a/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.md +++ b/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.md @@ -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: diff --git a/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.robot b/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.robot index 873f035e66..cea48df9f3 100644 --- a/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.robot +++ b/tests/manual-test-cases/Group5-Functional-Tests/5-29-Opaque-Network.robot @@ -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 @@ -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 +#