From b59c09956701c92994766309edc918974f364c30 Mon Sep 17 00:00:00 2001 From: Zach Shepherd Date: Thu, 15 Feb 2018 11:07:13 -0800 Subject: [PATCH 1/2] Refactor Install Harbor To Test Server keyword The secret tag on the `Install Harbor To Test Server` makes it difficult to investigate failures when they occur. Only one out of 30+ lines actually uses secret information. Refactor the keyword to extract the secret information into its own keyword, allowing the tag to be applied in a more focused way. This is similar to the pattern used by keywords in VCH-Util. --- tests/resources/Harbor-Util.robot | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/resources/Harbor-Util.robot b/tests/resources/Harbor-Util.robot index a2c7390ec9..4e8e45d37c 100644 --- a/tests/resources/Harbor-Util.robot +++ b/tests/resources/Harbor-Util.robot @@ -26,9 +26,14 @@ ${harbor_cert} getcert ${ova_harbor_admin_password} harbor-admin-passwd *** Keywords *** -Install Harbor To Test Server +Secret Install Harbor To Test Server [Tags] secret - [Arguments] ${name}=harbor ${protocol}=http ${verify}=off ${db_password}=%{TEST_PASSWORD} ${user}=%{TEST_USERNAME} ${password}=%{TEST_PASSWORD} ${host}=%{TEST_URL_ARRAY} ${datastore}=%{TEST_DATASTORE} ${network}=VM Network + [Arguments] ${name} ${protocol} ${verify} ${host} ${datastore} ${network} + ${out}= Run ovftool --noSSLVerify --acceptAllEulas --datastore=${datastore} --name=${name} --net:"Network 1"='${network}' --diskMode=thin --powerOn --X:waitForIp --X:injectOvfEnv --X:enableHiddenProperties --prop:root_pwd=%{TEST_PASSWORD} --prop:harbor_admin_password=%{TEST_PASSWORD} --prop:db_password=%{TEST_PASSWORD} --prop:auth_mode=db_auth --prop:verify_remote_cert=${verify} --prop:protocol=${protocol} ${HARBOR_VERSION}.ova 'vi://%{TEST_USERNAME}:%{TEST_PASSWORD}@${host}' + [Return] ${out} + +Install Harbor To Test Server + [Arguments] ${name}=harbor ${protocol}=http ${verify}=off ${host}=%{TEST_URL_ARRAY} ${datastore}=%{TEST_DATASTORE} ${network}=VM Network Log To Console \nFetching harbor ova... ${status} ${message}= Run Keyword And Ignore Error OperatingSystem.File Should Exist ${HARBOR_VERSION}.ova ${out}= Run Keyword If '${status}' == 'FAIL' Run wget https://github.com/vmware/harbor/releases/download/${HARBOR_SHORT_VERSION}/${HARBOR_VERSION}.ova @@ -42,7 +47,7 @@ Install Harbor To Test Server ${rc} ${output}= Run Keyword If '%{HOST_TYPE}' == 'VC' Set Suite Variable ${host} @{URLs}[${IDX}]%{TEST_DATACENTER}/host/%{TEST_RESOURCE} Log To Console \nDeploying ova... - ${out}= Run ovftool --noSSLVerify --acceptAllEulas --datastore=${datastore} --name=${name} --net:"Network 1"='${network}' --diskMode=thin --powerOn --X:waitForIp --X:injectOvfEnv --X:enableHiddenProperties --prop:root_pwd=${password} --prop:harbor_admin_password=${password} --prop:db_password=${db_password} --prop:auth_mode=db_auth --prop:verify_remote_cert=${verify} --prop:protocol=${protocol} ${HARBOR_VERSION}.ova 'vi://${user}:${password}@${host}' + ${out}= Secret Install Harbor To Test Server ${name} ${protocol} ${verify} ${host} ${datastore} ${network} Should Contain ${out} Received IP address: Should Not Contain ${out} None From 97ae4b5aa144fedf3b4d82ffb3eddbe3f7d9c733 Mon Sep 17 00:00:00 2001 From: Zach Shepherd Date: Thu, 15 Feb 2018 12:33:24 -0800 Subject: [PATCH 2/2] fixup! Refactor Install Harbor To Test Server keyword --- tests/resources/Harbor-Util.robot | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/resources/Harbor-Util.robot b/tests/resources/Harbor-Util.robot index 4e8e45d37c..d9e7d38b74 100644 --- a/tests/resources/Harbor-Util.robot +++ b/tests/resources/Harbor-Util.robot @@ -48,6 +48,7 @@ Install Harbor To Test Server Log To Console \nDeploying ova... ${out}= Secret Install Harbor To Test Server ${name} ${protocol} ${verify} ${host} ${datastore} ${network} + Log ${out} Should Contain ${out} Received IP address: Should Not Contain ${out} None