Merge pull request #14740 from danfengliu/fix-oidc-tests-issue--for-new-dex-service

[ 1.10 ] Fix OIDC tests issue for new dex service
This commit is contained in:
danfengliu 2021-05-31 20:43:00 +08:00 committed by GitHub
commit ddfe872a7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 183 additions and 1453 deletions

View File

@ -199,7 +199,7 @@ class DockerAPI(object):
baseimage = BASE_IMAGE['name'] + ":" + BASE_IMAGE['tag'] baseimage = BASE_IMAGE['name'] + ":" + BASE_IMAGE['tag']
if not self.DCLIENT.images(name=baseimage): if not self.DCLIENT.images(name=baseimage):
print( "Docker load is triggered when building {}".format(harbor_registry)) print( "Docker load is triggered when building {}".format(harbor_registry))
docker_load_image(BASE_IMAGE_ABS_PATH_NAME) self.DCLIENT.pull(baseimage)
c = self.DCLIENT.create_container(image=baseimage, c = self.DCLIENT.create_container(image=baseimage,
command='dd if=/dev/urandom of=test bs=1M count={}'.format(size)) command='dd if=/dev/urandom of=test bs=1M count={}'.format(size))
self.DCLIENT.start(c) self.DCLIENT.start(c)

View File

@ -12,7 +12,7 @@ class User(base.Base):
if realname is None: if realname is None:
realname = base._random_name("realname") realname = base._random_name("realname")
if email is None: if email is None:
email = '%s@%s.com' % (realname,"vmware") email = '%s@%s.com' % (realname,"harbortest")
if user_password is None: if user_password is None:
user_password = "Harbor12345678" user_password = "Harbor12345678"
if role_id is None: if role_id is None:

View File

@ -58,7 +58,6 @@ class TestProjects(unittest.TestCase):
self.project.add_project_members(TestProjects.project_test_quota_id, TestProjects.user_test_quota_id, **ADMIN_CLIENT) self.project.add_project_members(TestProjects.project_test_quota_id, TestProjects.user_test_quota_id, **ADMIN_CLIENT)
#4.Push an image to project(PA) by user(UA), then check the project quota usage; -- {"count": 1, "storage": 2791709} #4.Push an image to project(PA) by user(UA), then check the project quota usage; -- {"count": 1, "storage": 2791709}
#image = "harbor-repo.vmware.com/harbor-ci/alpine"
image = "goharbor/alpine" image = "goharbor/alpine"
src_tag = "3.10" src_tag = "3.10"
TestProjects.repo_name, _ = push_image_to_project(project_test_quota_name, harbor_server, user_test_quota_name, user_001_password, image, src_tag) TestProjects.repo_name, _ = push_image_to_project(project_test_quota_name, harbor_server, user_test_quota_name, user_001_password, image, src_tag)

View File

@ -2,13 +2,15 @@ import time
import os import os
import sys import sys
sys.path.insert(0, os.environ["SWAGGER_CLIENT_PATH"]) sys.path.insert(0, os.environ.get("SWAGGER_CLIENT_PATH", ''))
path=os.getcwd() + "/library" path=os.getcwd() + "/library"
sys.path.insert(0, path) sys.path.insert(0, path)
path=os.getcwd() + "/tests/apitests/python/library" path=os.getcwd() + "/tests/apitests/python/library"
sys.path.insert(0, path) sys.path.insert(0, path)
path=os.getcwd() + "/tests/apitests/python/"
sys.path.insert(0, path)
print(sys.path)
from swagger_client.rest import ApiException from swagger_client.rest import ApiException
import swagger_client.models import swagger_client.models
from pprint import pprint from pprint import pprint
@ -16,7 +18,7 @@ from pprint import pprint
admin_user = "admin" admin_user = "admin"
admin_pwd = "Harbor12345" admin_pwd = "Harbor12345"
harbor_server = os.environ["HARBOR_HOST"] harbor_server = os.environ.get("HARBOR_HOST", '')
#CLIENT=dict(endpoint="https://"+harbor_server+"/api") #CLIENT=dict(endpoint="https://"+harbor_server+"/api")
ADMIN_CLIENT=dict(endpoint = os.environ.get("HARBOR_HOST_SCHEMA", "https")+ "://"+harbor_server+"/api", username = admin_user, password = admin_pwd) ADMIN_CLIENT=dict(endpoint = os.environ.get("HARBOR_HOST_SCHEMA", "https")+ "://"+harbor_server+"/api", username = admin_user, password = admin_pwd)
USER_ROLE=dict(admin=0,normal=1) USER_ROLE=dict(admin=0,normal=1)
@ -28,7 +30,7 @@ METRIC_URL = os.environ.get('METRIC_URL', 'http://'+harbor_server+':9090')
BASE_IMAGE = dict(name='busybox', tag='latest') BASE_IMAGE = dict(name='busybox', tag='latest')
BASE_IMAGE_ABS_PATH_NAME = '/' + BASE_IMAGE['name'] + '.tar' BASE_IMAGE_ABS_PATH_NAME = '/' + BASE_IMAGE['name'] + '.tar'
def GetProductApi(username, password, harbor_server= os.environ["HARBOR_HOST"]): def GetProductApi(username, password, harbor_server= os.environ.get("HARBOR_HOST", '')):
cfg = swagger_client.Configuration() cfg = swagger_client.Configuration()
cfg.host = "https://"+harbor_server+"/api" cfg.host = "https://"+harbor_server+"/api"

View File

@ -1,105 +0,0 @@
# Copyright Project Harbor Authors
#
# 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 This resource contains all keywords related to creating, deleting, maintaining an instance of Admiral
Library Selenium2Library 5 5
Library OperatingSystem
*** Keywords ***
Install Admiral
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} run -d -p 8282:8282 --name admiral vmware/admiral:vic_v1.1.0
Should Be Equal As Integers 0 ${rc}
Set Environment Variable ADMIRAL_IP %{VCH-IP}:8282
:FOR ${idx} IN RANGE 0 10
\ ${out}= Run curl %{ADMIRAL_IP}
\ ${status}= Run Keyword And Return Status Should Contain ${out} <body class="admiral-default">
\ Return From Keyword If ${status}
\ Sleep 5
Fail Install Admiral failed: Admiral endpoint failed to respond to curl
Cleanup Admiral
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} rm -f admiral
Should Be Equal As Integers 0 ${rc}
Login To Admiral
[Arguments] ${url}=localhost:8282 ${browser}=chrome
Open Browser ${url} ${browser}
Maximize Browser Window
Wait Until Page Contains Welcome!
Wait Until Page Contains This is the place for you to create, provision, manage and monitor containerized applications.
Wait Until Element Is Visible css=button.btn.btn-primary.enter-btn
Wait Until Element Is Enabled css=button.btn.btn-primary.enter-btn
Click Button css=button.btn.btn-primary.enter-btn
Wait Until Element Is Visible css=div.query-search-input-controls.form-control
Wait Until Element Is Enabled css=div.query-search-input-controls.form-control
Wait Until Element Is Visible css=a.btn.btn-primary.addHost-btn
Wait Until Element Is Enabled css=a.btn.btn-primary.addHost-btn
Add Host To Admiral
[Arguments] ${address} ${credentials}=${EMPTY}
Wait Until Element Is Visible css=a[data-cmd='navigation-hosts']
Wait Until Element Is Enabled css=a[data-cmd='navigation-hosts']
Click Element css=a[data-cmd='navigation-hosts']
Wait Until Element Is Visible css=div.query-search-input-controls.form-control
Wait Until Element Is Enabled css=div.query-search-input-controls.form-control
Wait Until Element Is Visible css=a.btn.btn-primary.addHost-btn
Wait Until Element Is Enabled css=a.btn.btn-primary.addHost-btn
Click Element css=a.btn.btn-primary.addHost-btn
Wait Until Page Contains Add Host
Wait Until Element Is Visible address
Wait Until Element Is Enabled address
Wait Until Element Is Visible credential
Wait Until Element Is Enabled credential
Input Text css=#address > input.form-control ${address}
Select From List css=#hostType > div.select > select VCH
Run Keyword If '${credentials}' != '${EMPTY}' Click Element css=#credential > div.form-control > div.dropdown > button.dropdown-toggle
Run Keyword If '${credentials}' != '${EMPTY}' Click Element css=a[data-name=${credentials}]
Wait Until Element Is Visible css=a.btn.verifyHost
Wait Until Element Is Enabled css=a.btn.verifyHost
Click Element css=a.btn.verifyHost
Wait Until Page Contains Verified successfully!
Wait Until Element Is Visible css=button.btn.btn-primary.saveHost
Wait Until Element Is Enabled css=button.btn.btn-primary.saveHost
Click Button css=button.btn.btn-primary.saveHost
Wait Until Element Is Visible css=div.status.ON
Wait Until Element Is Enabled css=div.status.ON
Add Project to Admiral
[Arguments] ${name}
Wait Until Element Is Visible css=a[data-cmd='navigation-placements']
Wait Until Element Is Enabled css=a[data-cmd='navigation-placements']
Click Element css=a[data-cmd='navigation-placements']
Wait Until Element Is Visible css=div.right-context-panel > div.toolbar > div:nth-child(2) > a
Wait Until Element Is Enabled css=div.right-context-panel > div.toolbar > div:nth-child(2) > a
Click Element css=div.right-context-panel > div.toolbar > div:nth-child(2) > a
Wait Until Page Contains Project
Wait Until Element Is Visible css=div.right-context-panel > div.content > div > div.list-holder > div.inline-editable-list-holder > div.inline-editable-list > div.toolbar > a.new-item
Wait Until Element Is Enabled css=div.right-context-panel > div.content > div > div.list-holder > div.inline-editable-list-holder > div.inline-editable-list > div.toolbar > a.new-item
Click Element css=div.right-context-panel > div.content > div > div.list-holder > div.inline-editable-list-holder > div.inline-editable-list > div.toolbar > a.new-item
Input Text css=input.name-input ${name}
Click Element css=button.btn.btn-primary.inline-edit-save
Table Should Contain css=div.right-context-panel > div.content > div > div > div > div > table ${name}

View File

@ -1,31 +0,0 @@
# Copyright Project Harbor Authors
#
# 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 This resource contains any keywords related to using the Drone CI Build System
*** Keywords ***
Get State Of Drone Build
[Arguments] ${num}
Return From Keyword If '${num}' == '0' local
${out}= Run drone build info vmware/vic ${num}
${lines}= Split To Lines ${out}
[Return] @{lines}[2]
Get Title of Drone Build
[Arguments] ${num}
Return From Keyword If '${num}' == '0' local
${out}= Run drone build info vmware/vic ${num}
${lines}= Split To Lines ${out}
[Return] @{lines}[-1]

View File

@ -1,28 +0,0 @@
# Copyright Project Harbor Authors
#
# 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 This resource provides keywords to interact with Github
*** Keywords ***
Get State Of Github Issue
[Arguments] ${num}
[Tags] secret
:FOR ${idx} IN RANGE 0 5
\ ${status} ${result}= Run Keyword And Ignore Error Get https://api.github.com/repos/vmware/vic/issues/${num}?access_token\=%{GITHUB_AUTOMATION_API_KEY}
\ Exit For Loop If '${status}'
\ Sleep 1
Should Be Equal ${result.status_code} ${200}
${status}= Get From Dictionary ${result.json()} state
[Return] ${status}

View File

@ -193,11 +193,11 @@ Switch To Email
Sleep 1 Sleep 1
Config Email Config Email
Input Text xpath=//*[@id='mailServer'] smtp.vmware.com Input Text xpath=//*[@id='mailServer'] smtp.harbortest.com
Input Text xpath=//*[@id='emailPort'] 25 Input Text xpath=//*[@id='emailPort'] 25
Input Text xpath=//*[@id='emailUsername'] example@vmware.com Input Text xpath=//*[@id='emailUsername'] example@harbortest.com
Input Text xpath=//*[@id='emailPassword'] example Input Text xpath=//*[@id='emailPassword'] example
Input Text xpath=//*[@id='emailFrom'] example<example@vmware.com> Input Text xpath=//*[@id='emailFrom'] example<example@harbortest.com>
Sleep 1 Sleep 1
Retry Element Click xpath=//*[@id='emailSSL-wrapper']/label Retry Element Click xpath=//*[@id='emailSSL-wrapper']/label
Sleep 1 Sleep 1
@ -207,10 +207,10 @@ Config Email
Sleep 6 Sleep 6
Verify Email Verify Email
Textfield Value Should Be xpath=//*[@id='mailServer'] smtp.vmware.com Textfield Value Should Be xpath=//*[@id='mailServer'] smtp.harbortest.com
Textfield Value Should Be xpath=//*[@id='emailPort'] 25 Textfield Value Should Be xpath=//*[@id='emailPort'] 25
Textfield Value Should Be xpath=//*[@id='emailUsername'] example@vmware.com Textfield Value Should Be xpath=//*[@id='emailUsername'] example@harbortest.com
Textfield Value Should Be xpath=//*[@id='emailFrom'] example<example@vmware.com> Textfield Value Should Be xpath=//*[@id='emailFrom'] example<example@harbortest.com>
Checkbox Should Be Selected xpath=//*[@id='emailSSL'] Checkbox Should Be Selected xpath=//*[@id='emailSSL']
Checkbox Should Not Be Selected xpath=//*[@id='emailInsecure'] Checkbox Should Not Be Selected xpath=//*[@id='emailInsecure']

View File

@ -21,13 +21,16 @@ Resource ../../resources/Util.robot
*** Keywords *** *** Keywords ***
Sign In Harbor With OIDC User Sign In Harbor With OIDC User
[Arguments] ${url} ${username}=${OIDC_USERNAME} [Arguments] ${url} ${username}=${OIDC_USERNAME} ${password}=password ${is_onboard}=${false} ${username_claim}=${null} ${login_with_provider}=email
${head_username}= Set Variable xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown//button[contains(.,'${username}')] ${full_name}= Set Variable If '${login_with_provider}' == 'email' ${username}@example.com ${username}
${head_username}= Set Variable If '${username_claim}' == 'email' xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown//button[contains(.,'${full_name}')] xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown//button[contains(.,'${username}')]
Init Chrome Driver Init Chrome Driver
Go To ${url} Go To ${url}
Retry Element Click ${log_oidc_provider_btn} Retry Element Click ${log_oidc_provider_btn}
Retry Text Input ${dex_login_btn} ${username}@example.com Run Keyword If '${login_with_provider}' == 'email' Retry Element Click ${login_with_email_btn}
Retry Text Input ${dex_pwd_btn} password Run Keyword If '${login_with_provider}' == 'ldap' Retry Element Click ${login_with_ldap_btn}
Retry Text Input ${dex_login_btn} ${full_name}
Retry Text Input ${dex_pwd_btn} ${password}
Retry Element Click ${submit_login_btn} Retry Element Click ${submit_login_btn}
Retry Element Click ${grant_btn} Retry Element Click ${grant_btn}

View File

@ -17,6 +17,8 @@ Documentation This resource provides any keywords related to the Harbor private
*** Variables *** *** Variables ***
${log_oidc_provider_btn} //*[@id='log_oidc'] ${log_oidc_provider_btn} //*[@id='log_oidc']
${login_with_email_btn} //span[contains(., 'Log in with Email')]
${login_with_ldap_btn} //span[contains(., 'Log in with LDAP')]
${dex_login_btn} //*[@id='login'] ${dex_login_btn} //*[@id='login']
${dex_pwd_btn} //*[@id='password'] ${dex_pwd_btn} //*[@id='password']
${submit_login_btn} //*[@id='submit-login'] ${submit_login_btn} //*[@id='submit-login']

View File

@ -1,407 +0,0 @@
# Copyright Project Harbor Authors
#
# 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 This resource contains any keywords related to using the Nimbus cluster
*** Variables ***
${ESX_VERSION} 4564106 #6.5 RTM
${VC_VERSION} 4602587 #6.5 RTM
${NIMBUS_ESX_PASSWORD} e2eFunctionalTest
*** Keywords ***
Deploy Nimbus ESXi Server
[Arguments] ${user} ${password} ${version}=${ESX_VERSION} ${tls_disabled}=True
${name}= Evaluate 'ESX-' + str(random.randint(1000,9999)) modules=random
Log To Console \nDeploying Nimbus ESXi server: ${name}
Open Connection %{NIMBUS_GW}
Wait Until Keyword Succeeds 2 min 30 sec Login ${user} ${password}
:FOR ${IDX} IN RANGE 1 5
\ ${out}= Execute Command nimbus-esxdeploy ${name} --disk=48000000 --ssd=24000000 --memory=8192 --nics 2 ob-${version}
\ # Make sure the deploy actually worked
\ ${status}= Run Keyword And Return Status Should Contain ${out} To manage this VM use
\ Exit For Loop If ${status}
\ Log To Console ${out}
\ Log To Console Nimbus deployment ${IDX} failed, trying again in 5 minutes
\ Sleep 5 minutes
# Now grab the IP address and return the name and ip for later use
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} IP is
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip}= Remove String @{gotIP}[5] ,
# Let's set a password so govc doesn't complain
Remove Environment Variable GOVC_PASSWORD
Remove Environment Variable GOVC_USERNAME
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_URL root:@${ip}
${out}= Run govc host.account.update -id root -password ${NIMBUS_ESX_PASSWORD}
Should Be Empty ${out}
Run Keyword If ${tls_disabled} Disable TLS On ESX Host
Log To Console Successfully deployed new ESXi server - ${user}-${name}
Close connection
[Return] ${user}-${name} ${ip}
Deploy Multiple Nimbus ESXi Servers in Parallel
[Arguments] ${user} ${password} ${version}=${ESX_VERSION}
${name1}= Evaluate 'ESX-' + str(random.randint(1000,9999)) modules=random
${name2}= Evaluate 'ESX-' + str(random.randint(1000,9999)) modules=random
${name3}= Evaluate 'ESX-' + str(random.randint(1000,9999)) modules=random
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
${out1}= Deploy Nimbus ESXi Server Async ${name1}
${out2}= Deploy Nimbus ESXi Server Async ${name2}
${out3}= Deploy Nimbus ESXi Server Async ${name3}
Wait For Process ${out1}
Wait For Process ${out2}
Wait For Process ${out3}
${out}= Execute Command nimbus-ctl ip ${user}-${name1}
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} ${user}-${name1}
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip1}= Remove String @{gotIP}[2]
${out}= Execute Command nimbus-ctl ip ${user}-${name2}
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} ${user}-${name2}
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip2}= Remove String @{gotIP}[2]
${out}= Execute Command nimbus-ctl ip ${user}-${name3}
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} ${user}-${name3}
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip3}= Remove String @{gotIP}[2]
Log To Console \nDeploying Nimbus ESXi server: ${gotIP}
# Let's set a password so govc doesn't complain
Remove Environment Variable GOVC_PASSWORD
Remove Environment Variable GOVC_USERNAME
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_URL root:@${ip1}
${out}= Run govc host.account.update -id root -password ${NIMBUS_ESX_PASSWORD}
Should Be Empty ${out}
Disable TLS On ESX Host
Log To Console Successfully deployed new ESXi server - ${user}-${name1}
Log To Console \nNimbus ESXi server IP: ${ip1}
Remove Environment Variable GOVC_PASSWORD
Remove Environment Variable GOVC_USERNAME
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_URL root:@${ip2}
${out}= Run govc host.account.update -id root -password ${NIMBUS_ESX_PASSWORD}
Should Be Empty ${out}
Disable TLS On ESX Host
Log To Console Successfully deployed new ESXi server - ${user}-${name2}
Log To Console \nNimbus ESXi server IP: ${ip2}
Remove Environment Variable GOVC_PASSWORD
Remove Environment Variable GOVC_USERNAME
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_URL root:@${ip3}
${out}= Run govc host.account.update -id root -password ${NIMBUS_ESX_PASSWORD}
Should Be Empty ${out}
Disable TLS On ESX Host
Log To Console Successfully deployed new ESXi server - ${user}-${name3}
Log To Console \nNimbus ESXi server IP: ${ip3}
Close connection
[Return] ${user}-${name1} ${ip1} ${user}-${name2} ${ip2} ${user}-${name3} ${ip3}
Deploy Nimbus vCenter Server
[Arguments] ${user} ${password} ${version}=${VC_VERSION}
${name}= Evaluate 'VC-' + str(random.randint(1000,9999)) modules=random
Log To Console \nDeploying Nimbus vCenter server: ${name}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
:FOR ${IDX} IN RANGE 1 5
\ ${out}= Execute Command nimbus-vcvadeploy --vcvaBuild ${version} ${name}
\ # Make sure the deploy actually worked
\ ${status}= Run Keyword And Return Status Should Contain ${out} Overall Status: Succeeded
\ Exit For Loop If ${status}
\ Log To Console Nimbus deployment ${IDX} failed, trying again in 5 minutes
\ Sleep 5 minutes
# Now grab the IP address and return the name and ip for later use
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} Cloudvm is running on IP
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
${ip}= Fetch From Right ${line} ${SPACE}
Set Environment Variable GOVC_INSECURE 1
Set Environment Variable GOVC_USERNAME Administrator@vsphere.local
Set Environment Variable GOVC_PASSWORD Admin!23
Set Environment Variable GOVC_URL ${ip}
Log To Console Successfully deployed new vCenter server - ${user}-${name}
Close connection
[Return] ${user}-${name} ${ip}
Deploy Nimbus ESXi Server Async
[Tags] secret
[Arguments] ${name} ${version}=${ESX_VERSION}
Log To Console \nDeploying Nimbus ESXi server: ${name}
${out}= Run Secret SSHPASS command %{NIMBUS_USER} %{NIMBUS_PASSWORD} 'nimbus-esxdeploy ${name} --disk\=48000000 --ssd\=24000000 --memory\=8192 --nics 2 ${version}'
[Return] ${out}
Run Secret SSHPASS command
[Tags] secret
[Arguments] ${user} ${password} ${cmd}
${out}= Start Process sshpass -p ${password} ssh -o StrictHostKeyChecking\=no ${user}@%{NIMBUS_GW} ${cmd} shell=True
[Return] ${out}
Deploy Nimbus vCenter Server Async
[Tags] secret
[Arguments] ${name} ${version}=${VC_VERSION}
Log To Console \nDeploying Nimbus VC server: ${name}
${out}= Run Secret SSHPASS command %{NIMBUS_USER} %{NIMBUS_PASSWORD} 'nimbus-vcvadeploy --vcvaBuild ${version} ${name}'
[Return] ${out}
Deploy Nimbus Testbed
[Arguments] ${user} ${password} ${testbed}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
:FOR ${IDX} IN RANGE 1 5
\ ${out}= Execute Command nimbus-testbeddeploy ${testbed}
\ # Make sure the deploy actually worked
\ ${status}= Run Keyword And Return Status Should Contain ${out} is up. IP:
\ Exit For Loop If ${status}
\ Log To Console Nimbus deployment ${IDX} failed, trying again in 5 minutes
\ Sleep 5 minutes
[Return] ${out}
Kill Nimbus Server
[Arguments] ${user} ${password} ${name}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
${out}= Execute Command nimbus-ctl kill '${name}'
Close connection
Cleanup Nimbus PXE folder
[Arguments] ${user} ${password}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
${out}= Execute Command rm -rf public_html/pxe/*
Close connection
Nimbus Cleanup
[Arguments] ${vm_list} ${collect_log}=True ${dontDelete}=${false}
Run Keyword If ${collect_log} Run Keyword And Continue On Failure Gather Logs From Test Server
Run Keyword And Ignore Error Cleanup Nimbus PXE folder %{NIMBUS_USER} %{NIMBUS_PASSWORD}
Return From Keyword If ${dontDelete}
:FOR ${item} IN @{vm_list}
\ Run Keyword And Ignore Error Kill Nimbus Server %{NIMBUS_USER} %{NIMBUS_PASSWORD} ${item}
Gather Host IPs
${out}= Run govc ls host/cls
${out}= Split To Lines ${out}
${idx}= Set Variable 1
:FOR ${line} IN @{out}
\ Continue For Loop If '${line}' == '/vcqaDC/host/cls/Resources'
\ ${ip}= Fetch From Right ${line} /
\ Set Suite Variable ${esx${idx}-ip} ${ip}
\ ${idx}= Evaluate ${idx}+1
Create a VSAN Cluster
Log To Console \nStarting basic VSAN cluster deploy...
${out}= Deploy Nimbus Testbed %{NIMBUS_USER} %{NIMBUS_PASSWORD} --noSupportBundles --vcvaBuild ${VC_VERSION} --esxPxeDir ${ESX_VERSION} --esxBuild ${ESX_VERSION} --testbedName vcqa-vsan-simple-pxeBoot-vcva --runName vic-vmotion
${out}= Split To Lines ${out}
:FOR ${line} IN @{out}
\ ${status}= Run Keyword And Return Status Should Contain ${line} .vcva-${VC_VERSION}' is up. IP:
\ ${ip}= Run Keyword If ${status} Fetch From Right ${line} ${SPACE}
\ Run Keyword If ${status} Set Suite Variable ${vc-ip} ${ip}
\ Exit For Loop If ${status}
Log To Console Set environment variables up for GOVC
Set Environment Variable GOVC_URL ${vc-ip}
Set Environment Variable GOVC_USERNAME Administrator@vsphere.local
Set Environment Variable GOVC_PASSWORD Admin\!23
Log To Console Create a distributed switch
${out}= Run govc dvs.create -dc=vcqaDC test-ds
Should Contain ${out} OK
Log To Console Create three new distributed switch port groups for management and vm network traffic
${out}= Run govc dvs.portgroup.add -nports 12 -dc=vcqaDC -dvs=test-ds management
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=vcqaDC -dvs=test-ds vm-network
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=vcqaDC -dvs=test-ds bridge
Should Contain ${out} OK
Log To Console Add all the hosts to the distributed switch
${out}= Run govc dvs.add -dvs=test-ds -pnic=vmnic1 /vcqaDC/host/cls
Should Contain ${out} OK
Log To Console Enable DRS and VSAN on the cluster
${out}= Run govc cluster.change -drs-enabled /vcqaDC/host/cls
Should Be Empty ${out}
Log To Console Deploy VIC to the VC cluster
Set Environment Variable TEST_URL_ARRAY ${vc-ip}
Set Environment Variable TEST_USERNAME Administrator@vsphere.local
Set Environment Variable TEST_PASSWORD Admin\!23
Set Environment Variable BRIDGE_NETWORK bridge
Set Environment Variable PUBLIC_NETWORK vm-network
Set Environment Variable TEST_DATASTORE vsanDatastore
Set Environment Variable TEST_RESOURCE cls
Set Environment Variable TEST_TIMEOUT 30m
Gather Host IPs
Create a Simple VC Cluster
[Arguments] ${datacenter}=ha-datacenter ${cluster}=cls ${esx_number}=3 ${network}=True
Log To Console \nStarting simple VC cluster deploy...
${esx_names}= Create List
${esx_ips}= Create List
:FOR ${IDX} IN RANGE ${esx_number}
\ ${esx} ${esx_ip}= Deploy Nimbus ESXi Server %{NIMBUS_USER} %{NIMBUS_PASSWORD} ${ESX_VERSION} False
\ Append To List ${esx_names} ${esx}
\ Append To List ${esx_ips} ${esx_ip}
${vc} ${vc_ip}= Deploy Nimbus vCenter Server %{NIMBUS_USER} %{NIMBUS_PASSWORD}
Log To Console Create a datacenter on the VC
${out}= Run govc datacenter.create ${datacenter}
Should Be Empty ${out}
Log To Console Create a cluster on the VC
${out}= Run govc cluster.create ${cluster}
Should Be Empty ${out}
Log To Console Add ESX host to the VC
:FOR ${IDX} IN RANGE ${esx_number}
\ ${out}= Run govc cluster.add -hostname=@{esx_ips}[${IDX}] -username=root -dc=${datacenter} -password=${NIMBUS_ESX_PASSWORD} -noverify=true
\ Should Contain ${out} OK
Run Keyword If ${network} Setup Network For Simple VC Cluster ${esx_number} ${datacenter} ${cluster}
Log To Console Enable DRS on the cluster
${out}= Run govc cluster.change -drs-enabled /${datacenter}/host/${cluster}
Should Be Empty ${out}
Set Environment Variable TEST_URL_ARRAY ${vc_ip}
Set Environment Variable TEST_URL ${vc_ip}
Set Environment Variable TEST_USERNAME Administrator@vsphere.local
Set Environment Variable TEST_PASSWORD Admin\!23
Set Environment Variable TEST_DATASTORE datastore1
Set Environment Variable TEST_DATACENTER /${datacenter}
Set Environment Variable TEST_RESOURCE ${cluster}
Set Environment Variable TEST_TIMEOUT 30m
[Return] @{esx_names} ${vc} @{esx_ips} ${vc_ip}
Setup Network For Simple VC Cluster
[Arguments] ${esx_number} ${datacenter} ${cluster}
Log To Console Create a distributed switch
${out}= Run govc dvs.create -dc=${datacenter} test-ds
Should Contain ${out} OK
Log To Console Create three new distributed switch port groups for management and vm network traffic
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=test-ds management
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=test-ds vm-network
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=test-ds bridge
Should Contain ${out} OK
Log To Console Add all the hosts to the distributed switch
${out}= Run govc dvs.add -dvs=test-ds -pnic=vmnic1 /${datacenter}/host/${cluster}
Should Contain ${out} OK
Log To Console Enable DRS on the cluster
${out}= Run govc cluster.change -drs-enabled /${datacenter}/host/${cluster}
Should Be Empty ${out}
Set Environment Variable BRIDGE_NETWORK bridge
Set Environment Variable PUBLIC_NETWORK vm-network
Create A Distributed Switch
[Arguments] ${datacenter} ${dvs}=test-ds
Log To Console \nCreate a distributed switch
${out}= Run govc dvs.create -product-version 5.5.0 -dc=${datacenter} ${dvs}
Should Contain ${out} OK
Create Three Distributed Port Groups
[Arguments] ${datacenter} ${dvs}=test-ds
Log To Console \nCreate three new distributed switch port groups for management and vm network traffic
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=${dvs} management
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=${dvs} vm-network
Should Contain ${out} OK
${out}= Run govc dvs.portgroup.add -nports 12 -dc=${datacenter} -dvs=${dvs} bridge
Should Contain ${out} OK
Add Host To Distributed Switch
[Arguments] ${host} ${dvs}=test-ds
Log To Console \nAdd host(s) to the distributed switch
${out}= Run govc dvs.add -dvs=${dvs} -pnic=vmnic1 ${host}
Should Contain ${out} OK
Disable TLS On ESX Host
Log To Console \nDisable TLS on the host
${ver}= Get Vsphere Version
${out}= Run Keyword If '${ver}' != '5.5.0' Run govc host.option.set UserVars.ESXiVPsDisabledProtocols sslv3,tlsv1,tlsv1.1
Run Keyword If '${ver}' != '5.5.0' Should Be Empty ${out}
Get Vsphere Version
${out}= Run govc about
${out}= Split To Lines ${out}
:FOR ${line} IN @{out}
\ ${status}= Run Keyword And Return Status Should Contain ${line} Version:
\ Run Keyword And Return If ${status} Fetch From Right ${line} ${SPACE}
Deploy Nimbus NFS Datastore
[Arguments] ${user} ${password}
${name}= Evaluate 'NFS-' + str(random.randint(1000,9999)) modules=random
Log To Console \nDeploying Nimbus NFS server: ${name}
Open Connection %{NIMBUS_GW}
Login ${user} ${password}
${out}= Execute Command nimbus-nfsdeploy ${name}
# Make sure the deploy actually worked
Should Contain ${out} To manage this VM use
# Now grab the IP address and return the name and ip for later use
@{out}= Split To Lines ${out}
:FOR ${item} IN @{out}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} IP is
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
@{gotIP}= Split String ${line} ${SPACE}
${ip}= Remove String @{gotIP}[5] ,
Log To Console Successfully deployed new NFS server - ${user}-${name}
Close connection
[Return] ${user}-${name} ${ip}

View File

@ -1,97 +0,0 @@
# Copyright Project Harbor Authors
#
# 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 This resource provides any keywords related to Unified OVA
*** Variables ***
${ova_root_pwd} ova-test-root-pwd
${ova_appliance_options} --prop:root_pwd=${ova_root_pwd} --prop:permit_root_login=true
${ova_target_vm_name} harbor-unified-ova-integration-test
${ovftool_options} --noSSLVerify --acceptAllEulas --name=${ova_target_vm_name} --diskMode=thin --powerOn --X:waitForIp --X:injectOvfEnv --X:enableHiddenProperties
${ova_network_ip0} 10.17.109.207
${ova_network_netmask0} 255.255.255.0
${ova_network_gateway} 10.17.109.253
${ova_network_dns} 10.118.81.1
${ova_network_searchpath} eng.vmware.com
${ova_network_domain} mrburns
${ova_network_options} --prop:network.ip0=${ova_network_ip0} --prop:network.netmask0=${ova_network_netmask0} --prop:network.gateway=${ova_network_gateway} --prop:network.DNS=${ova_network_dns} --prop:network.searchpath=${ova_network_searchpath} --prop:network.domain=${ova_network_domain}
${ova_harbor_admin_password} harbor-admin-passwd
${ova_harbor_db_password} harbor-db-passwd
#${ova_service_options} --prop:auth_mode="%{AUTH_MODE}" --prop:clair_db_password="%{CLAIR_DB_PASSWORD}" --prop:max_job_workers="%{MAX_JOB_WORKERS}" --prop:harbor_admin_password="%{HARBOR_ADMIN_PASSWORD}" --prop:db_password="%{DB_PASSWORD}"
#${ova_options} ${ovftool_options} ${ova_appliance_options} ${ova_service_options}
#${ova_options_with_network} ${ova_options} ${ova_network_options}
${tls_not_disabled} False
*** Keywords ***
# Requires vc credential for govc
Deploy Harbor-OVA To Test Server
[Arguments] ${dhcp} ${protocol} ${build} ${user} ${password} ${ova_path} ${host} ${datastore} ${cluster} ${datacenter}
Log To Console \nCleanup environment...
Run Keyword And Ignore Error Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc vm.destroy ${ova_target_vm_name}
Run Keyword And Ignore Error Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc object.destroy /${datacenter}/vm/${ova_target_vm_name}
Log To Console \nStarting to deploy unified-ova to test server...
Run Keyword If ${dhcp} Log To Console ovftool --datastore=${datastore} ${ova_options} ${ova_path} 'vi://${user}:${password}@${host}/${datacenter}/host/${cluster}'
... ELSE Log To Console ovftool --datastore=${datastore} ${ova_options_with_network} ${ova_path} 'vi://${user}:${password}@${host}/${datacenter}/host/${cluster}'
${out}= Run Keyword If ${dhcp} Run ovftool --datastore=${datastore} ${ova_options} ${ova_path} 'vi://${user}:${password}@${host}/${datacenter}/host/${cluster}'
... ELSE Run ovftool --datastore=${datastore} ${ova_options_with_network} ${ova_path} 'vi://${user}:${password}@${host}/${datacenter}/host/${cluster}'
Should Contain ${out} Received IP address:
Should Not Contain ${out} None
${out}= Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc ls /ha-datacenter/host/cls/
${out}= Split To Lines ${out}
${idx}= Set Variable 1
:FOR ${line} IN @{out}
\ Continue For Loop If '${line}' == '/ha-datacenter/host/cls/Resources'
\ ${ip}= Fetch From Right ${line} /
\ Set Suite Variable ${esx${idx}-ip} ${ip}
\ ${idx}= Evaluate ${idx}+1
Run Keyword And Ignore Error Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc host.esxcli -host.ip=${esx1-ip} system settings advanced set -o /Net/GuestIPHack -i 1
${ip}= Run GOVC_URL=${host} GOVC_USERNAME=${user} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc vm.ip -esxcli harbor-unified-ova-integration-test
Set Environment Variable HARBOR_IP ${ip}
Log To Console \nHarbor IP: %{HARBOR_IP}
Wait for Harbor Ready ${protocol} %{HARBOR_IP}
[Return] %{HARBOR_IP}
# Requires vc credential for govc
Cleanup Harbor-OVA On Test Server
[Arguments] ${url}=%{GOVC_URL} ${username}=%{GOVC_USERNAME} ${password}=%{GOVC_PASSWORD}
${rc} ${output}= Run And Return Rc And Output GOVC_URL=${url} GOVC_USERNAME=${username} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc vm.destroy ${ova_target_vm_name}
Log ${output}
Should Be Equal As Integers ${rc} 0
Run Keyword And Ignore Error Run GOVC_URL=${url} GOVC_USERNAME=${username} GOVC_PASSWORD=${password} GOVC_INSECURE=1 govc object.destroy /%{TEST_DATACENTER}/vm/${ova_target_vm_name}
Log To Console \nUnified-OVA deployment is cleaned up on test server
Build Unified OVA
[Arguments] ${user}=%{TEST_USERNAME} ${password}=%{TEST_PASSWORD} ${host}=%{TEST_URL}
Log To Console \nStarting to build Unified OVA...
Log To Console \nRemove stale local OVA artifacts
Run Remove OVA Artifacts Locally
${out}= Run PACKER_ESX_HOST=${host} PACKER_USER=${user} PACKER_PASSWORD=${password} make ova-release
Log ${out}
@{out}= Split To Lines ${out}
Should Not Contain @{out}[-1] Error
Log To Console \nUnified OVA is built successfully

View File

@ -22,11 +22,6 @@ Library SSHLibrary 1 minute
Library DateTime Library DateTime
Library Selenium2Library 60 10 Library Selenium2Library 60 10
Library JSONLibrary Library JSONLibrary
Resource Nimbus-Util.robot
Resource Vsphere-Util.robot
Resource VCH-Util.robot
Resource Drone-Util.robot
Resource Github-Util.robot
Resource Harbor-Util.robot Resource Harbor-Util.robot
Resource Harbor-Pages/Public_Elements.robot Resource Harbor-Pages/Public_Elements.robot
Resource Harbor-Pages/HomePage.robot Resource Harbor-Pages/HomePage.robot
@ -68,7 +63,6 @@ Resource Harbor-Pages/OIDC_Auth_Elements.robot
Resource Harbor-Pages/Verify.robot Resource Harbor-Pages/Verify.robot
Resource Docker-Util.robot Resource Docker-Util.robot
Resource Helm-Util.robot Resource Helm-Util.robot
Resource OVA-Util.robot
Resource Cert-Util.robot Resource Cert-Util.robot
Resource SeleniumUtil.robot Resource SeleniumUtil.robot
Resource Nightly-Util.robot Resource Nightly-Util.robot

View File

@ -1,404 +0,0 @@
# Copyright Project Harbor Authors
#
# 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 This resource contains all keywords related to creating, deleting, maintaining VCHs
*** Keywords ***
Set Test Environment Variables
# Finish setting up environment variables
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set DRONE_BUILD_NUMBER
Run Keyword If '${status}' == 'FAIL' Set Environment Variable DRONE_BUILD_NUMBER 0
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set BRIDGE_NETWORK
Run Keyword If '${status}' == 'FAIL' Set Environment Variable BRIDGE_NETWORK network
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set PUBLIC_NETWORK
Run Keyword If '${status}' == 'FAIL' Set Environment Variable PUBLIC_NETWORK 'VM Network'
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set TEST_DATACENTER
Run Keyword If '${status}' == 'FAIL' Set Environment Variable TEST_DATACENTER ${SPACE}
@{URLs}= Split String %{TEST_URL_ARRAY}
${len}= Get Length ${URLs}
${IDX}= Evaluate %{DRONE_BUILD_NUMBER} \% ${len}
Set Environment Variable TEST_URL @{URLs}[${IDX}]
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
# TODO: need an integration/vic-test image update to include the about.cert command
#${rc} ${thumbprint}= Run And Return Rc And Output govc about.cert -k | jq -r .ThumbprintSHA1
${rc} ${thumbprint}= Run And Return Rc And Output openssl s_client -connect $(govc env -x GOVC_URL_HOST):443 </dev/null 2>/dev/null | openssl x509 -fingerprint -noout | cut -d= -f2
Should Be Equal As Integers ${rc} 0
Set Environment Variable TEST_THUMBPRINT ${thumbprint}
Log To Console \nTEST_URL=%{TEST_URL}
${host}= Run govc ls host
${status} ${message}= Run Keyword And Ignore Error Environment Variable Should Be Set TEST_RESOURCE
Run Keyword If '${status}' == 'FAIL' Set Environment Variable TEST_RESOURCE ${host}/Resources
Set Environment Variable GOVC_RESOURCE_POOL %{TEST_RESOURCE}
${noQuotes}= Strip String %{TEST_DATASTORE} characters="
Set Environment Variable GOVC_DATASTORE ${noQuotes}
${about}= Run govc about
${status}= Run Keyword And Return Status Should Contain ${about} VMware ESXi
Run Keyword If ${status} Set Environment Variable HOST_TYPE ESXi
Run Keyword Unless ${status} Set Environment Variable HOST_TYPE VC
${about}= Run govc datastore.info %{TEST_DATASTORE} | grep 'Type'
${status}= Run Keyword And Return Status Should Contain ${about} vsan
Run Keyword If ${status} Set Environment Variable DATASTORE_TYPE VSAN
Run Keyword Unless ${status} Set Environment Variable DATASTORE_TYPE Non_VSAN
# set the TLS config options suitable for vic-machine in this env
${domain}= Get Environment Variable DOMAIN ''
Run Keyword If $domain == '' Set Suite Variable ${vicmachinetls} --no-tlsverify
Run Keyword If $domain != '' Set Suite Variable ${vicmachinetls} --tls-cname=*.${domain}
Set Test VCH Name
# Set a unique bridge network for each VCH that has a random VLAN ID
${vlan}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Evaluate str(random.randint(1, 4093)) modules=random
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.add -vlan=${vlan} -vswitch vSwitchLAN %{VCH-NAME}-bridge
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Set Environment Variable BRIDGE_NETWORK %{VCH-NAME}-bridge
Set Test VCH Name
${name}= Evaluate 'VCH-%{DRONE_BUILD_NUMBER}-' + str(random.randint(1000,9999)) modules=random
Set Environment Variable VCH-NAME ${name}
Set List Of Env Variables
[Arguments] ${vars}
@{vars}= Split String ${vars}
:FOR ${var} IN @{vars}
\ ${varname} ${varval}= Split String ${var} =
\ Set Environment Variable ${varname} ${varval}
Parse Environment Variables
[Arguments] ${line}
# If using the old logging format
${status}= Run Keyword And Return Status Should Contain ${line} mINFO
${logdeco} ${vars}= Run Keyword If ${status} Split String ${line} ${SPACE} 1
Run Keyword If ${status} Set List Of Env Variables ${vars}
Return From Keyword If ${status}
# Split the log log into pieces, discarding the initial log decoration, and assign to env vars
${logmon} ${logday} ${logyear} ${logtime} ${loglevel} ${vars}= Split String ${line} max_split=5
Set List Of Env Variables ${vars}
Get Docker Params
# Get VCH docker params e.g. "-H 192.168.218.181:2376 --tls"
[Arguments] ${output} ${certs}
@{output}= Split To Lines ${output}
:FOR ${item} IN @{output}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} DOCKER_HOST=
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
# Ensure we start from a clean slate with docker env vars
Remove Environment Variable DOCKER_HOST DOCKER_TLS_VERIFY DOCKER_CERT_PATH CURL_CA_BUNDLE COMPOSE_PARAMS COMPOSE_TLS_VERSION
Parse Environment Variables ${line}
${dockerHost}= Get Environment Variable DOCKER_HOST
@{hostParts}= Split String ${dockerHost} :
${ip}= Strip String @{hostParts}[0]
${port}= Strip String @{hostParts}[1]
Set Environment Variable VCH-IP ${ip}
Set Environment Variable VCH-PORT ${port}
:FOR ${index} ${item} IN ENUMERATE @{output}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} http
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${line} ${item}
\ ${status} ${message}= Run Keyword And Ignore Error Should Contain ${item} Published ports can be reached at
\ ${idx} = Evaluate ${index} + 1
\ Run Keyword If '${status}' == 'PASS' Set Suite Variable ${ext-ip} @{output}[${idx}]
${rest} ${ext-ip} = Split String From Right ${ext-ip} ${SPACE} 1
${ext-ip} = Strip String ${ext-ip}
Set Environment Variable EXT-IP ${ext-ip}
${rest} ${vic-admin}= Split String From Right ${line} ${SPACE} 1
Set Environment Variable VIC-ADMIN ${vic-admin}
Run Keyword If ${port} == 2376 Set Environment Variable VCH-PARAMS -H ${dockerHost} --tls
Run Keyword If ${port} == 2375 Set Environment Variable VCH-PARAMS -H ${dockerHost}
### Add environment variables for Compose and TLS
# Check if tls is enable from vic-machine's output and not trust ${certs} which some tests bypasses
${tls_enabled}= Get Environment Variable DOCKER_TLS_VERIFY ${false}
### Compose case for no-tlsverify
# Set environment variables if certs not used to create the VCH. This is NOT the recommended
# approach to running compose. There will be security warnings in the logs and some compose
# operations may not work properly because certs == false currently means we install with
# --no-tlsverify. Add CURL_CA_BUNDLE for a workaround in compose tests. If we change
# certs == false to install with --no-tls, then we need to change this again.
Run Keyword If ${tls_enabled} == ${false} Set Environment Variable CURL_CA_BUNDLE ${EMPTY}
# Get around quirk in compose if no-tlsverify, then CURL_CA_BUNDLE must exist and compose called with --tls
Run Keyword If ${tls_enabled} == ${false} Set Environment Variable COMPOSE-PARAMS -H ${dockerHost} --tls
### Compose case for tlsverify (assumes DOCKER_TLS_VERIFY also set)
Run Keyword If ${tls_enabled} == ${true} Set Environment Variable COMPOSE_TLS_VERSION TLSv1_2
Run Keyword If ${tls_enabled} == ${true} Set Environment Variable COMPOSE-PARAMS -H ${dockerHost}
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}
Set Test Environment Variables
# disable firewall
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.esxcli network firewall set -e false
# Attempt to cleanup old/canceled tests
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling VMs On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Datastore On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling Networks On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling vSwitches On Test Server
Run Keyword If ${cleanup} Run Keyword And Ignore Error Cleanup Dangling Containers On Test Server
# Install the VCH now
Log To Console \nInstalling VCH to test server...
${output}= Run VIC Machine Command ${vic-machine} ${appliance-iso} ${bootstrap-iso} ${certs} ${vol}
Log ${output}
Should Contain ${output} Installer completed successfully
Get Docker Params ${output} ${certs}
Log To Console Installer completed successfully: %{VCH-NAME}...
Run VIC Machine Command
[Tags] secret
[Arguments] ${vic-machine} ${appliance-iso} ${bootstrap-iso} ${certs} ${vol}
${output}= Run Keyword If ${certs} Run ${vic-machine} create --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --appliance-iso=${appliance-iso} --bootstrap-iso=${bootstrap-iso} --password=%{TEST_PASSWORD} --force=true --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/test:${vol} ${vicmachinetls}
Run Keyword If ${certs} Should Contain ${output} Installer completed successfully
Return From Keyword If ${certs} ${output}
${output}= Run Keyword Unless ${certs} Run ${vic-machine} create --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL}%{TEST_DATACENTER} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --image-store=%{TEST_DATASTORE} --appliance-iso=${appliance-iso} --bootstrap-iso=${bootstrap-iso} --password=%{TEST_PASSWORD} --force=true --bridge-network=%{BRIDGE_NETWORK} --public-network=%{PUBLIC_NETWORK} --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --volume-store=%{TEST_DATASTORE}/test:${vol} --no-tlsverify
Run Keyword Unless ${certs} Should Contain ${output} Installer completed successfully
[Return] ${output}
Run Secret VIC Machine Delete Command
[Tags] secret
[Arguments] ${vch-name}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux delete --name=${vch-name} --target=%{TEST_URL}%{TEST_DATACENTER} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --force=true --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT}
[Return] ${rc} ${output}
Run Secret VIC Machine Inspect Command
[Tags] secret
[Arguments] ${name}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect --name=${name} --target=%{TEST_URL}%{TEST_DATACENTER} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --thumbprint=%{TEST_THUMBPRINT}
[Return] ${rc} ${output}
Run VIC Machine Delete Command
${rc} ${output}= Run Secret VIC Machine Delete Command %{VCH-NAME}
Wait Until Keyword Succeeds 6x 5s Check Delete Success %{VCH-NAME}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Completed successfully
${output}= Run rm -rf %{VCH-NAME}
[Return] ${output}
Run VIC Machine Inspect Command
${rc} ${output}= Run Secret VIC Machine Inspect Command %{VCH-NAME}
Get Docker Params ${output} ${true}
Gather Logs From Test Server
[Tags] secret
Run Keyword And Continue On Failure Run zip %{VCH-NAME}-certs -r %{VCH-NAME}
${out}= Run curl -k -D vic-admin-cookies -Fusername=%{TEST_USERNAME} -Fpassword=%{TEST_PASSWORD} %{VIC-ADMIN}/authentication
Log ${out}
${out}= Run curl -k -b vic-admin-cookies %{VIC-ADMIN}/container-logs.zip -o ${SUITE NAME}-%{VCH-NAME}-container-logs.zip
Log ${out}
Remove File vic-admin-cookies
${out}= Run govc datastore.download %{VCH-NAME}/vmware.log %{VCH-NAME}-vmware.log
Should Contain ${out} OK
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc logs -log=vmkernel -n=10000 > vmkernel.log
Check For The Proper Log Files
[Arguments] ${container}
# Ensure container logs are correctly being gathered for debugging purposes
${rc} ${output}= Run And Return Rc and Output curl -sk %{VIC-ADMIN}/authentication -XPOST -F username=%{TEST_USERNAME} -F password=%{TEST_PASSWORD} -D /tmp/cookies-%{VCH-NAME}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc and Output curl -sk %{VIC-ADMIN}/container-logs.tar.gz -b /tmp/cookies-%{VCH-NAME} | tar tvzf -
Should Be Equal As Integers ${rc} 0
Log ${output}
Should Contain ${output} ${container}/output.log
Should Contain ${output} ${container}/vmware.log
Should Contain ${output} ${container}/tether.debug
Scrape Logs For the Password
[Tags] secret
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/authentication -XPOST -F username=%{TEST_USERNAME} -F password=%{TEST_PASSWORD} -D /tmp/cookies-%{VCH-NAME}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/logs/port-layer.log -b /tmp/cookies-%{VCH-NAME} | grep -q "%{TEST_PASSWORD}"
Should Be Equal As Integers ${rc} 1
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/logs/init.log -b /tmp/cookies-%{VCH-NAME} | grep -q "%{TEST_PASSWORD}"
Should Be Equal As Integers ${rc} 1
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/logs/docker-personality.log -b /tmp/cookies-%{VCH-NAME} | grep -q "%{TEST_PASSWORD}"
Should Be Equal As Integers ${rc} 1
${rc}= Run And Return Rc curl -sk %{VIC-ADMIN}/logs/vicadmin.log -b /tmp/cookies-%{VCH-NAME} | grep -q "%{TEST_PASSWORD}"
Should Be Equal As Integers ${rc} 1
Remove File /tmp/cookies-%{VCH-NAME}
Cleanup VIC Appliance On Test Server
Log To Console Gathering logs from the test server %{VCH-NAME}
Gather Logs From Test Server
Log To Console Deleting the VCH appliance %{VCH-NAME}
${output}= Run VIC Machine Delete Command
Run Keyword And Ignore Error Cleanup VCH Bridge Network %{VCH-NAME}
[Return] ${output}
Cleanup VCH Bridge Network
[Arguments] ${name}
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.remove ${name}-bridge
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.portgroup.info
Run Keyword If '%{HOST_TYPE}' == 'ESXi' Should Not Contain ${out} ${name}-bridge
Cleanup Datastore On Test Server
${out}= Run govc datastore.ls
${items}= Split To Lines ${out}
:FOR ${item} IN @{items}
\ ${build}= Split String ${item} -
\ # Skip any item that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any item that is still running
\ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running'
\ Log To Console Removing the following item from datastore: ${item}
\ ${out}= Run govc datastore.rm ${item}
\ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${item}
Cleanup Dangling VMs On Test Server
${out}= Run govc ls vm
${vms}= Split To Lines ${out}
:FOR ${vm} IN @{vms}
\ ${vm}= Fetch From Right ${vm} /
\ ${build}= Split String ${vm} -
\ # Skip any VM that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any VM that is still running
\ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running'
\ ${uuid}= Run govc vm.info -json\=true ${vm} | jq -r '.VirtualMachines[0].Config.Uuid'
\ Log To Console Destroying dangling VCH: ${vm}
\ ${rc} ${output}= Run Secret VIC Machine Delete Command ${vm}
\ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${vm}
Cleanup Dangling Networks On Test Server
${out}= Run govc ls network
${nets}= Split To Lines ${out}
:FOR ${net} IN @{nets}
\ ${net}= Fetch From Right ${net} /
\ ${build}= Split String ${net} -
\ # Skip any Network that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any Network that is still running
\ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running'
\ ${uuid}= Run govc host.portgroup.remove ${net}
Cleanup Dangling vSwitches On Test Server
${out}= Run Keyword If '%{HOST_TYPE}' == 'ESXi' Run govc host.vswitch.info | grep VCH
${nets}= Split To Lines ${out}
:FOR ${net} IN @{nets}
\ ${net}= Fetch From Right ${net} ${SPACE}
\ ${build}= Split String ${net} -
\ # Skip any vSwitch that is not associated with integration tests
\ Continue For Loop If '@{build}[0]' != 'VCH'
\ # Skip any vSwitch that is still running
\ ${state}= Get State Of Drone Build @{build}[1]
\ Continue For Loop If '${state}' == 'running'
\ ${uuid}= Run govc host.vswitch.remove ${net}
Get Scratch Disk From VM Info
[Arguments] ${vm}
${disks}= Run govc vm.info -json ${vm} | jq -r '.VirtualMachines[].Layout.Disk[].DiskFile[]'
${disks}= Split To Lines ${disks}
:FOR ${disk} IN @{disks}
\ ${disk}= Fetch From Right ${disk} ${SPACE}
\ ${status}= Run Keyword And Return Status Should Contain ${disk} scratch.vmdk
\ Return From Keyword If ${status} ${disk}
Cleanup Dangling Containers On Test Server
${vms}= Run govc ls vm
${vms}= Split To Lines ${vms}
:FOR ${vm} IN @{vms}
\ # Ignore VCH's, we only care about containers at this point
\ ${status}= Run Keyword And Return Status Should Contain ${vm} VCH
\ Continue For Loop If ${status}
\ ${disk}= Get Scratch Disk From VM Info ${vm}
\ ${vch}= Fetch From Left ${disk} /
\ ${vch}= Split String ${vch} -
\ # Skip any VM that is not associated with integration tests
\ Continue For Loop If '@{vch}[0]' != 'VCH'
\ ${state}= Get State Of Drone Build @{vch}[1]
\ # Skip any VM that is still running
\ Continue For Loop If '${state}' == 'running'
\ # Destroy the VM and remove it from datastore because it is a dangling container
\ Log To Console Cleaning up dangling container: ${vm}
\ ${out}= Run govc vm.destroy ${vm}
\ ${name}= Fetch From Right ${vm} /
\ ${out}= Run govc datastore.rm ${name}
\ Wait Until Keyword Succeeds 6x 5s Check Delete Success ${name}
# VCH upgrade helpers
Install VIC with version to Test Server
[Arguments] ${version}=7315 ${insecureregistry}=
Log To Console \nDownloading vic ${version} from bintray...
${rc} ${output}= Run And Return Rc And Output wget https://bintray.com/vmware/vic-repo/download_file?file_path=vic_${version}.tar.gz -O vic.tar.gz
${rc} ${output}= Run And Return Rc And Output tar zxvf vic.tar.gz
Set Environment Variable TEST_TIMEOUT 20m0s
Install VIC Appliance To Test Server vic-machine=./vic/vic-machine-linux appliance-iso=./vic/appliance.iso bootstrap-iso=./vic/bootstrap.iso certs=${false} vol=default ${insecureregistry}
Set Environment Variable VIC-ADMIN %{VCH-IP}:2378
Set Environment Variable INITIAL-VERSION ${version}
Clean up VIC Appliance And Local Binary
Cleanup VIC Appliance On Test Server
Run rm -rf vic.tar.gz vic
Upgrade
Log To Console \nUpgrading VCH...
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux upgrade --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --force=true --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT}
Should Contain ${output} Completed successfully
Should Not Contain ${output} Rolling back upgrade
Should Be Equal As Integers ${rc} 0
Check Upgraded Version
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version
@{vers}= Split String ${output}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} Completed successfully
Should Contain ${output} @{vers}[2]
Should Not Contain ${output} %{INITIAL-VERSION}
Should Be Equal As Integers ${rc} 0
Log ${output}
Get Docker Params ${output} ${true}
Check Original Version
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux version
@{vers}= Split String ${output}
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux inspect --name=%{VCH-NAME} --target=%{TEST_URL} --thumbprint=%{TEST_THUMBPRINT} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --compute-resource=%{TEST_RESOURCE}
Should Contain ${output} Completed successfully
Should Contain ${output} @{vers}[2]
Should Be Equal As Integers ${rc} 0
Log ${output}
Get Docker Params ${output} ${true}
Rollback
Log To Console \nTesting rollback...
${rc} ${output}= Run And Return Rc And Output bin/vic-machine-linux upgrade --debug 1 --name=%{VCH-NAME} --target=%{TEST_URL} --user=%{TEST_USERNAME} --password=%{TEST_PASSWORD} --force=true --compute-resource=%{TEST_RESOURCE} --timeout %{TEST_TIMEOUT} --rollback
Should Contain ${output} Completed successfully
Should Be Equal As Integers ${rc} 0
Enable VCH SSH
[Arguments] ${vic-machine}=bin/vic-machine-linux ${rootpw}=%{TEST_PASSWORD} ${target}=%{TEST_URL} ${password}=%{TEST_PASSWORD} ${thumbprint}=%{TEST_THUMBPRINT} ${name}=%{VCH-NAME} ${user}=%{TEST_USERNAME} ${resource}=%{TEST_RESOURCE}
Log To Console \nEnable SSH on vch...
${rc} ${output}= Run And Return Rc And Output ${vic-machine} debug --rootpw ${rootpw} --target ${target} --password ${password} --thumbprint ${thumbprint} --name ${name} --user ${user} --compute-resource ${resource} --enable-ssh
Should Be Equal As Integers ${rc} 0
Should Contain ${output} Completed successfully

View File

@ -1,215 +0,0 @@
# Copyright Project Harbor Authors
#
# 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 This resource contains any keywords dealing with operations being performed on a Vsphere instance, mostly govc wrappers
*** Keywords ***
Power On VM OOB
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
${rc} ${output}= Run And Return Rc And Output GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.power -on "${vm}"
Should Be Equal As Integers ${rc} 0
Log To Console Waiting for VM to power on ...
Wait Until VM Powers On "${vm}" ${vc_host} ${vc_user} ${vc_password}
Power Off VM OOB
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
${rc} ${output}= Run And Return Rc And Output GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.power -off "${vm}"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
Log To Console Waiting for VM to power off ...
Wait Until VM Powers Off "${vm}" ${vc_host} ${vc_user} ${vc_password}
Destroy VM OOB
[Arguments] ${vm}
${rc} ${output}= Run And Return Rc And Output govc vm.destroy "*-${vm}"
Should Be Equal As Integers ${rc} 0
Put Host Into Maintenance Mode
${rc} ${output}= Run And Return Rc And Output govc host.maintenance.enter -host.ip=%{TEST_URL}
Should Contain ${output} entering maintenance mode... OK
Remove Host From Maintenance Mode
${rc} ${output}= Run And Return Rc And Output govc host.maintenance.exit -host.ip=%{TEST_URL}
Should Contain ${output} exiting maintenance mode... OK
Reboot VM
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
Log To Console Rebooting ${vm} ...
Power Off VM OOB ${vm} ${vc_host} ${vc_user} ${vc_password}
Power On VM OOB ${vm} ${vc_host} ${vc_user} ${vc_password}
Log To Console ${vm} Powered On
Reset VM
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
${rc} ${output}= Run And Return Rc And Output GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.power -reset "${vm}"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
Log To Console Waiting for VM to reset ...
Wait Until VM Powers On "${vm}" ${vc_host} ${vc_user} ${vc_password}
Wait Until VM Powers On
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
:FOR ${idx} IN RANGE 0 30
\ ${ret}= Run GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.info ${vm}
\ Set Test Variable ${out} ${ret}
\ ${status}= Run Keyword And Return Status Should Contain ${out} poweredOn
\ Return From Keyword If ${status}
\ Sleep 1
Fail VM did not power on within 30 seconds
Wait Until VM Powers Off
[Arguments] ${vm} ${vc_host} ${vc_user} ${vc_password}
:FOR ${idx} IN RANGE 0 30
\ ${ret}= Run GOVC_URL=${vc_host} GOVC_USERNAME=${vc_user} GOVC_PASSWORD=${vc_password} GOVC_INSECURE=1 govc vm.info ${vm}
\ Set Test Variable ${out} ${ret}
\ ${status}= Run Keyword And Return Status Should Contain ${out} poweredOff
\ Return From Keyword If ${status}
\ Sleep 1
Fail VM did not power off within 30 seconds
Wait Until VM Is Destroyed
[Arguments] ${vm}
:FOR ${idx} IN RANGE 0 30
\ ${ret}= Run govc ls vm/${vm}
\ Set Test Variable ${out} ${ret}
\ ${status}= Run Keyword And Return Status Should Be Empty ${out}
\ Return From Keyword If ${status}
\ Sleep 1
Fail VM was not destroyed within 30 seconds
Get VM IP
[Arguments] ${vm}
${rc} ${out}= Run And Return Rc And Output govc vm.ip ${vm}
Should Be Equal As Integers ${rc} 0
[Return] ${out}
Get VM Host Name
[Arguments] ${vm}
${out}= Run govc vm.info ${vm}
${out}= Split To Lines ${out}
${host}= Fetch From Right @{out}[-1] ${SPACE}
[Return] ${host}
Get VM Info
[Arguments] ${vm}
${rc} ${out}= Run And Return Rc And Output govc vm.info -r ${vm}
Should Be Equal As Integers ${rc} 0
[Return] ${out}
vMotion A VM
[Arguments] ${vm}
${host}= Get VM Host Name ${vm}
${status}= Run Keyword And Return Status Should Contain ${host} ${esx1-ip}
Run Keyword If ${status} Run govc vm.migrate -host cls/${esx2-ip} -pool cls/Resources ${vm}
Run Keyword Unless ${status} Run govc vm.migrate -host cls/${esx1-ip} -pool cls/Resources ${vm}
Create Test Server Snapshot
[Arguments] ${vm} ${snapshot}
Set Environment Variable GOVC_URL %{BUILD_SERVER}
${rc} ${out}= Run And Return Rc And Output govc snapshot.create -vm ${vm} ${snapshot}
Should Be Equal As Integers ${rc} 0
Should Be Empty ${out}
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
Revert Test Server Snapshot
[Arguments] ${vm} ${snapshot}
Set Environment Variable GOVC_URL %{BUILD_SERVER}
${rc} ${out}= Run And Return Rc And Output govc snapshot.revert -vm ${vm} ${snapshot}
Should Be Equal As Integers ${rc} 0
Should Be Empty ${out}
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
Delete Test Server Snapshot
[Arguments] ${vm} ${snapshot}
Set Environment Variable GOVC_URL %{BUILD_SERVER}
${rc} ${out}= Run And Return Rc And Output govc snapshot.remove -vm ${vm} ${snapshot}
Should Be Equal As Integers ${rc} 0
Should Be Empty ${out}
Set Environment Variable GOVC_URL %{TEST_USERNAME}:%{TEST_PASSWORD}@%{TEST_URL}
Setup Snapshot
${hostname}= Get Test Server Hostname
Set Environment Variable TEST_HOSTNAME ${hostname}
Set Environment Variable SNAPSHOT vic-ci-test-%{DRONE_BUILD_NUMBER}
Create Test Server Snapshot %{TEST_HOSTNAME} %{SNAPSHOT}
Get Datacenter Name
${out}= Run govc datacenter.info
${out}= Split To Lines ${out}
${name}= Fetch From Right @{out}[0] ${SPACE}
[Return] ${name}
Get Test Server Hostname
[Tags] secret
${hostname}= Run sshpass -p $TEST_PASSWORD ssh $TEST_USERNAME@$TEST_URL hostname
[Return] ${hostname}
Check Delete Success
[Arguments] ${name}
${out}= Run govc ls vm
Log ${out}
Should Not Contain ${out} ${name}
${out}= Run govc datastore.ls
Log ${out}
Should Not Contain ${out} ${name}
${out}= Run govc ls host/*/Resources/*
Log ${out}
Should Not Contain ${out} ${name}
Gather Logs From ESX Server
Environment Variable Should Be Set TEST_URL
${out}= Run govc logs.download
Change Log Level On Server
[Arguments] ${level}
${out}= Run govc host.option.set Config.HostAgent.log.level ${level}
Should Be Empty ${out}
Add Vsphere License
[Tags] secret
[Arguments] ${license}
${out}= Run govc license.add ${license}
Should Contain ${out} Key:
Assign Vsphere License
[Tags] secret
[Arguments] ${license} ${host}
${out}= Run govc license.assign -host ${host} ${license}
Should Contain ${out} Key:
Add Host To VCenter
[Arguments] ${host} ${user} ${dc} ${pw}
:FOR ${idx} IN RANGE 1 4
\ ${out}= Run govc cluster.add -hostname=${host} -username=${user} -dc=${dc} -password=${pw} -noverify=true
\ ${status}= Run Keyword And Return Status Should Contain ${out} OK
\ Return From Keyword If ${status}
Fail Failed to add the host to the VC in 3 attempts
Get Host Firewall Enabled
${output}= Run govc host.esxcli network firewall get
Should Contain ${output} Enabled
@{output}= Split To Lines ${output}
:FOR ${line} IN @{output}
\ Run Keyword If "Enabled" in '''${line}''' Set Test Variable ${out} ${line}
${enabled}= Fetch From Right ${out} :
${enabled}= Strip String ${enabled}
Return From Keyword If '${enabled}' == 'false' ${false}
Return From Keyword If '${enabled}' == 'true' ${true}
Enable Host Firewall
Run govc host.esxcli network firewall set --enabled true
Disable Host Firewall
Run govc host.esxcli network firewall set --enabled false

View File

@ -27,7 +27,7 @@ Test Case - Registry Basic Verfication
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
Push image ${ip} tester${d} Test1@34 project${d} busybox:latest Push image ${ip} tester${d} Test1@34 project${d} busybox:latest
Pull image ${ip} tester${d} Test1@34 project${d} busybox:latest Pull image ${ip} tester${d} Test1@34 project${d} busybox:latest
Go Into Project project${d} Go Into Project project${d}
@ -38,7 +38,7 @@ Test Case - Registry Basic Verfication
Test Case - Clair Basic Verfication Test Case - Clair Basic Verfication
Init Chrome Driver Init Chrome Driver
${d}= get current date result_format=%m%s ${d}= get current date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
Push Image ${ip} tester${d} Test1@34 project${d} hello-world Push Image ${ip} tester${d} Test1@34 project${d} hello-world
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/hello-world Go Into Repo project${d}/hello-world

View File

@ -1,17 +1,16 @@
# Copyright Project Harbor Authors
// Copyright (c) 2017 VMware, Inc. All Rights Reserved. #
// # Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License. # You may obtain a copy of the License at
// You may obtain a copy of the License at #
// # http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0 #
// # Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and # limitations under the License
// limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs

View File

@ -1,17 +1,16 @@
# Copyright Project Harbor Authors
// Copyright (c) 2017 VMware, Inc. All Rights Reserved. #
// # Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License. # You may obtain a copy of the License at
// You may obtain a copy of the License at #
// # http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0 #
// # Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and # limitations under the License
// limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs

View File

@ -1,17 +1,16 @@
# Copyright Project Harbor Authors
// Copyright (c) 2017 VMware, Inc. All Rights Reserved. #
// # Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License. # You may obtain a copy of the License at
// You may obtain a copy of the License at #
// # http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0 #
// # Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and # limitations under the License
// limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs

View File

@ -1,17 +1,16 @@
# Copyright Project Harbor Authors
// Copyright (c) 2017 VMware, Inc. All Rights Reserved. #
// # Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License. # You may obtain a copy of the License at
// You may obtain a copy of the License at #
// # http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0 #
// # Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and # limitations under the License
// limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs

View File

@ -33,20 +33,20 @@ Test Case - Create An New User
Enable Self Reg Enable Self Reg
Logout Harbor Logout Harbor
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Close Browser Close Browser
Test Case - Update User Comment Test Case - Update User Comment
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Update User Comment Test12#4 Update User Comment Test12#4
Logout Harbor Logout Harbor
Test Case - Update Password Test Case - Update Password
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Change Password Test1@34 Test12#4 Change Password Test1@34 Test12#4
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} tester${d} Test12#4 Sign In Harbor ${HARBOR_URL} tester${d} Test12#4
@ -55,11 +55,11 @@ Test Case - Update Password
Test Case - Delete Multi User Test Case - Delete Multi User
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} deletea${d} testa${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} deletea${d} testa${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor Logout Harbor
Create An New User ${HARBOR_URL} deleteb${d} testb${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} deleteb${d} testb${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor Logout Harbor
Create An New User ${HARBOR_URL} deletec${d} testc${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} deletec${d} testc${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} admin Harbor12345 Sign In Harbor ${HARBOR_URL} admin Harbor12345
Switch To User Tag Switch To User Tag
@ -86,3 +86,22 @@ Test Case - Edit Self-Registration
# Restore setting # Restore setting
Enable Self Reg Enable Self Reg
Close Browser Close Browser
Test Case - Admin Add New Users
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
# can add a new user when self-reg is enbled
Switch To Configure
Self Reg Should Be Enabled
Switch to User Tag
Add A New User username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
# can add a new user when self-reg is disabled
Switch To Configure
Self Reg Should Be Enabled
Sleep 1
Disable Self Reg
Self Reg Should Be Disabled
Switch to User Tag
Add A New User username=tester2${d} email=tester2${d}@harbortest.com realname=harbortest2 newPassword=Test1@34 comment=harbortest2
Close Browser

View File

@ -1,16 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved. # Copyright Project Harbor Authors
// #
// Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
// You may obtain a copy of the License at # You may obtain a copy of the License at
// #
// http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
// #
// Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
// limitations under the License. # limitations under the License
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
@ -38,7 +38,7 @@ Test Case - Clair Is Default Scanner And It Is immutable
Test Case - Read Only Mode Test Case - Read Only Mode
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
Enable Read Only Enable Read Only
Cannot Push image ${ip} tester${d} Test1@34 project${d} busybox:latest Cannot Push image ${ip} tester${d} Test1@34 project${d} busybox:latest
@ -94,7 +94,7 @@ Test Case - Staticsinfo
Test Case - Create An New User Test Case - Create An New User
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Close Browser Close Browser
Test Case - Sign With Admin Test Case - Sign With Admin
@ -105,14 +105,14 @@ Test Case - Sign With Admin
Test Case - Update User Comment Test Case - Update User Comment
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Update User Comment Test12#4 Update User Comment Test12#4
Logout Harbor Logout Harbor
Test Case - Update Password Test Case - Update Password
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Change Password Test1@34 Test12#4 Change Password Test1@34 Test12#4
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} tester${d} Test12#4 Sign In Harbor ${HARBOR_URL} tester${d} Test12#4
@ -121,14 +121,14 @@ Test Case - Update Password
Test Case - Create An New Project Test Case - Create An New Project
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Create An New Project test${d} Create An New Project test${d}
Close Browser Close Browser
Test Case - User View Projects Test Case - User View Projects
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Create An New Project test${d}1 Create An New Project test${d}1
Create An New Project test${d}2 Create An New Project test${d}2
Create An New Project test${d}3 Create An New Project test${d}3
@ -142,7 +142,7 @@ Test Case - User View Projects
Test Case - Push Image Test Case - Push Image
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Create An New Project test${d} Create An New Project test${d}
Push image ${ip} tester${d} Test1@34 test${d} hello-world:latest Push image ${ip} tester${d} Test1@34 test${d} hello-world:latest
@ -153,7 +153,7 @@ Test Case - User View Logs
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
Push image ${ip} tester${d} Test1@34 project${d} busybox:latest Push image ${ip} tester${d} Test1@34 project${d} busybox:latest
Pull image ${ip} tester${d} Test1@34 project${d} busybox:latest Pull image ${ip} tester${d} Test1@34 project${d} busybox:latest
@ -171,9 +171,9 @@ Test Case - Manage project publicity
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=usera${d} email=usera${d}@vmware.com realname=usera${d} newPassword=Test1@34 comment=harbor Create An New User url=${HARBOR_URL} username=usera${d} email=usera${d}@harbortest.com realname=usera${d} newPassword=Test1@34 comment=harbor
Logout Harbor Logout Harbor
Create An New User url=${HARBOR_URL} username=userb${d} email=userb${d}@vmware.com realname=userb${d} newPassword=Test1@34 comment=harbor Create An New User url=${HARBOR_URL} username=userb${d} email=userb${d}@harbortest.com realname=userb${d} newPassword=Test1@34 comment=harbor
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} usera${d} Test1@34 Sign In Harbor ${HARBOR_URL} usera${d} Test1@34
@ -244,7 +244,7 @@ Test Case - Edit Project Creation
# Create normal user and login # Create normal user and login
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Project Creation Should Display Project Creation Should Display
Logout Harbor Logout Harbor
@ -342,7 +342,7 @@ Test Case - Delete Label
TestCase - Project Admin Operate Labels TestCase - Project Admin Operate Labels
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@vmware.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@harbortest.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
Go Into Project project${d} has_image=${false} Go Into Project project${d} has_image=${false}
Sleep 2 Sleep 2
@ -358,7 +358,7 @@ TestCase - Project Admin Operate Labels
TestCase - Project Admin Add Labels To Repo TestCase - Project Admin Add Labels To Repo
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@vmware.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@harbortest.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
## Push Image With Tag ${ip} test${d} Test1@34 project${d} vmware/photon 1.0 1.0 ## Push Image With Tag ${ip} test${d} Test1@34 project${d} vmware/photon 1.0 1.0
Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine
Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 4.0.7-alpine 4.0.7-alpine Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 4.0.7-alpine 4.0.7-alpine
@ -382,9 +382,9 @@ TestCase - Project Admin Add Labels To Repo
TestCase - Developer Operate Labels TestCase - Developer Operate Labels
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@vmware.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=test${d} email=test${d}@harbortest.com realname=test${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
Logout Harbor Logout Harbor
Create An New User url=${HARBOR_URL} username=bob${d} email=bob${d}@vmware.com realname=bob${d} newPassword=Test1@34 comment=habor Create An New User url=${HARBOR_URL} username=bob${d} email=bob${d}@harbortest.com realname=bob${d} newPassword=Test1@34 comment=habor
Logout Harbor Logout Harbor
Manage Project Member test${d} Test1@34 project${d} bob${d} Add has_image=${false} Manage Project Member test${d} Test1@34 project${d} bob${d} Add has_image=${false}
@ -399,7 +399,7 @@ TestCase - Developer Operate Labels
Test Case - Scan A Tag In The Repo Test Case - Scan A Tag In The Repo
Init Chrome Driver Init Chrome Driver
${d}= get current date result_format=%m%s ${d}= get current date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
Push Image ${ip} tester${d} Test1@34 project${d} hello-world Push Image ${ip} tester${d} Test1@34 project${d} hello-world
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/hello-world Go Into Repo project${d}/hello-world
@ -413,7 +413,7 @@ Test Case - Scan As An Unprivileged User
Init Chrome Driver Init Chrome Driver
${d}= get current date result_format=%m%s ${d}= get current date result_format=%m%s
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world
Create An New User ${HARBOR_URL} user${d} user${d}@vmware.com user${d} Test1@34 harbor Create An New User ${HARBOR_URL} user${d} user${d}@harbortest.com user${d} Test1@34 harbor
Go Into Project library Go Into Project library
Go Into Repo hello-world Go Into Repo hello-world
Select Object latest Select Object latest
@ -477,7 +477,7 @@ Test Case - Verify Download Ca Link
Test Case - Edit Repo Info Test Case - Edit Repo Info
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
Push Image ${ip} tester${d} Test1@34 project${d} hello-world Push Image ${ip} tester${d} Test1@34 project${d} hello-world
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/hello-world Go Into Repo project${d}/hello-world
@ -488,12 +488,12 @@ Test Case - Manage Project Member
Init Chrome Driver Init Chrome Driver
${d}= Get current Date result_format=%m%s ${d}= Get current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=alice${d} email=alice${d}@vmware.com realname=alice${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=alice${d} email=alice${d}@harbortest.com realname=alice${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
Push image ip=${ip} user=alice${d} pwd=Test1@34 project=project${d} image=hello-world Push image ip=${ip} user=alice${d} pwd=Test1@34 project=project${d} image=hello-world
Logout Harbor Logout Harbor
Create An New User url=${HARBOR_URL} username=bob${d} email=bob${d}@vmware.com realname=bob${d} newPassword=Test1@34 comment=habor Create An New User url=${HARBOR_URL} username=bob${d} email=bob${d}@harbortest.com realname=bob${d} newPassword=Test1@34 comment=habor
Logout Harbor Logout Harbor
Create An New User url=${HARBOR_URL} username=carol${d} email=carol${d}@vmware.com realname=carol${d} newPassword=Test1@34 comment=harbor Create An New User url=${HARBOR_URL} username=carol${d} email=carol${d}@harbortest.com realname=carol${d} newPassword=Test1@34 comment=harbor
Logout Harbor Logout Harbor
User Should Not Be A Member Of Project bob${d} Test1@34 project${d} User Should Not Be A Member Of Project bob${d} Test1@34 project${d}
@ -512,7 +512,7 @@ Test Case - Manage Project Member
Test Case - Delete A Project Test Case - Delete A Project
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project With New User ${HARBOR_URL} tester${d} tester${d}@vmware.com tester${d} Test1@34 harobr project${d} false Create An New Project With New User ${HARBOR_URL} tester${d} tester${d}@harbortest.com tester${d} Test1@34 harobr project${d} false
Push Image ${ip} tester${d} Test1@34 project${d} hello-world Push Image ${ip} tester${d} Test1@34 project${d} hello-world
Project Should Not Be Deleted project${d} Project Should Not Be Deleted project${d}
Go Into Project project${d} Go Into Project project${d}
@ -524,7 +524,7 @@ Test Case - Delete A Project
Test Case - Delete Multi Project Test Case - Delete Multi Project
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
Create An New Project projecta${d} Create An New Project projecta${d}
Create An New Project projectb${d} Create An New Project projectb${d}
Push Image ${ip} test${d} Test1@34 projecta${d} hello-world Push Image ${ip} test${d} Test1@34 projecta${d} hello-world
@ -539,11 +539,11 @@ Test Case - Delete Multi Project
Test Case - Delete Multi User Test Case - Delete Multi User
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} deletea${d} testa${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} deletea${d} testa${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor Logout Harbor
Create An New User ${HARBOR_URL} deleteb${d} testb${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} deleteb${d} testb${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor Logout Harbor
Create An New User ${HARBOR_URL} deletec${d} testc${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} deletec${d} testc${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} admin Harbor12345 Sign In Harbor ${HARBOR_URL} admin Harbor12345
Switch To User Tag Switch To User Tag
@ -558,7 +558,7 @@ Test Case - Delete Multi User
Test Case - Delete Multi Repo Test Case - Delete Multi Repo
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
Create An New Project project${d} Create An New Project project${d}
Push Image ${ip} test${d} Test1@34 project${d} hello-world Push Image ${ip} test${d} Test1@34 project${d} hello-world
Push Image ${ip} test${d} Test1@34 project${d} busybox Push Image ${ip} test${d} Test1@34 project${d} busybox
@ -573,7 +573,7 @@ Test Case - Delete Multi Repo
Test Case - Delete Multi Tag Test Case - Delete Multi Tag
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
Create An New Project project${d} Create An New Project project${d}
Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine
Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 4.0.7-alpine 4.0.7-alpine Push Image With Tag ${ip} test${d} Test1@34 project${d} redis 4.0.7-alpine 4.0.7-alpine
@ -589,7 +589,7 @@ Test Case - Delete Multi Tag
Test Case - Delete Repo on CardView Test Case - Delete Repo on CardView
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
Create An New Project project${d} Create An New Project project${d}
Push Image ${ip} test${d} Test1@34 project${d} hello-world Push Image ${ip} test${d} Test1@34 project${d} hello-world
Push Image ${ip} test${d} Test1@34 project${d} busybox Push Image ${ip} test${d} Test1@34 project${d} busybox
@ -604,11 +604,11 @@ Test Case - Delete Repo on CardView
Test Case - Delete Multi Member Test Case - Delete Multi Member
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} testa${d} testa${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} testa${d} testa${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor Logout Harbor
Create An New User ${HARBOR_URL} testb${d} testb${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} testb${d} testb${d}@harbortest.com test${d} Test1@34 harbor
Logout Harbor Logout Harbor
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor Create An New User ${HARBOR_URL} test${d} test${d}@harbortest.com test${d} Test1@34 harbor
Create An New Project project${d} Create An New Project project${d}
Go Into Project project${d} has_image=${false} Go Into Project project${d} has_image=${false}
Switch To Member Switch To Member
@ -621,7 +621,7 @@ Test Case - Delete Multi Member
Test Case - Assign Sys Admin Test Case - Assign Sys Admin
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=harbortest newPassword=Test1@34 comment=harbortest
Logout Harbor Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch to User Tag Switch to User Tag
@ -650,7 +650,7 @@ Test Case - Admin Push Signed Image
Test Case - View Scan Results Test Case - View Scan Results
Init Chrome Driver Init Chrome Driver
${d}= get current date result_format=%m%s ${d}= get current date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
Push Image ${ip} tester${d} Test1@34 project${d} tomcat Push Image ${ip} tester${d} Test1@34 project${d} tomcat
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/tomcat Go Into Repo project${d}/tomcat
@ -662,7 +662,7 @@ Test Case - View Scan Results
Test Case - View Scan Error Test Case - View Scan Error
Init Chrome Driver Init Chrome Driver
${d}= get current date result_format=%m%s ${d}= get current date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
Push Image ${ip} tester${d} Test1@34 project${d} vmware/photon:1.0 Push Image ${ip} tester${d} Test1@34 project${d} vmware/photon:1.0
Go Into Project project${d} Go Into Project project${d}
Go Into Repo project${d}/vmware/photon Go Into Repo project${d}/vmware/photon

View File

@ -1,17 +1,16 @@
# Copyright Project Harbor Authors
// Copyright (c) 2017 VMware, Inc. All Rights Reserved. #
// # Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License. # You may obtain a copy of the License at
// You may obtain a copy of the License at #
// # http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0 #
// # Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and # limitations under the License
// limitations under the License.
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs

View File

@ -83,9 +83,11 @@ Test Case - Generate User CLI Secret
Cannot Docker Login Harbor ${ip} ${OIDC_USERNAME} ${secret_old} Cannot Docker Login Harbor ${ip} ${OIDC_USERNAME} ${secret_old}
Pull image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image} Pull image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image}
Push image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image} Push image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image}
Close Browser
Test Case - Helm CLI Push Test Case - Helm CLI Push
Init Chrome Driver Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL} Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL} ${secret}= Get Secrete By API ${HARBOR_URL}
Helm CLI Push Without Sign In Harbor ${OIDC_USERNAME} ${secret} Helm CLI Push Without Sign In Harbor ${OIDC_USERNAME} ${secret}
Close Browser

View File

@ -14,6 +14,7 @@
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs
Library ../../apitests/python/testutils.py
Library ../../apitests/python/library/repository.py Library ../../apitests/python/library/repository.py
Resource ../../resources/Util.robot Resource ../../resources/Util.robot
Default Tags Replication Default Tags Replication

View File

@ -1,16 +1,16 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved. # Copyright Project Harbor Authors
// #
// Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
// You may obtain a copy of the License at # You may obtain a copy of the License at
// #
// http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
// #
// Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
// limitations under the License. # limitations under the License
*** Settings *** *** Settings ***
Documentation Harbor BATs Documentation Harbor BATs

View File

@ -56,7 +56,7 @@ Exe Regression Test Cases
# New user, new project, push image, pull image # New user, new project, push image, pull image
Init Chrome Driver Init Chrome Driver
${d}= Get Current Date result_format=%m%s ${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@harbortest.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false
${rand}= Evaluate random.randint(0, 1) modules=random ${rand}= Evaluate random.randint(0, 1) modules=random
Run Keyword If '${rand}' == '0' Generate Prepared Image ${ip} tester${d} project${d} Run Keyword If '${rand}' == '0' Generate Prepared Image ${ip} tester${d} project${d}

View File

@ -55,7 +55,7 @@ class HarborAPI:
request(url+"projects", 'post', **body) request(url+"projects", 'post', **body)
def create_user(self, username): def create_user(self, username):
payload = {"username":username, "email":username+"@vmware.com", "password":"Harbor12345", "realname":username, "comment":"string"} payload = {"username":username, "email":username+"@harbortest.com", "password":"Harbor12345", "realname":username, "comment":"string"}
body=dict(body=payload) body=dict(body=payload)
request(url+"users", 'post', **body) request(url+"users", 'post', **body)

View File

@ -20,7 +20,7 @@ class HarborAPI:
request(url+"projects", 'post', **body) request(url+"projects", 'post', **body)
def create_user(self, username): def create_user(self, username):
payload = {"username":username, "email":username+"@vmware.com", "password":"Harbor12345", "realname":username, "comment":"string"} payload = {"username":username, "email":username+"@harbortest.com", "password":"Harbor12345", "realname":username, "comment":"string"}
body=dict(body=payload) body=dict(body=payload)
request(url+"users", 'post', **body) request(url+"users", 'post', **body)