diff options
18 files changed, 495 insertions, 11 deletions
diff --git a/plans/integration-simulators-nf-simulator-netconf-server/testsuites/setup.sh b/plans/integration-simulators-nf-simulator-netconf-server/testsuites/setup.sh new file mode 100755 index 00000000..4fc9a358 --- /dev/null +++ b/plans/integration-simulators-nf-simulator-netconf-server/testsuites/setup.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Copyright (C) 2021 Nokia. All rights reserved. +# +# 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. + +# Start netconf-server image with dependencies +${WORKSPACE}/scripts/integration/nfsimulator/netconf-server/start-netconf-server.sh + +# Setup IP for netconf-server +NETCONF_SERVER_NAME=netconf-server +NETCONF_SERVER_REST_PORT=6555 + +# Wait until container ready +for i in {1..9} +do + NETCONF_SERVER_IP=`get-instance-ip.sh $NETCONF_SERVER_NAME` + RESP_CODE=$(curl -I -s -o /dev/null -w "%{http_code}" http://${NETCONF_SERVER_IP}:${NETCONF_SERVER_REST_PORT}/readiness) + if [[ "$RESP_CODE" == '200' ]]; then + echo 'Netconf Server is ready' + export NETCONF_SERVER_IP=${NETCONF_SERVER_IP} + export NETCONF_SERVER_REST_PORT=${NETCONF_SERVER_REST_PORT} + break + fi + echo 'Waiting for Netconf Server to start up...' + sleep 5s +done diff --git a/plans/integration-simulators-nf-simulator-netconf-server/testsuites/teardown.sh b/plans/integration-simulators-nf-simulator-netconf-server/testsuites/teardown.sh new file mode 100755 index 00000000..9638754a --- /dev/null +++ b/plans/integration-simulators-nf-simulator-netconf-server/testsuites/teardown.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Copyright (C) 2021 Nokia. All rights reserved. +# +# 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. + +# Stop netconf-server image and dependencies +${WORKSPACE}/scripts/integration/nfsimulator/netconf-server/stop-netconf-server.sh diff --git a/plans/integration-simulators-nf-simulator-netconf-server/testsuites/testplan.txt b/plans/integration-simulators-nf-simulator-netconf-server/testsuites/testplan.txt new file mode 100644 index 00000000..aa7f7db2 --- /dev/null +++ b/plans/integration-simulators-nf-simulator-netconf-server/testsuites/testplan.txt @@ -0,0 +1,4 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +# Temporary change to trigger verify job. +integration/nfsimulator/netconf-server diff --git a/plans/sdc/sdc-helm-validator/setup.sh b/plans/sdc/sdc-helm-validator/setup.sh new file mode 100644 index 00000000..6d079679 --- /dev/null +++ b/plans/sdc/sdc-helm-validator/setup.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +export SDC_HELM_VALIDATOR="sdc-helm-validator" +export SDC_HELM_VALIDATOR_IMAGE="nexus3.onap.org:10001/onap/org.onap.sdc.sdc-helm-validator:latest" + +unset http_proxy +unset https_proxy + +docker run -p 8080:8080 -d --name ${SDC_HELM_VALIDATOR} ${SDC_HELM_VALIDATOR_IMAGE} + +# Wait container ready +HELM_VALIDATOR_IP='none' +for i in {1..5} +do + HELM_VALIDATOR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${SDC_HELM_VALIDATOR}) + RESP_CODE=$(curl -s http://${HELM_VALIDATOR_IP}:8080/actuator/health | python2 -c 'import json,sys;obj=json.load(sys.stdin);print obj["status"]') + if [[ "$RESP_CODE" == "UP" ]]; then + echo 'SDC Helm Validator is ready' + break + fi + + echo 'Waiting for SDC Helm Validator to start up...' + sleep 10s +done + +echo HELM_VALIDATOR_IP=${HELM_VALIDATOR_IP} + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v VALIDATOR:${HELM_VALIDATOR_IP}:8080" diff --git a/plans/sdc/sdc-helm-validator/teardown.sh b/plans/sdc/sdc-helm-validator/teardown.sh new file mode 100644 index 00000000..9916a424 --- /dev/null +++ b/plans/sdc/sdc-helm-validator/teardown.sh @@ -0,0 +1,7 @@ +#!/bin/bash +echo "Starting teardown script" + +running_container=$(docker ps --filter name=sdc-helm-validator -qa) + +docker stop $running_container +docker rm $running_container diff --git a/plans/sdc/sdc-helm-validator/testplan.txt b/plans/sdc/sdc-helm-validator/testplan.txt new file mode 100644 index 00000000..9133005c --- /dev/null +++ b/plans/sdc/sdc-helm-validator/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +sdc/sdc-helm-validator diff --git a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh index b7a595c1..224a5368 100755 --- a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh +++ b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh @@ -25,17 +25,6 @@ set -x DOCKER_SIM_NWNAME="dfcnet" echo "Creating docker network $DOCKER_SIM_NWNAME, if needed" docker network ls | grep $DOCKER_SIM_NWNAME >/dev/null || docker network create $DOCKER_SIM_NWNAME - -if [ $HTTP_TYPE = "HTTPS" ] - then - docker run \ - --name oom-certservice-post-processor \ - --env-file $SIMGROUP_ROOT/../certservice/merger/merge-certs.env \ - --mount type=bind,src=$SIMGROUP_ROOT/tls,dst=/opt/app/datafile/etc/cert \ - --mount type=bind,src=$SIMGROUP_ROOT/../certservice/generated-certs/dfc-p12,dst=/opt/app/datafile/etc/ \ - nexus3.onap.org:10001/onap/org.onap.oom.platform.cert-service.oom-certservice-post-processor:latest -fi - docker-compose up -d DFC_APP="$(docker ps -q --filter='name=dfc_app0')" diff --git a/scripts/integration/nfsimulator/netconf-server/docker-compose.yml b/scripts/integration/nfsimulator/netconf-server/docker-compose.yml new file mode 100644 index 00000000..b8d4e5a6 --- /dev/null +++ b/scripts/integration/nfsimulator/netconf-server/docker-compose.yml @@ -0,0 +1,43 @@ +version: '3' + +services: + zookeeper: + image: wurstmeister/zookeeper + ports: + - "2181:2181" + networks: + - netconfnetwork + + kafka1: + image: wurstmeister/kafka:1.1.0 + ports: + - "9092:9092" + hostname: kafka1 + networks: + - netconfnetwork + environment: + KAFKA_ADVERTISED_PORT: 9092 + KAFKA_ADVERTISED_HOST_NAME: kafka1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_CREATE_TOPICS: "config:1:1" + KAFKA_DELETE_RETENTION_MS: 604800000 + KAFKA_LOG_CLEANER_DELETE_RETENTION_MS: 604800000 + depends_on: + - zookeeper + + netconf-server: + container_name: netconf-server + image: nexus3.onap.org:10003/onap/org.onap.integration.nfsimulator.netconfserver:latest + ports: + - "830:830" + - "6513:6513" + - "6555:6555" + networks: + - netconfnetwork + depends_on: + - zookeeper + - kafka1 + +networks: + netconfnetwork: + driver: bridge
\ No newline at end of file diff --git a/scripts/integration/nfsimulator/netconf-server/start-netconf-server.sh b/scripts/integration/nfsimulator/netconf-server/start-netconf-server.sh new file mode 100755 index 00000000..8fadcd1a --- /dev/null +++ b/scripts/integration/nfsimulator/netconf-server/start-netconf-server.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Copyright (C) 2021 Nokia. All rights reserved. +# +# 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. + + +echo "Starting netconf server" +docker-compose -f ${WORKSPACE}/scripts/integration/nfsimulator/netconf-server/docker-compose.yml up -d diff --git a/scripts/integration/nfsimulator/netconf-server/stop-netconf-server.sh b/scripts/integration/nfsimulator/netconf-server/stop-netconf-server.sh new file mode 100755 index 00000000..01d38509 --- /dev/null +++ b/scripts/integration/nfsimulator/netconf-server/stop-netconf-server.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Copyright (C) 2021 Nokia. All rights reserved. +# +# 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. + +echo "Stopping netconf server" +docker-compose -f ${WORKSPACE}/scripts/integration/nfsimulator/netconf-server/docker-compose.yml down diff --git a/tests/integration/nfsimulator/netconf-server/__init__.robot b/tests/integration/nfsimulator/netconf-server/__init__.robot new file mode 100644 index 00000000..aa8babbc --- /dev/null +++ b/tests/integration/nfsimulator/netconf-server/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Integration - Netconf Server diff --git a/tests/integration/nfsimulator/netconf-server/netconf-server-rest-test.robot b/tests/integration/nfsimulator/netconf-server/netconf-server-rest-test.robot new file mode 100644 index 00000000..0d3ebdec --- /dev/null +++ b/tests/integration/nfsimulator/netconf-server/netconf-server-rest-test.robot @@ -0,0 +1,17 @@ +*** Settings *** +Documentation Run healthcheck +Library RequestsLibrary +Resource ./resources/netconf-server-keywords.robot + + +*** Test Cases *** + +Netconf Server Rest API Health Check + [Tags] Netconf-Server + [Documentation] Run healthcheck + Run Healthcheck + +Netconf Server Rest API Readiness Check + [Tags] Netconf-Server + [Documentation] Run readiness + Run Readiness
\ No newline at end of file diff --git a/tests/integration/nfsimulator/netconf-server/resources/netconf-server-keywords.robot b/tests/integration/nfsimulator/netconf-server/resources/netconf-server-keywords.robot new file mode 100644 index 00000000..fd54487a --- /dev/null +++ b/tests/integration/nfsimulator/netconf-server/resources/netconf-server-keywords.robot @@ -0,0 +1,21 @@ +*** Settings *** +Library RequestsLibrary +Resource ./netconf-server-properties.robot + +*** Keywords *** + +Run Healthcheck + [Documentation] Run Healthcheck + Create Session netconf_server_session ${NETCONF_SERVER_URL} + ${resp}= GET On Session netconf_server_session /healthcheck + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.text} UP + +Run Readiness + [Documentation] Run Readiness + Create Session netconf_server_session ${NETCONF_SERVER_URL} + ${resp}= GET On Session netconf_server_session /readiness + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.text} Ready + + diff --git a/tests/integration/nfsimulator/netconf-server/resources/netconf-server-properties.robot b/tests/integration/nfsimulator/netconf-server/resources/netconf-server-properties.robot new file mode 100644 index 00000000..3903da7d --- /dev/null +++ b/tests/integration/nfsimulator/netconf-server/resources/netconf-server-properties.robot @@ -0,0 +1,3 @@ +*** Variables *** + +${NETCONF_SERVER_URL} http://%{NETCONF_SERVER_IP}:%{NETCONF_SERVER_REST_PORT} diff --git a/tests/sdc/sdc-helm-validator/assets/charts/correct-apiVersion-v2.tgz b/tests/sdc/sdc-helm-validator/assets/charts/correct-apiVersion-v2.tgz Binary files differnew file mode 100644 index 00000000..a1a99bab --- /dev/null +++ b/tests/sdc/sdc-helm-validator/assets/charts/correct-apiVersion-v2.tgz diff --git a/tests/sdc/sdc-helm-validator/assets/charts/one-lint-one-render-error-apiVersion-v2.tgz b/tests/sdc/sdc-helm-validator/assets/charts/one-lint-one-render-error-apiVersion-v2.tgz Binary files differnew file mode 100644 index 00000000..874dd3c0 --- /dev/null +++ b/tests/sdc/sdc-helm-validator/assets/charts/one-lint-one-render-error-apiVersion-v2.tgz diff --git a/tests/sdc/sdc-helm-validator/assets/charts/one-lint-warning-apiVersion-v2.tgz b/tests/sdc/sdc-helm-validator/assets/charts/one-lint-warning-apiVersion-v2.tgz Binary files differnew file mode 100644 index 00000000..51f4dd1d --- /dev/null +++ b/tests/sdc/sdc-helm-validator/assets/charts/one-lint-warning-apiVersion-v2.tgz diff --git a/tests/sdc/sdc-helm-validator/sdc-helm-validator.robot b/tests/sdc/sdc-helm-validator/sdc-helm-validator.robot new file mode 100644 index 00000000..04b570f9 --- /dev/null +++ b/tests/sdc/sdc-helm-validator/sdc-helm-validator.robot @@ -0,0 +1,274 @@ +*** Settings *** +Documentation Testing SDC Helm Validator +Suite Setup Create Validator Session +Library RequestsLibrary +Library OperatingSystem +Library Collections + +*** Variables *** +${VALIDATOR_URL} http://${VALIDATOR} +${VERSIONS_ENDPOINT} /versions +${VALIDATE_ENDPOINT} /validate + +${CHARTS_PATH} %{WORKSPACE}/tests/sdc/sdc-helm-validator/assets/charts/ + +${CHART_CORRECT_V2} /correct-apiVersion-v2.tgz +${CHART_LINT_WARNING_V2} /one-lint-warning-apiVersion-v2.tgz +${CHART_LINT_RENDER_ERROR_V2} /one-lint-one-render-error-apiVersion-v2.tgz +${CHART_INCORRECT} /incorrect-chart.tgz + +${REQ_KEY_VERSION_DESIRED} versionDesired +${REQ_KEY_IS_LINTED} isLinted +${REQ_KEY_IS_STRICT_LINTED} isStrictLinted +${REQ_KEY_FILE} file + +${RESP_KEY_VERSIONS} versions +${RESP_KEY_VERSION_USED} versionUsed +${RESP_KEY_DEPLOYABLE} deployable +${RESP_KEY_VALID} valid +${RESP_KEY_RENDER_ERRORS} renderErrors +${RESP_KEY_LINT_ERROR} lintError +${RESP_KEY_LINT_WARNING} lintWarning + + +*** Test Cases *** + +Verify That Sdc Helm Validator Correctly Responds With Supported Versions Array + [Tags] SDC_HELM_VALIDATOR_1 + [Documentation] Verify that validator correctly responds with supported helm versions array. + ... Send GET request to ask for supported versions array. + ... Should reply with JSON containing an array of Helm versions that are supported by the validator. + [Timeout] 5 minute + + ${resp}= GET On Session ${VALIDATOR_SESSION} ${VERSIONS_ENDPOINT} + Status Should Be 200 ${resp} + + @{versions}= Get From Dictionary ${resp.json()} ${RESP_KEY_VERSIONS} + Should Not Be Empty ${versions} + + FOR ${version} IN @{versions} + Should Match Regexp ${version} \\d+\.\\d+\.\\d+ + END + +Verify That Sdc Helm Validator Correctly Responds For Correct Chart Validation Request With Default Version + [Tags] SDC_HELM_VALIDATOR_2 + [Documentation] Verify that validator correctly responds for correct chart validation request with default version. + ... Send POST request to validate correct chart. Input: Helm chart with api version v2, no additional data. + ... Should reply with JSON containing the following information: used version = 3.x.x, deployable = true, render errors = [] + [Timeout] 5 minute + + ${other_data}= Create Dictionary + ${resp}= Send Post Request ${CHART_CORRECT_V2} ${other_data} + + Status Should Be 200 ${resp} + + Dictionary Should Not Contain Key ${resp.json()} ${RESP_KEY_LINT_ERROR} + Dictionary Should Not Contain Key ${resp.json()} ${RESP_KEY_LINT_WARNING} + Dictionary Should Not Contain Key ${resp.json()} ${RESP_KEY_VALID} + + ${version}= Get By Key ${resp.json()} ${RESP_KEY_VERSION_USED} + Should Start With ${version} 3. + + ${isDeployable}= Get By Key ${resp.json()} ${RESP_KEY_DEPLOYABLE} + Should Be True ${isDeployable} + + ${errors}= Get By Key ${resp.json()} ${RESP_KEY_RENDER_ERRORS} + Should Be Empty ${errors} + +Verify That Sdc Helm Validator Correctly Responds For Correct Chart Validation Request With Given V3 Version + [Tags] SDC_HELM_VALIDATOR_3 + [Documentation] Verify that validator correctly responds for correct chart validation request with given v3 version. + ... Send POST request to validate correct chart. Input: Helm chart with api version v2, desired version = v3. + ... Should reply with JSON containing the following information: used version = 3.x.x, deployable = true, render errors = []. + [Timeout] 5 minute + + ${other_data}= Create Dictionary ${REQ_KEY_VERSION_DESIRED}=v3 + ${resp}= Send Post Request ${CHART_CORRECT_V2} ${other_data} + + Status Should Be 200 ${resp} + + ${version}= Get By Key ${resp.json()} ${RESP_KEY_VERSION_USED} + Should Start With ${version} 3. + + ${isDeployable}= Get By Key ${resp.json()} ${RESP_KEY_DEPLOYABLE} + Should Be True ${isDeployable} + + ${errors}= Get By Key ${resp.json()} ${RESP_KEY_RENDER_ERRORS} + Should Be Empty ${errors} + +Verify That Sdc Helm Validator Responds With Error For Chart Validation Request With Invalid Version + [Tags] SDC_HELM_VALIDATOR_4 + [Documentation] Verify that validator responds with error and 400 status code for validation request with invalid version. + ... Send POST request with correct chart but not supported Helm version. Input: Correct helm chart, desired version = v10. + ... Should reply with JSON containing error message with information regarding not supported Helm version. Response code should be 400. + [Timeout] 5 minute + + ${chart_path} Catenate SEPARATOR= ${CHARTS_PATH} ${CHART_CORRECT_V2} + ${files}= Create Multi Part ${chart_path} + ${other_data}= Create Dictionary ${REQ_KEY_VERSION_DESIRED}=v10 + ${resp}= Post Request ${VALIDATOR_SESSION} ${VALIDATE_ENDPOINT} files=${files} data=${other_data} + + Should Be Equal As Strings ${resp.status_code} 400 + Should Be Equal As Strings ${resp.text} {"message":"Version: 10 is not supported"} + +Verify That Sdc Helm Validator Correctly Responds For Correct Chart Validation Request With Random Supported Version + [Tags] SDC_HELM_VALIDATOR_5 + [Documentation] Verify that validator correctly responds for correct chart validation request with random supported version. + ... Send GET request to ask for supported versions array. + ... Should reply with JSON containing an array of Helm versions that are supported by the validator. + ... Select random version from the returned array. + ... Send POST request with correct chart and randomly chosen supported Helm version. Input: Correct helm chart, desired version = [randomly selected]. + ... Response code should be 200. + [Timeout] 5 minute + + ${resp}= GET On Session ${VALIDATOR_SESSION} ${VERSIONS_ENDPOINT} + ${versions}= Get From Dictionary ${resp.json()} ${RESP_KEY_VERSIONS} + ${list_size}= Get length ${versions} + ${random_index}= Evaluate random.randint(0, ${list_size}-1) + ${version}= Get From List ${versions} ${random_index} + Status Should Be 200 ${resp} + + ${other_data}= Create Dictionary ${REQ_KEY_VERSION_DESIRED}=${version} + ${resp}= Send Post Request ${CHART_CORRECT_V2} ${other_data} + Status Should Be 200 ${resp} + +Verify That Sdc Helm Validator Correctly Responds For Correct Chart Validation Request With Lint + [Tags] SDC_HELM_VALIDATOR_6 + [Documentation] Verify that validator correctly responds for correct chart validation request with lint. + ... Send POST request to validate correct chart and lint. Input: Helm chart with api version v2, linted = true. + ... Should reply with JSON containing the following information: deployable = true, valid = true, render errors = [], lint errors = [], lint warnings = []. + ... Status code should be 200. + [Timeout] 5 minute + + ${other_data}= Create Dictionary ${REQ_KEY_IS_LINTED}=true + ${resp}= Send Post Request ${CHART_CORRECT_V2} ${other_data} + Status Should Be 200 ${resp} + + ${isDeployable}= Get By Key ${resp.json()} ${RESP_KEY_DEPLOYABLE} + Should Be True ${isDeployable} + + ${isValid}= Get By Key ${resp.json()} ${RESP_KEY_VALID} + Should Be True ${isValid} + + ${renderErrors}= Get By Key ${resp.json()} ${RESP_KEY_RENDER_ERRORS} + Should Be Empty ${renderErrors} + + ${lintErrors}= Get By Key ${resp.json()} ${RESP_KEY_LINT_ERROR} + Should Be Empty ${lintErrors} + + ${lintWarnings}= Get By Key ${resp.json()} ${RESP_KEY_LINT_WARNING} + Should Be Empty ${lintWarnings} + +Verify That Sdc Helm Validator Correctly Responds For Chart Validation Request With Lint Warnings + [Tags] SDC_HELM_VALIDATOR_7 + [Documentation] Verify that validator correctly responds for chart validation request with lint warnings. + ... Send POST request to validate chart and lint. Input: Helm chart that should cause lint warning, linted = true. + ... Should reply with JSON containing the following information: deployable = true, valid = true, render errors = [], lint warning = [not empty] + ... Status code should be 200. + [Timeout] 5 minute + + ${other_data}= Create Dictionary ${REQ_KEY_IS_LINTED}=true + ${resp}= Send Post Request ${CHART_LINT_WARNING_V2} ${other_data} + Status Should Be 200 ${resp} + + ${isDeployable}= Get By Key ${resp.json()} ${RESP_KEY_DEPLOYABLE} + Should Be True ${isDeployable} + + ${isValid}= Get By Key ${resp.json()} ${RESP_KEY_VALID} + Should Be True ${isValid} + + ${renderErrors}= Get By Key ${resp.json()} ${RESP_KEY_RENDER_ERRORS} + Should Be Empty ${renderErrors} + + ${lintErrors}= Get By Key ${resp.json()} ${RESP_KEY_LINT_ERROR} + Should Be Empty ${lintErrors} + + @{lintWarnings}= Get By Key ${resp.json()} ${RESP_KEY_LINT_WARNING} + Should Not Be Empty @{lintWarnings} + Should Contain @{lintWarnings} [WARNING] templates/: directory not found + +Verify That Sdc Helm Validator Correctly Responds For Chart Validation Request With Lint Strict Checking + [Tags] SDC_HELM_VALIDATOR_8 + [Documentation] Verify that validator correctly responds for chart validation request with lint strict checking. + ... Send POST request to validate chart and strictly lint. Input: Helm chart that should cause lint warning, linted = true, strict linted = true. + ... Should reply with JSON containing the following information: deployable = true, valid = false, render errors = [], lint warning = [not empty]. + ... Status code should be 200. + [Timeout] 5 minute + + ${other_data}= Create Dictionary ${REQ_KEY_IS_LINTED}=true ${REQ_KEY_IS_STRICT_LINTED}=true + ${resp}= Send Post Request ${CHART_LINT_WARNING_V2} ${other_data} + Status Should Be 200 ${resp} + + ${isDeployable}= Get By Key ${resp.json()} ${RESP_KEY_DEPLOYABLE} + Should Be True ${isDeployable} + + ${isValid}= Get By Key ${resp.json()} ${RESP_KEY_VALID} + Should Not Be True ${isValid} There should be a lint warning, which in strict mode on should make the chart invalid + + ${renderErrors}= Get By Key ${resp.json()} ${RESP_KEY_RENDER_ERRORS} + Should Be Empty ${renderErrors} + + ${lintErrors}= Get By Key ${resp.json()} ${RESP_KEY_LINT_ERROR} + Should Be Empty ${lintErrors} + + ${lintWarnings}= Get By Key ${resp.json()} ${RESP_KEY_LINT_WARNING} + Should Not Be Empty ${lintWarnings} + Should Contain @{lintWarnings} [WARNING] templates/: directory not found + +Verify That Sdc Helm Validator Correctly Responds For Chart Validation Request With Lint And Render Errors + [Tags] SDC_HELM_VALIDATOR_9 + [Documentation] Verify that validator correctly responds for chart validation request with lint and render errors. + ... Send POST request to validate chart and strictly lint. Input: Helm chart that should cause lint and render errors, linted = true, strict linted = true. + ... Should reply with JSON containing the following information: deployable = false, valid = false, render errors = [not empty], lint errors = [not empty], lint warnings = []. + ... Status code should be 200. + [Timeout] 5 minute + + ${other_data}= Create Dictionary ${REQ_KEY_IS_LINTED}=true ${REQ_KEY_IS_STRICT_LINTED}=true + ${resp}= Send Post Request ${CHART_LINT_RENDER_ERROR_V2} ${other_data} + Status Should Be 200 ${resp} + + ${isDeployable}= Get By Key ${resp.json()} ${RESP_KEY_DEPLOYABLE} + Should Not Be True ${isDeployable} There should be render errors which should make the chart not deployable + + ${isValid}= Get By Key ${resp.json()} ${RESP_KEY_VALID} + Should Not Be True ${isValid} There should be lint errors which should make the chart invalid + + @{renderErrors}= Get By Key ${resp.json()} ${RESP_KEY_RENDER_ERRORS} + Should Not Be Empty @{renderErrors} + Should Contain @{renderErrors} Error: template: mychartname/templates/test.yaml:2:18: executing "mychartname/templates/test.yaml" at <.Values.image.repository>: nil pointer evaluating interface {}.repository + + @{lintErrors}= Get By Key ${resp.json()} ${RESP_KEY_LINT_ERROR} + Should Not Be Empty @{lintErrors} + Should Contain @{lintErrors} [ERROR] templates/: template: mychartname/templates/test.yaml:2:18: executing "mychartname/templates/test.yaml" at <.Values.image.repository>: nil pointer evaluating interface {}.repository + + ${lintWarnings}= Get By Key ${resp.json()} ${RESP_KEY_LINT_WARNING} + Should Be Empty ${lintWarnings} + +*** Keywords *** + +Create Validator Session + Create Session validator_session ${VALIDATOR_URL} + Set Suite Variable ${VALIDATOR_SESSION} validator_session + +Send Post Request + [Arguments] ${chart_name} ${data_dictionary} + ${chart_path} Catenate SEPARATOR= ${CHARTS_PATH} ${chart_name} + ${files}= Create Multi Part ${chart_path} + + ${resp}= POST On Session ${VALIDATOR_SESSION} ${VALIDATE_ENDPOINT} files=${files} data=${data_dictionary} + [Return] ${resp} + +Create Multi Part + [Arguments] ${path} + ${data}= Get Binary File ${path} + ${files}= Create Dictionary + ${fileDir} ${fileName}= Split Path ${path} + ${partData}= Create List ${fileName} ${data} + Set To Dictionary ${files} ${REQ_KEY_FILE}=${partData} + [Return] ${files} + +Get By Key + [Arguments] ${dict} ${key} + Dictionary Should Contain Key ${dict} ${key} + ${value}= Get From Dictionary ${dict} ${key} + [Return] ${value} |