-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make $PWD between TestStep and TestAssert commands consistent (#519)
The $PWD is different when running commands in TestStep and TestAssert which makes it required e.g. to use abs path to reference a script. This change aligns the path passed into testutils.RunAssertCommands() to be the same as to testutils.RunCommands(). Fixes #322 Signed-off-by: Martin Schuppert <[email protected]>
- Loading branch information
Showing
6 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
pkg/test/step_integration_test_data/assert_commands/path_script/00-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 30 | ||
commands: | ||
- script: | | ||
echo step call script using relative path | ||
./test/script.sh | ||
- script: | | ||
echo step call script using absolute path | ||
$(pwd)/test/script.sh |
10 changes: 10 additions & 0 deletions
10
pkg/test/step_integration_test_data/assert_commands/path_script/00-step.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
timeout: 30 | ||
commands: | ||
- script: | | ||
echo step call script using relative path | ||
./test/script.sh | ||
- script: | | ||
echo step call script using absolute path | ||
$(pwd)/test/script.sh |
11 changes: 11 additions & 0 deletions
11
pkg/test/step_integration_test_data/assert_commands/path_script/test/script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
echo -n "$0 $@" | ||
if [[ $0 == ./* ]]; then | ||
echo "relative" | ||
exit 0 | ||
elif [[ $0 == /* ]]; then | ||
echo "absolute" | ||
exit 0 | ||
fi | ||
exit 1 |