-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
76 additions
and
14 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
golang 1.22.5 | ||
mockery 2.32.3 | ||
golangci-lint 1.59.1 | ||
bats 1.11.1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
setup() { | ||
# Set the test root as the project root | ||
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )/../.." >/dev/null 2>&1 && pwd )" | ||
|
||
# Add the build folder to the PATH | ||
PATH="$DIR/build:$PATH" | ||
} | ||
|
||
@test "it should show help" { | ||
run trento-agent --help | ||
|
||
[ "$status" -eq 0 ] | ||
echo "$output" | grep -q "Usage:" | ||
} | ||
|
||
@test "it should show agent id" { | ||
run trento-agent id | ||
|
||
[ "$status" -eq 0 ] | ||
[ -n "$output" ] | ||
} |
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,33 @@ | ||
setup() { | ||
# Set the test root as the project root | ||
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )/../.." >/dev/null 2>&1 && pwd )" | ||
|
||
# Add the build folder to the PATH | ||
PATH="$DIR/build:$PATH" | ||
} | ||
|
||
|
||
@test "it should include the dummy plugin into list" { | ||
run trento-agent facts list --plugins-folder ./build/plugin_examples | ||
|
||
[ "$status" -eq 0 ] | ||
echo "$output" | grep -q "dummy" | ||
} | ||
|
||
@test "it should should execute the dummy plugin" { | ||
run trento-agent facts gather \ | ||
--plugins-folder ./build/plugin_examples \ | ||
--gatherer dummy --argument 1 | ||
|
||
[ "$status" -eq 0 ] | ||
echo $output | grep -q "Name: 1" | ||
} | ||
|
||
@test "it should execute the dummy plugin with a different argument" { | ||
run trento-agent facts gather \ | ||
--plugins-folder ./build/plugin_examples \ | ||
--gatherer dummy --argument 2 | ||
|
||
[ "$status" -eq 0 ] | ||
echo $output | grep -q "Name: 2" | ||
} |