Fix Sonobuoy systemd-image for k8 1.18
[validation.git] / tests / helm / helm_repository.resource
1 ##############################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property.                             #
3 # Copyright (c) 2019 Nokia.                                                  #
4 #                                                                            #
5 # Licensed under the Apache License, Version 2.0 (the "License");            #
6 # you maynot use this file except in compliance with the License.            #
7 #                                                                            #
8 # You may obtain a copy of the License at                                    #
9 #       http://www.apache.org/licenses/LICENSE-2.0                           #
10 #                                                                            #
11 # Unless required by applicable law or agreed to in writing, software        #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
14 # See the License for the specific language governing permissions and        #
15 # limitations under the License.                                             #
16 ##############################################################################
17
18
19 *** Settings ***
20 Library             OperatingSystem
21 Library             Process
22 Library             SSHLibrary
23 Library             String
24
25
26 *** Variables ***
27 ${REPORTDIR}        ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}
28 ${DESTDIR}          /tmp/helm-repo
29 ${REPONAME}         default
30 ${REPOURL}          Actual value set dynamically at suite setup
31 ${CHARTARC}         Actual value set dynamically at suite setup
32 ${CHARTNAME}        bluval-test-alpine
33
34
35 *** Keywords ***
36 Open Connection And Log In
37     Open Connection         ${HOST}
38     Login With Public Key   ${USERNAME}  ${SSH_KEYFILE}
39
40 Build Chart Archive
41     Run Process             sed  -i  s/name: alpine/name: ${CHARTNAME}/  /opt/akraino/${CHARTNAME}/Chart.yaml
42     Execute Command         rm -r ${DESTDIR}
43     Put Directory           /opt/akraino/${CHARTNAME}  ${DESTDIR}/${CHARTNAME}  recursive=True
44     ${stdout}=              Execute Command  helm package ${DESTDIR}/${CHARTNAME} -d ${DESTDIR}
45     Should Contain          ${stdout}  Successfully packaged chart and saved it to:
46     ${CHARTARC}=            Fetch From Right  ${stdout}  /
47     Set Suite Variable      ${CHARTARC}
48
49 Get Default Repository
50     ${REPOURL}=             Execute Command
51     ...                     helm repo list | grep '^${REPONAME}\\([[:blank:]]\\|[^[:print:]]\\)' | cut -f2
52     Set Suite Variable      ${REPOURL}
53     Should Not Be Empty     ${REPOURL}
54
55 Fail If Previous Test Failed
56     Run Keyword If          '${PREV_TEST_STATUS}'=='FAIL'  Fail  Skipping because '${PREV_TEST_NAME}' failed.
57
58 Upload Chart To Repository
59     ${STATUS}=              Execute Command  curl -X PUT --data-binary "@${DESTDIR}/${CHARTARC}" ${REPOURL}/${CHARTARC}
60     Set Test Variable       ${STATUS}
61
62 Chart Upload Should Have Succeeded
63     Should Be Empty         ${STATUS}
64
65 Chart Upload Should Have Failed
66     Should Not Be Empty     ${STATUS}
67
68 Update Repository Info
69     ${stdout}=              Execute Command  helm repo update
70     Should Contain          ${stdout}  Successfully got an update from the "${REPONAME}" chart repository
71
72 Inspect Chart
73     ${STATUS}=              Execute Command  helm inspect chart ${REPONAME}/${CHARTNAME}
74     ...                       return_stdout=False
75     ...                       return_rc=True
76     Set Test Variable       ${STATUS}
77
78 Find Chart In Repository
79     ${STATUS}=              Execute Command  helm search -r '\\v${REPONAME}/${CHARTNAME}\\v'
80     Set Test Variable       ${STATUS}
81
82 Chart Should Be Available
83     Should Contain          ${STATUS}  ${REPONAME}/${CHARTNAME}
84
85 Chart Should Not Be Available
86     Should Contain          ${STATUS}  No results found
87
88 Chart Should Be Accessible
89     Should Be Equal As Integers  ${STATUS}  0
90
91 Delete Chart
92     ${STATUS}=              Execute Command  curl -X DELETE ${REPOURL}/${CHARTARC}
93     Set Test Variable       ${STATUS}
94
95 Chart Delete Should Have Succeeded
96     Should Be Empty         ${STATUS}
97
98 Chart Delete Should Have Failed
99     Should Not Be Empty     ${STATUS}