Skip to content

Commit

Permalink
test: add config test action
Browse files Browse the repository at this point in the history
Signed-off-by: Darren Murray <darren.murray@lacework.net>
  • Loading branch information
dmurray-lacework committed Nov 23, 2023
1 parent 8548abb commit eb09d03
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test_config.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

@test "Validate json with no args" {
local path=$(pwd)
result=$(bash -c "source setup_lacework_agent.sh && render_agent_config $path")
local result=$(bash -c "source setup_lacework_agent.sh && render_agent_config $path")

local config="${path}/config/config.json"
validateJson=$(jsonlint $config)
local validateJson=$(jsonlint $config)
echo $validateJson

status=$?
local 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 result=$(bash -c "source setup_lacework_agent.sh && render_agent_config $path $addCfg")
local config="${path}/config/config.json"
validateJson=$(jsonlint $config)
local validateJson=$(jsonlint $config)
echo $validateJson

status=$?
local status=$?
[ $status -eq 0 ]
}

Expand All @@ -29,11 +29,11 @@
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 result=$(bash -c "source setup_lacework_agent.sh && render_agent_config $path $addCfg $serverUrl, $tags")
local config="${path}/config/config.json"
validateJson=$(jsonlint $config)
local validateJson=$(jsonlint $config)
echo $validateJson

status=$?
local status=$?
[ $status -eq 0 ]
}

0 comments on commit eb09d03

Please sign in to comment.