Fix Sonobuoy systemd-image for k8 1.18
[validation.git] / tests / helm / helm_chart.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            SSHLibrary
21 Library            String
22
23
24 *** Variables ***
25 ${REPORTDIR}       ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}
26 ${CHARTDIR}        /tmp/helm-chart
27 ${SERVECMD}        helm serve --repo-path /home/${USERNAME}/.helm/repository/local
28
29
30 *** Keywords ***
31 Open Connection And Log In
32     Open Connection        ${HOST}
33     Login With Public Key  ${USERNAME}  ${SSH_KEYFILE}
34
35 Start Local Chart Repository Server
36     Stop Local Chart Repository Server
37     Start Command          ${SERVECMD}
38     ${rc}=                 Execute Command  pgrep -xf "${SERVECMD}"
39     ...                      return_stdout=False
40     ...                      return_rc=True
41     Should Be Equal As Integers  ${rc}  0
42
43 Stop Local Chart Repository Server
44     Execute Command  pkill -xf "${SERVECMD}"
45
46 List Charts In Repositories
47     ${stdout}=             Execute Command  helm search --regexp . | tail -n +2 | cut -f1
48     @{CHARTS}=             Split String  ${stdout}
49     Set Suite Variable     @{CHARTS}
50
51 Fetch Charts
52     Execute Command        rm -r ${CHARTDIR}
53     Execute Command        mkdir -p ${CHARTDIR}
54     :FOR  ${chart}  IN  @{CHARTS}
55     \   ${rc}=             Execute Command  helm fetch ${chart} -d ${CHARTDIR}
56         ...                  return_stdout=False
57         ...                  return_rc=True
58     \   Should Be Equal As Integers  ${rc}  0
59
60 Lint Charts
61     @{files}=              List Files In Directory  ${CHARTDIR}
62     :FOR  ${file}  IN  @{files}
63     \   ${stdout}=  Execute Command  helm lint ${CHARTDIR}/${file}
64     \   Should Contain  ${stdout}  1 chart(s) linted, no failures
65
66 Simulate Install
67     :FOR  ${chart}  IN  @{CHARTS}
68     \   ${rc}=             Execute Command  helm install --dry-run ${chart}
69         ...                  return_stdout=False
70         ...                  return_rc=True
71     \   Should Be Equal As Integers  ${rc}  0