-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Darren Murray <darren.murray@lacework.net>
- Loading branch information
1 parent
defed1b
commit 7da23a3
Showing
3 changed files
with
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: "Config Test" | ||
on: [pull_request] | ||
jobs: | ||
check-bats-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '14' | ||
- run: npm install -g bats | ||
- run: npm install -g jsonlint | ||
- run: bats test_config.bats |
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,39 @@ | ||
#!/usr/bin/env bats | ||
|
||
@test "Validate json with no args" { | ||
local path=$(pwd) | ||
result=$(bash -c "source setup_lacework_agent.sh && render_agent_config $path") | ||
|
||
local config="${path}/config/config.json" | ||
validateJson=$(jsonlint $config) | ||
echo $validateJson | ||
|
||
status=$? | ||
[ $status -eq 0 ] | ||
} | ||
|
||
@test "Validate json with additonal config" { | ||
local path=$(pwd) | ||
local addCfg='"{\"codeaware\": {\"enable\":\"all\" }}"' | ||
result=$(bash -c "source setup_lacework_agent.sh && render_agent_config $path $addCfg") | ||
local config="${path}/config/config.json" | ||
validateJson=$(jsonlint $config) | ||
echo $validateJson | ||
|
||
status=$? | ||
[ $status -eq 0 ] | ||
} | ||
|
||
@test "Validate json with all config" { | ||
local path=$(pwd) | ||
local addCfg='"{\"codeaware\": {\"enable\":\"all\" }}"' | ||
local serverUrl="https://agent.lacework.net" | ||
local tags='"{\"env\": \"dev\"}"' | ||
result=$(bash -c "source setup_lacework_agent.sh && render_agent_config $path $addCfg $serverUrl, $tags") | ||
local config="${path}/config/config.json" | ||
validateJson=$(jsonlint $config) | ||
echo $validateJson | ||
|
||
status=$? | ||
[ $status -eq 0 ] | ||
} |