diff --git a/examples/bats/test_helm_package.bats b/examples/bats/test_helm_package.bats index dc3fad6..7fb4a82 100755 --- a/examples/bats/test_helm_package.bats +++ b/examples/bats/test_helm_package.bats @@ -15,7 +15,7 @@ setup() { } verify_helm() { - helm template ../drupal | kubectl apply --dry-run -f - + helm template ../drupal | kubectl apply --dry-run -f - } @@ -29,7 +29,7 @@ verify_helm() { @test "verify the deployment of the chart in dry-run mode" { run verify_helm - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] } @@ -59,28 +59,28 @@ verify_helm() { run verify "there is 1 pod named 'my-test-drupal'" [ "$status" -eq 0 ] - run verify "there is 1 pod named 'my-test-varnish'" - [ "$status" -eq 0 ] + run verify "there is 1 pod named 'my-test-varnish'" + [ "$status" -eq 0 ] # Postgres specifics run verify "there is 1 service named 'my-test-postgres'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] run verify "there is 1 ep named 'my-test-postgres'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] run verify "'.subsets[*].ports[*].port' is '44320' for endpoints named 'my-test-postgres'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] run verify "'.subsets[*].addresses[*].ip' is '10.234.121.117' for endpoints named 'my-test-postgres'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] # Services run verify "there is 1 service named 'my-test-drupal'" [ "$status" -eq 0 ] run verify "there is 1 service named 'my-test-varnish'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] run verify "'port' is '80' for services named 'my-test-drupal'" [ "$status" -eq 0 ] @@ -93,24 +93,24 @@ verify_helm() { [ "$status" -eq 0 ] run verify "there is 1 deployment named 'my-test-varnish'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] # Ingress run verify "there is 1 ingress named 'my-test-varnish'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] run verify "'.spec.rules[*].host' is 'varnish.test.local' for ingress named 'my-test-varnish'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] run verify "'.spec.rules[*].http.paths[*].backend.serviceName' is 'my-test-varnish' for ingress named 'my-test-varnish'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] # PODs should be started run try "at most 5 times every 30s to get pods named 'my-test-drupal' and verify that 'status' is 'running'" [ "$status" -eq 0 ] - run try "at most 5 times every 30s to get pods named 'my-test-varnish' and verify that 'status' is 'running'" - [ "$status" -eq 0 ] + run try "at most 5 times every 30s to get pods named 'my-test-varnish' and verify that 'status' is 'running'" + [ "$status" -eq 0 ] # Indicate to other tests the deployment succeeded echo "started" > tests.status.tmp @@ -140,15 +140,15 @@ verify_helm() { [ "$status" -eq 0 ] [ "$output" == "release \"my-test\" deleted" ] - run verify "there is 0 service named 'my-test'" - [ "$status" -eq 0 ] + run verify "there is 0 service named 'my-test'" + [ "$status" -eq 0 ] - run verify "there is 0 deployment named 'my-test'" - [ "$status" -eq 0 ] + run verify "there is 0 deployment named 'my-test'" + [ "$status" -eq 0 ] sleep 60 - run verify "there is 0 pod named 'my-test'" - [ "$status" -eq 0 ] + run verify "there is 0 pod named 'my-test'" + [ "$status" -eq 0 ] } diff --git a/examples/bats/test_kubectl_and_oc.sh b/examples/bats/test_kubectl_and_oc.sh index 4fa9b9d..b740e79 100644 --- a/examples/bats/test_kubectl_and_oc.sh +++ b/examples/bats/test_kubectl_and_oc.sh @@ -81,12 +81,12 @@ try "at most 2 times every 30s to get svc named 'nginx' and verify that '.spec.p # Splitting a request over several lines try "at most 2 times every 30s "\ - "to get svc named 'nginx' and "\ - "verify that '.spec.ports[*].targetPort' is '8484'" + "to get svc named 'nginx' and "\ + "verify that '.spec.ports[*].targetPort' is '8484'" # Using quotes differently # (make sure to surround single quotes by double ones) try at most 2 times every 30s \ - to get svc named "'nginx'" and \ - verify that "'.spec.ports[*].targetPort'" is "'8484'" + to get svc named "'nginx'" and \ + verify that "'.spec.ports[*].targetPort'" is "'8484'" diff --git a/lib/detik.bash b/lib/detik.bash index 6093283..47506f2 100644 --- a/lib/detik.bash +++ b/lib/detik.bash @@ -263,7 +263,7 @@ verify_value() { for line in $result; do # Keep the second column (property to verify) - # This column may contain spaces. + # This column may contain spaces. value=$(cut -d ' ' -f 2- <<< "$line" | xargs) element=$(cut -d ' ' -f 1 <<< "$line" | xargs) diff --git a/lib/utils.bash b/lib/utils.bash index 7af2738..ff6f5b1 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -63,7 +63,7 @@ detik_debug() { if [[ "$DEBUG_DETIK" == "true" ]]; then debug "$1" - fi + fi } diff --git a/tests/resources/without_lint_errors.no.run.txt b/tests/resources/without_lint_errors.no.run.txt index bed0d46..6e2a970 100644 --- a/tests/resources/without_lint_errors.no.run.txt +++ b/tests/resources/without_lint_errors.no.run.txt @@ -178,18 +178,18 @@ try "at most 2 times every 30s to find 1 svc named 'nginx' with '.spec.ports[*]. # Splitting a request over several lines try "at most 2 times every 30s "\ - "to get svc named 'nginx' and "\ - "verify that '.spec.ports[*].targetPort' is '8484'" + "to get svc named 'nginx' and "\ + "verify that '.spec.ports[*].targetPort' is '8484'" # Using quotes differently # (make sure to surround single quotes by double ones) try at most 2 times every 30s \ - to get svc named "'nginx'" and \ - verify that "'.spec.ports[*].targetPort'" is "'8484'" + to get svc named "'nginx'" and \ + verify that "'.spec.ports[*].targetPort'" is "'8484'" try at most 2 times every 30s \ - to get svc named "'nginx'" and \ - verify that "'.spec.ports[*].targetPort'" matches "'[[:digit:]]+'" + to get svc named "'nginx'" and \ + verify that "'.spec.ports[*].targetPort'" matches "'[[:digit:]]+'" try "at most 2 times every 30s "\ "to find 1 svc named 'nginx' "\ diff --git a/tests/resources/without_lint_errors.run.txt b/tests/resources/without_lint_errors.run.txt index 6e45b63..13e9ced 100644 --- a/tests/resources/without_lint_errors.run.txt +++ b/tests/resources/without_lint_errors.run.txt @@ -178,18 +178,18 @@ run try "at most 2 times every 30s to find 1 svc named 'nginx' with '.spec.ports # Splitting a request over several lines run try "at most 2 times every 30s "\ - "to get svc named 'nginx' and "\ - "verify that '.spec.ports[*].targetPort' is '8484'" + "to get svc named 'nginx' and "\ + "verify that '.spec.ports[*].targetPort' is '8484'" # Using quotes differently # (make sure to surround single quotes by double ones) run try at most 2 times every 30s \ - to get svc named "'nginx'" and \ - verify that "'.spec.ports[*].targetPort'" is "'8484'" + to get svc named "'nginx'" and \ + verify that "'.spec.ports[*].targetPort'" is "'8484'" run try at most 2 times every 30s \ - to get svc named "'nginx'" and \ - verify that "'.spec.ports[*].targetPort'" matches "'[[:digit:]]+'" + to get svc named "'nginx'" and \ + verify that "'.spec.ports[*].targetPort'" matches "'[[:digit:]]+'" run try "at most 2 times every 30s "\ "to find 1 svc named 'nginx' "\ diff --git a/tests/test.detik.try.to.find.being.bats b/tests/test.detik.try.to.find.being.bats index 47e0f9a..3124815 100755 --- a/tests/test.detik.try.to.find.being.bats +++ b/tests/test.detik.try.to.find.being.bats @@ -22,7 +22,7 @@ mytest_with_namespace() { } mytest_with_spaces() { - # The namespace should not appear (it is set in 1st position) + # The namespace should not appear (it is set in 1st position) [[ "$1" != "--namespace=test_ns" ]] || return 1 # Return the result @@ -52,12 +52,12 @@ mytest_with_spaces() { @test "trying to find 1 certificate as a single-line value with spaces" { - DETIK_CLIENT_NAME="mytest_with_spaces" + DETIK_CLIENT_NAME="mytest_with_spaces" run try "at most 1 times every 1s to find 1 certificate named 'cert' with 'value' being '----BEGIN CERTIFICATE----'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] [ ${#lines[@]} -eq 3 ] [ "${lines[0]}" = "Valid expression. Verification in progress..." ] - [ "${lines[1]}" = "Current value for cert1 is ----oops----..." ] + [ "${lines[1]}" = "Current value for cert1 is ----oops----..." ] [ "${lines[2]}" = "cert2 has the right value (----begin certificate----)." ] } diff --git a/tests/test.detik.try.to.find.matching.bats b/tests/test.detik.try.to.find.matching.bats index a0a1f01..edfef63 100755 --- a/tests/test.detik.try.to.find.matching.bats +++ b/tests/test.detik.try.to.find.matching.bats @@ -22,7 +22,7 @@ mytest_with_namespace() { } mytest_with_spaces() { - # The namespace should not appear (it is set in 1st position) + # The namespace should not appear (it is set in 1st position) [[ "$1" != "--namespace=test_ns" ]] || return 1 # Return the result @@ -108,12 +108,12 @@ mytest_with_spaces() { @test "trying to find 1 certificate as a single-line value with spaces" { - DETIK_CLIENT_NAME="mytest_with_spaces" + DETIK_CLIENT_NAME="mytest_with_spaces" run try "at most 1 times every 1s to find 1 certificate named 'cert' with 'value' matching '----BEGIN .*'" - [ "$status" -eq 0 ] + [ "$status" -eq 0 ] [ ${#lines[@]} -eq 3 ] [ "${lines[0]}" = "Valid expression. Verification in progress..." ] - [ "${lines[1]}" = "Current value for cert1 is ----OOPS----..." ] + [ "${lines[1]}" = "Current value for cert1 is ----OOPS----..." ] [ "${lines[2]}" = "cert2 matches the regular expression (found ----BEGIN CERTIFICATE----)." ] } diff --git a/tests/test.detik.try.to.verify.is.bats b/tests/test.detik.try.to.verify.is.bats index 09992c6..ebc876c 100755 --- a/tests/test.detik.try.to.verify.is.bats +++ b/tests/test.detik.try.to.verify.is.bats @@ -53,7 +53,7 @@ mytest_with_spaces() { @test "trying to verify the content of a single-line value with spaces" { - DETIK_CLIENT_NAME="mytest_with_spaces" + DETIK_CLIENT_NAME="mytest_with_spaces" run try "at most 1 times every 1s to get something named 'cert1' and verify that 'value' is '----BEGIN CERTIFICATE----'" [ "$status" -eq 0 ] [ ${#lines[@]} -eq 2 ] diff --git a/tests/test.detik.try.to.verify.matches.bats b/tests/test.detik.try.to.verify.matches.bats index a4d464f..ea267c7 100755 --- a/tests/test.detik.try.to.verify.matches.bats +++ b/tests/test.detik.try.to.verify.matches.bats @@ -104,7 +104,7 @@ mytest_with_spaces() { @test "trying to verify the content of a single-line value with spaces (success)" { - DETIK_CLIENT_NAME="mytest_with_spaces" + DETIK_CLIENT_NAME="mytest_with_spaces" run try "at most 1 times every 1s to get something named 'cert1' and verify that 'value' matches '----BEGIN CERT.*'" [ "$status" -eq 0 ] [ ${#lines[@]} -eq 2 ] @@ -114,7 +114,7 @@ mytest_with_spaces() { @test "trying to verify the content of a single-line value with spaces (failure)" { - DETIK_CLIENT_NAME="mytest_with_spaces" + DETIK_CLIENT_NAME="mytest_with_spaces" run try "at most 1 times every 1s to get something named 'cert1' and verify that 'value' matches 'BEGIN CATE'" [ "$status" -eq 3 ] [ ${#lines[@]} -eq 2 ]