X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=tests%2Fhelm%2Fhelm_chart.resource;fp=tests%2Fhelm%2Fhelm_chart.resource;h=4657ba65692f98f574bfed9cc1d23453f7a81887;hb=02b1ff0b186b082fb86a91ffcb0c0be0b3c92d6c;hp=0000000000000000000000000000000000000000;hpb=7918d7e7895da4c6ea4b25610780522ac0351d00;p=validation.git diff --git a/tests/helm/helm_chart.resource b/tests/helm/helm_chart.resource new file mode 100644 index 0000000..4657ba6 --- /dev/null +++ b/tests/helm/helm_chart.resource @@ -0,0 +1,71 @@ +############################################################################## +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you maynot 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 *** +Library SSHLibrary +Library String + + +*** Variables *** +${REPORTDIR} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')} +${CHARTDIR} /tmp/helm-chart +${SERVECMD} helm serve --repo-path /home/${USERNAME}/.helm/repository/local + + +*** Keywords *** +Open Connection And Log In + Open Connection ${HOST} + Login With Public Key ${USERNAME} ${SSH_KEYFILE} + +Start Local Chart Repository Server + Stop Local Chart Repository Server + Start Command ${SERVECMD} + ${rc}= Execute Command pgrep -xf "${SERVECMD}" + ... return_stdout=False + ... return_rc=True + Should Be Equal As Integers ${rc} 0 + +Stop Local Chart Repository Server + Execute Command pkill -xf "${SERVECMD}" + +List Charts In Repositories + ${stdout}= Execute Command helm search --regexp . | tail -n +2 | cut -f1 + @{CHARTS}= Split String ${stdout} + Set Suite Variable @{CHARTS} + +Fetch Charts + Execute Command rm -r ${CHARTDIR} + Execute Command mkdir -p ${CHARTDIR} + :FOR ${chart} IN @{CHARTS} + \ ${rc}= Execute Command helm fetch ${chart} -d ${CHARTDIR} + ... return_stdout=False + ... return_rc=True + \ Should Be Equal As Integers ${rc} 0 + +Lint Charts + @{files}= List Files In Directory ${CHARTDIR} + :FOR ${file} IN @{files} + \ ${stdout}= Execute Command helm lint ${CHARTDIR}/${file} + \ Should Contain ${stdout} 1 chart(s) linted, no failures + +Simulate Install + :FOR ${chart} IN @{CHARTS} + \ ${rc}= Execute Command helm install --dry-run ${chart} + ... return_stdout=False + ... return_rc=True + \ Should Be Equal As Integers ${rc} 0