Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Selenium-Grid into NSXT env #8425

Merged
merged 1 commit into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,29 @@ To verify the VIC appliance works with NSXT Logical Switches

# Environment:
This test requires to use VDNET 3.0 for vCenter, ESXi and NSX-T creation and customization

# Test Steps:
1. Deploy a new topology which includes vCenter and NSXT in Nimbus using VDNET 3.0
```A new vCenter```
```A new NSXT Manager, NSXT Controller and NSXT Edge```
```Three ESXi Hosts and put two of them into os-computer-cluster-1 cluster and one of them into management cluster```
```Create an overlay transport zone in NSXT```
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 testbeds

# Case 1 Test Steps:
1. Create two overlay logical switches for bridge and container network
2. Install VIC appliance and deploy a VCH
3. Run a variety of docker commands on the VCH appliance
4. Destroy the created VIC appliance and VCH

# Case 2 Test Steps:
1. Create 2 new logical switches for bridge and 1 logical switch for container network
2. Install VIC appliance and deploy 2 VCHs. Each VCH uses different logical switch as bridge network.
3. Deploy a selenium grid hub and 8 selenium node in each VCH
4. Verify each of the selenium node is deployed properly and connect to the hub
5. Delete VCH


# Expected Outcome:
The VCH appliance should deploy without error and each of the docker commands executed against it should return without error

# Possible Problems:
* Your testbed is deployed failed due to VDNET 3.0 is not stable every time
* Hit failure in deleting VCH which has selenium grid related container
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ 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
${NFS} 10.161.137.16
${USE_LOCAL_TOOLCHAIN} 0
${VDNET_MC_SETUP} 0
${NIMBUS_BASE} /mts/git
Expand All @@ -39,16 +40,17 @@ ${nimbus_personal_user_cache} %{NIMBUS_PERSONAL_USER}

*** Keywords ***
Vdnet NSXT Topology Setup
[Timeout] 180 minutes
[Timeout] 120 minutes
Run Keyword If "${NIMBUS_LOCATION}" == "wdc" Set Suite Variable ${NFS} 10.92.98.149
# Unset NIMBUS_PERSONAL_USER, replace value to NSXT user so that all nimbus commands executed by NSXT user
#Remove Environment Variable NIMBUS_PERSONAL_USER
Set Environment Variable NIMBUS_PERSONAL_USER ${NIMBUS_NSXT_USER}

${TESTRUNID}= Evaluate 'NSXT' + str(random.randint(1000,9999)) modules=random
${json}= OperatingSystem.Get File tests/resources/nimbus-testbeds/vic-vdnet-nsxt.json
${file}= Replace Variables ${json}
Create File /tmp/vic-vdnet-nsxt.json ${file}

# Unset NIMBUS_PERSONAL_USER, replace value to NSXT user so that all nimbus commands executed by NSXT user
Remove Environment Variable NIMBUS_PERSONAL_USER
Set Environment Variable NIMBUS_PERSONAL_USER ${NIMBUS_NSXT_USER}

Open Connection ${VDNET_LAUNCHER_HOST}
#Login account must be the value of variable in this test suit, otherwise other pulic accounts will have no right to perform on 10.160.201.180.
Wait Until Keyword Succeeds 2 min 30 sec Login ${NIMBUS_NSXT_USER} ${NIMBUS_NSXT_PASSWORD}
Expand Down Expand Up @@ -79,7 +81,7 @@ Vdnet NSXT Topology Setup
Set Environment Variable TEST_DATASTORE vdnetSharedStorage
Set Environment Variable TEST_DATACENTER /os-test-dc
Set Environment Variable TEST_RESOURCE os-compute-cluster-1
Set Environment Variable TEST_TIMEOUT 30m
Set Environment Variable TEST_TIMEOUT 45m

Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_URL ${vc-ip}
Expand All @@ -93,7 +95,7 @@ Vdnet NSXT Topology Setup
OperatingSystem.Remove File /tmp/vic-vdnet-nsxt.json

Vdnet NSXT Topology Cleanup
[Timeout] 180 minutes
[Timeout] 30 minutes
[Arguments] ${pod_name} ${testrunid}

#Reset NIMBUS_PERSONAL_USER value to the initial value
Expand All @@ -106,8 +108,52 @@ Vdnet NSXT Topology Cleanup
Execute Command ${NIMBUS_LOCATION_FULL} USER=%{NIMBUS_PERSONAL_USER} nimbus-ctl --nimbus=${pod_name} kill *isolated-06-gw
Close Connection

Wait Until Selenium Hub Is Ready
[Arguments] ${hub-name}
:FOR ${idx} IN RANGE 1 60
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} logs ${hub-name}
\ ${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 60
\ ${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

Install VIC Appliance and Run Selenium Grid Test
[Arguments] ${name} ${certs}=${false} ${cleanup}=${true}
Install VIC Appliance To Test Server certs=${certs} cleanup=${cleanup} additional-args=--bridge-network-range 200.1.1.0/16

${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network create --subnet 220.1.1.0/24 grid
Should Be Equal As Integers ${rc} 0
${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
Wait Until Selenium Hub Is Ready selenium-hub

:FOR ${idx} IN RANGE 1 4
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --cpus 1 --memory 1G --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 4
\ ${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d --cpus 1 --memory 1G --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 4
\ Wait Until Selenium Node Is Ready chrome-${idx}

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


*** Test Cases ***
Basic VIC Tests with NSXT Topology
[Timeout] 60 minutes
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}
Expand All @@ -134,3 +180,47 @@ Basic VIC Tests with NSXT Topology
Should Not Contain ${output} Error

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

Selenium Grid Test in NSXT
[Timeout] 90 minutes
Log To Console Starting Selenium Grid test in NSXT...
${bridge_ls_name_1}= Evaluate 'vic-selenium-bridge-ls-1'

${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${bridge_ls_name_1}
Should Not Be Equal ${result} null

${bridge_ls_name_2}= Evaluate 'vic-selenium-bridge-ls-2'
${result}= Create Nsxt Logical Switch %{NSXT_MANAGER_URI} ${nsxt_username} ${nsxt_password} ${bridge_ls_name_2}
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 CONTAINER_NETWORK ${container_ls_name}

#Wait for 5 mins to make sure the logical switches is synchronized with vCenter
Sleep 300

Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name_1}
Install VIC Appliance and Run Selenium Grid Test Grid1

Set Suite Variable ${vch_params_1} %{VCH-PARAMS}
Set Suite Variable ${vch_name_1} %{VCH-NAME}
Set Suite Variable ${vic_admin_1} %{VIC-ADMIN}

Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name_2}
Install VIC Appliance and Run Selenium Grid Test Grid2 cleanup=${false}

${status}= Get State Of Github Issue 8435
Run Keyword If '${status}' == 'closed' Fail this case now that Issue #8435 has been resolved

# uncoment the followings when #8435 is resolved
# Sleep 300
# Run Keyword And Continue On Failure Cleanup VIC Appliance On Test Server
#
# Set Environment Variable VCH-NAME ${vch_name_1}
# Set Environment Variable BRIDGE_NETWORK ${bridge_ls_name_1}
# Set Environment Variable VCH-PARAMS ${vch_params_1}
# Set Environment Variable VIC-ADMIN ${vic_admin_1}
#
# Run Keyword And Continue On Failure Cleanup VIC Appliance On Test Server
14 changes: 10 additions & 4 deletions tests/resources/nimbus-testbeds/vic-vdnet-nsxt.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"options": {
"collectlogs": 1,
"sharedstorage": "${NFS}:/vdnet-sharedStore",
"vmrepos": "10.92.98.149:/vdnet-vmrepos",
"product": {
"nsxt": {
"feature_switch": {
Expand Down Expand Up @@ -103,12 +105,14 @@
}
},
"cpus": {
"cores": 8
"cores": 8,
"reservation": 50
},
"installtype": "linkedclone",
"build": "${ESX_VERSION}",
"memory": {
"size": 32000
"size": 32768,
"reservation": 70
},
"disk": {
"[1]": {
Expand All @@ -124,7 +128,8 @@
}
},
"cpus": {
"cores": 2
"cores": 8,
"reservation": 50
},
"installtype": "linkedclone",
"configure_package": {
Expand All @@ -138,7 +143,8 @@
},
"build": "${ESX_VERSION}",
"memory": {
"size": 32000
"size": 32768,
"reservation": 70
},
"disk": {
"[1]": {
Expand Down