Skip to content

Commit

Permalink
Normalize indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-zurczak committed Sep 29, 2023
1 parent faacaad commit a7b2e19
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 50 deletions.
42 changes: 21 additions & 21 deletions examples/bats/test_helm_package.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ setup() {
}

verify_helm() {
helm template ../drupal | kubectl apply --dry-run -f -
helm template ../drupal | kubectl apply --dry-run -f -
}


Expand All @@ -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 ]
}


Expand Down Expand Up @@ -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 ]
Expand All @@ -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
Expand Down Expand Up @@ -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 ]
}


Expand Down
8 changes: 4 additions & 4 deletions examples/bats/test_kubectl_and_oc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'"

2 changes: 1 addition & 1 deletion lib/detik.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ detik_debug() {

if [[ "$DEBUG_DETIK" == "true" ]]; then
debug "$1"
fi
fi
}


Expand Down
12 changes: 6 additions & 6 deletions tests/resources/without_lint_errors.no.run.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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' "\
Expand Down
12 changes: 6 additions & 6 deletions tests/resources/without_lint_errors.run.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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' "\
Expand Down
8 changes: 4 additions & 4 deletions tests/test.detik.try.to.find.being.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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----)." ]
}

Expand Down
8 changes: 4 additions & 4 deletions tests/test.detik.try.to.find.matching.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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----)." ]
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test.detik.try.to.verify.is.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down
4 changes: 2 additions & 2 deletions tests/test.detik.try.to.verify.matches.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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 ]
Expand Down

0 comments on commit a7b2e19

Please sign in to comment.