From a4f252ff2c965ec7a007ea465eaf937f02760af3 Mon Sep 17 00:00:00 2001 From: Hongyi Zhang Date: Fri, 12 Jun 2020 18:12:53 +0000 Subject: [PATCH] fix bug where *_test.sh doesn't source snips.sh (#7545) * fix bug where *_test.sh doesn't source snips.sh * remove 'source snips.sh' from scripts --- .../egress/egress-gateway-tls-origination/mtls_test.sh | 2 -- .../egress/egress-gateway-tls-origination/tls_test.sh | 2 -- tests/doc_test_framework.go | 4 +++- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/mtls_test.sh b/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/mtls_test.sh index 4875c18145..aad7fb42a3 100644 --- a/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/mtls_test.sh +++ b/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/mtls_test.sh @@ -21,8 +21,6 @@ set -e set -u set -o pipefail -source "${REPO_ROOT}/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/snips.sh" - # Generate Certificates for service outside the mesh to use for mTLS snip_generate_client_and_server_certificates_and_keys_1 snip_generate_client_and_server_certificates_and_keys_2 diff --git a/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/tls_test.sh b/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/tls_test.sh index fa1be8e096..8afff3be4e 100644 --- a/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/tls_test.sh +++ b/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/tls_test.sh @@ -21,8 +21,6 @@ set -e set -u set -o pipefail -source "${REPO_ROOT}/content/en/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/snips.sh" - # Deploy sleep sample and set up variable pointing to it set +e kubectl delete pods -l app=sleep --force diff --git a/tests/doc_test_framework.go b/tests/doc_test_framework.go index 618c2ffe35..880e9cce8b 100644 --- a/tests/doc_test_framework.go +++ b/tests/doc_test_framework.go @@ -222,7 +222,9 @@ func split(testsAsString string) []string { // snippets and some test utilities. It receives `testPath`, which is the // path of the test script file to be run. func getHelperScript(testPath string) string { - snipsPath := strings.ReplaceAll(testPath, testFileSuffix, snipsFileSuffix) + splitPath := strings.Split(testPath, "/") + splitPath[len(splitPath)-1] = snipsFileSuffix + snipsPath := strings.Join(splitPath, "/") return fmt.Sprintf(helperTemplate, defaultPath, snipsPath) }