diff --git a/tests/acceptance/run.sh b/tests/acceptance/run.sh index 0234763ac..03c7e6c66 100755 --- a/tests/acceptance/run.sh +++ b/tests/acceptance/run.sh @@ -24,6 +24,7 @@ export SIMPLE_MOD_DIR=$MY_PATH/test_data/introspection_table_mod export CONFIG_PARSING_TEST_MOD=$MY_PATH/test_data/config_parsing_test_mod export FILE_PATH=$MY_PATH export CHECK_ALL_MOD=$MY_PATH/test_data/check_all_mod +export FUNCTIONALITY_TEST_MOD=$MY_PATH/test_data/functionality_test_mod # Must have these commands for the test suite to run declare -a required_commands=("jq" "sed" "steampipe" "rm" "mv" "cp" "mkdir" "cd" "head" "wc" "find" "basename" "dirname" "touch") diff --git a/tests/acceptance/test_data/check_all_mod/control.sp b/tests/acceptance/test_data/check_all_mod/control.sp index b39d04ec9..29fbc88ed 100644 --- a/tests/acceptance/test_data/check_all_mod/control.sp +++ b/tests/acceptance/test_data/check_all_mod/control.sp @@ -9,13 +9,13 @@ benchmark "check_all" { control "check_1" { title = "Control to verify steampipe check all functionality 1" description = "Control to verify steampipe check all functionality." - query = query.query_1 + query = query.query_1 severity = "high" } control "check_2" { title = "Control to verify steampipe check all functionality 2" description = "Control to verify steampipe check all functionality." - query = query.query_2 + query = query.query_2 severity = "critical" } \ No newline at end of file diff --git a/tests/acceptance/test_data/check_all_mod/mod.sp b/tests/acceptance/test_data/check_all_mod/mod.sp index b05b1eef1..4c3957fdf 100644 --- a/tests/acceptance/test_data/check_all_mod/mod.sp +++ b/tests/acceptance/test_data/check_all_mod/mod.sp @@ -1,4 +1,4 @@ mod "check_all_mod"{ title = "Steampipe check all test mod" - description = "This is a simple mod used for testing the steampipe check all feature. This mod is needed in acceptance tests." + description = "This is a simple mod used for testing the steampipe check all feature. This mod is needed in acceptance tests. Do not expand this mod." } \ No newline at end of file diff --git a/tests/acceptance/test_data/config_parsing_test_mod/mod.sp b/tests/acceptance/test_data/config_parsing_test_mod/mod.sp index 63c6155d0..581ccd2dd 100644 --- a/tests/acceptance/test_data/config_parsing_test_mod/mod.sp +++ b/tests/acceptance/test_data/config_parsing_test_mod/mod.sp @@ -1,4 +1,4 @@ -mod "chaos_cache_test_mod"{ - title = "Cache test mod" - description = "This is a simple mod used for testing the steampipe cache features. This mod will only run properly in acceptance tests." +mod "config_parsing_test_mod"{ + title = "Config parsing test mod" + description = "This is a simple mod used for testing the steampipe connection config parsing. This mod will only run properly in acceptance tests." } \ No newline at end of file diff --git a/tests/acceptance/test_data/failure_test_mod/mod.sp b/tests/acceptance/test_data/failure_test_mod/mod.sp index 812d8d3b9..4709498b7 100644 --- a/tests/acceptance/test_data/failure_test_mod/mod.sp +++ b/tests/acceptance/test_data/failure_test_mod/mod.sp @@ -1,12 +1,4 @@ mod "bad_test_mod" { - # hub metadata title = "Bad test mod" - description = "Steampipe Mod to test for failures" - color = "#FF9900" - categories = ["Public Cloud", "AWS"] - opengraph { - description ="foo" - title = "bar" - image = "/images/mods/turbot/azure-compliance-social-graphic.png" - } + description = "Steampipe Mod to test for failure scenarios in steampipe." } \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/functionality/cache.sp b/tests/acceptance/test_data/functionality_test_mod/functionality/cache.sp new file mode 100644 index 000000000..eef48eade --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/functionality/cache.sp @@ -0,0 +1,21 @@ +benchmark "check_cache_benchmark" { + title = "Benchmark to test the cache functionality in steampipe" + children = [ + control.cache_test_1, + control.cache_test_2 + ] +} + +control "cache_test_1" { + title = "Control to test cache functionality 1" + description = "Control to test cache functionality in steampipe." + sql = query.check_cache.sql + severity = "high" +} + +control "cache_test_2" { + title = "Control to test cache functionality 2" + description = "Control to test cache functionality in steampipe." + sql = query.check_cache.sql + severity = "high" +} \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/functionality/control_args.sp b/tests/acceptance/test_data/functionality_test_mod/functionality/control_args.sp new file mode 100644 index 000000000..aac29bd38 --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/functionality/control_args.sp @@ -0,0 +1,191 @@ +benchmark "query_and_control_parameters_benchmark" { + title = "Benchmark to test the query and control parameter functionalities in steampipe" + children = [ + control.query_params_with_defaults_and_no_args, + control.query_params_with_defaults_and_partial_named_args, + control.query_params_with_defaults_and_partial_positional_args, + control.query_params_with_defaults_and_all_named_args, + control.query_params_with_defaults_and_all_positional_args, + control.query_params_with_no_defaults_and_no_args, + control.query_params_with_no_defaults_with_named_args, + control.query_params_with_no_defaults_with_positional_args, + control.query_params_array_with_default, + control.query_params_map_with_default, + control.query_params_invalid_arg_syntax, + control.query_inline_sql_from_control_with_partial_named_args, + control.query_inline_sql_from_control_with_partial_positional_args, + control.query_inline_sql_from_control_with_no_args, + control.query_inline_sql_from_control_with_all_positional_args, + control.query_inline_sql_from_control_with_all_named_args + ] +} + +control "query_params_with_defaults_and_no_args" { + title = "Control to test query param functionality with defaults(and no args passed)" + query = query.query_params_with_all_defaults +} + +control "query_params_with_defaults_and_partial_named_args" { + title = "Control to test query param functionality with defaults(and some named args passed in query)" + query = query.query_params_with_all_defaults + args = { + "p2" = "command_parameter_2" + } +} + +control "query_params_with_defaults_and_partial_positional_args" { + title = "Control to test query param functionality with defaults(and some positional args passed in query)" + query = query.query_params_with_all_defaults + args = [ "command_parameter_1" ] +} + +control "query_params_with_defaults_and_all_named_args" { + title = "Control to test query param functionality with defaults(and all named args passed in query)" + query = query.query_params_with_all_defaults + args = { + "p1" = "command_parameter_1" + "p2" = "command_parameter_2" + "p3" = "command_parameter_3" + } +} + +control "query_params_with_defaults_and_all_positional_args" { + title = "Control to test query param functionality with defaults(and all positional args passed in query)" + query = query.query_params_with_all_defaults + args = [ "command_parameter_1", "command_parameter_2", "command_parameter_3" ] +} + +control "query_params_with_no_defaults_and_no_args" { + title = "Control to test query param functionality with no defaults(and no args passed)" + query = query.query_params_with_no_defaults +} + +control "query_params_with_no_defaults_with_named_args" { + title = "Control to test query param functionality with no defaults(and args passed in query)" + query = query.query_params_with_no_defaults + args = { + "p1" = "command_parameter_1" + "p2" = "command_parameter_2" + "p3" = "command_parameter_3" + } +} + +control "query_params_with_no_defaults_with_positional_args" { + title = "Control to test query param functionality with no defaults(and positional args passed in query)" + query = query.query_params_with_no_defaults + args = [ "command_parameter_1", "command_parameter_2","command_parameter_3" ] +} + +control "query_params_array_with_default" { + title = "Control to test query param functionality with an array param with default(and no args passed)" + query = query.query_array_params_with_default +} + +control "query_params_map_with_default" { + title = "Control to test query param functionality with a map param with default(and no args passed)" + query = query.query_map_params_with_default +} + +control "query_params_invalid_arg_syntax" { + title = "Control to test query param functionality with a map param with no default(and invalid args passed in query)" + query = query.query_map_params_with_no_default + args = { + "p1" = "command_parameter_1" + } +} + +control "query_inline_sql_from_control_with_partial_named_args" { + title = "Control to test the inline sql functionality within a control with defaults(and some named args passed in control)" + sql = "select 'ok' as status, 'steampipe' as resource, concat($1::text, ' ', $2::text, ' ', $3::text) as reason" + param "p1"{ + description = "p1" + default = "default_parameter_1" + } + param "p2"{ + description = "p2" + default = "default_parameter_2" + } + param "p3"{ + description = "p3" + default = "default_parameter_3" + } + args = { + "p1" = "command_parameter_1" + "p3" = "command_parameter_3" + } + } + +control "query_inline_sql_from_control_with_partial_positional_args" { + title = "Control to test the inline sql functionality within a control with defaults(and some positional args passed in control)" + sql = "select 'ok' as status, 'steampipe' as resource, concat($1::text, ' ', $2::text, ' ', $3::text) as reason" + param "p1"{ + description = "p1" + default = "default_parameter_1" + } + param "p2"{ + description = "p2" + default = "default_parameter_2" + } + param "p3"{ + description = "p3" + default = "default_parameter_3" + } + args = [ "command_parameter_1", "command_parameter_2" ] + } + +control "query_inline_sql_from_control_with_no_args" { + title = "Control to test the inline sql functionality within a control with defaults(and no args passed in control)" + sql = "select 'ok' as status, 'steampipe' as resource, concat($1::text, ' ', $2::text, ' ', $3::text) as reason" + param "p1"{ + description = "p1" + default = "default_parameter_1" + } + param "p2"{ + description = "p2" + default = "default_parameter_2" + } + param "p3"{ + description = "p3" + default = "default_parameter_3" + } + } + +control "query_inline_sql_from_control_with_all_positional_args" { + title = "Control to test the inline sql functionality within a control with defaults(and all positional args passed in control)" + sql = "select 'ok' as status, 'steampipe' as resource, concat($1::text, ' ', $2::text, ' ', $3::text) as reason" + param "p1"{ + description = "p1" + default = "default_parameter_1" + } + param "p2"{ + description = "p2" + default = "default_parameter_2" + } + param "p3"{ + description = "p3" + default = "default_parameter_3" + } + args = [ "command_parameter_1", "command_parameter_2", "command_parameter_3" ] + } + +control "query_inline_sql_from_control_with_all_named_args" { + title = "Control to test the inline sql functionality within a control with defaults(and all named args passed in control)" + sql = "select 'ok' as status, 'steampipe' as resource, concat($1::text, ' ', $2::text, ' ', $3::text) as reason" + param "p1"{ + description = "p1" + default = "default_parameter_1" + } + param "p2"{ + description = "p2" + default = "default_parameter_2" + } + param "p3"{ + description = "p3" + default = "default_parameter_3" + } + args = { + "p1" = "command_parameter_1" + "p2" = "command_parameter_2" + "p3" = "command_parameter_3" + } + } \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/functionality/control_summary.sp b/tests/acceptance/test_data/functionality_test_mod/functionality/control_summary.sp new file mode 100644 index 000000000..704c3539a --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/functionality/control_summary.sp @@ -0,0 +1,45 @@ +benchmark "control_summary_benchmark" { + title = "Benchmark to test the check summary output in steampipe" + children = [ + control.sample_control_1, + control.sample_control_2, + control.sample_control_3, + control.sample_control_4, + control.sample_control_5 + ] +} + +control "sample_control_1" { + title = "Sample control 1" + description = "A sample control" + sql = query.static_query.sql + severity = "high" +} + +control "sample_control_2" { + title = "Sample control 2" + description = "A sample control" + sql = query.static_query.sql + severity = "critical" +} + +control "sample_control_3" { + title = "Sample control 3" + description = "A sample control" + sql = query.static_query.sql + severity = "high" +} + +control "sample_control_4" { + title = "Sample control 4" + description = "A sample control that returns ERROR" + sql = query.static_query.sql + severity = "critical" +} + +control "sample_control_5" { + title = "Sample control 5" + description = "A sample control" + sql = query.static_query.sql + severity = "high" +} \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/functionality/plugin_crash.sp b/tests/acceptance/test_data/functionality_test_mod/functionality/plugin_crash.sp new file mode 100644 index 000000000..714d8998c --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/functionality/plugin_crash.sp @@ -0,0 +1,29 @@ +benchmark "check_plugin_crash_benchmark" { + title = "Benchmark to test the plugin crash bug while running controls" + children = [ + control.plugin_chaos_test_1, + control.plugin_crash_test, + control.plugin_chaos_test_2 + ] +} + +control "plugin_chaos_test_1" { + title = "Control to query a chaos table" + description = "Control to query a chaos table to test all flavours of integer and float data types" + sql = query.check_plugincrash_normalquery1.sql + severity = "high" +} + +control "plugin_crash_test" { + title = "Control to simulate a plugin crash" + description = "Control to query a chaos table that prints 50 rows and do an os.Exit(-1) to simulate a plugin crash" + sql = "select * from chaos_plugin_crash" + severity = "high" +} + +control "plugin_chaos_test_2" { + title = "Control to query a chaos table" + description = "Control to query a chaos table test the Get call with all the possible scenarios like errors, panics and delays" + sql = query.check_plugincrash_normalquery2.sql + severity = "high" +} \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/functionality/search_path.sp b/tests/acceptance/test_data/functionality_test_mod/functionality/search_path.sp new file mode 100644 index 000000000..5ff92d569 --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/functionality/search_path.sp @@ -0,0 +1,57 @@ +benchmark "check_search_path_benchmark" { + title = "Benchmark to test search path and search path prefix functionalities in steampipe check" + children = [ + control.search_path_test_1, + control.search_path_test_2, + control.search_path_test_3, + control.search_path_test_4, + control.search_path_test_5, + control.search_path_test_6 + ] +} + +control "search_path_test_1" { + title = "Control to test search path prefix functionality when entered through CLI" + description = "Control to test search path prefix functionality when entered through CLI." + sql = query.search_path_1.sql + severity = "high" +} + +control "search_path_test_2" { + title = "Control to test search path functionality when entered through CLI" + description = "Control to test search path functionality when entered through CLI." + sql = query.search_path_2.sql + severity = "high" +} + +control "search_path_test_3" { + title = "Control to test search path and prefix functionality when entered through CLI" + description = "Control to test search path and prefix functionality when entered through CLI." + sql = query.search_path_1.sql + severity = "high" +} + +control "search_path_test_4" { + title = "Control to test search path prefix functionality when entered through control" + description = "Control to test search path prefix functionality when entered through control." + sql = query.search_path_1.sql + search_path_prefix = "aws" + severity = "high" +} + +control "search_path_test_5" { + title = "Control to test search path functionality when entered through control" + description = "Control to test search path functionality when entered through control." + sql = query.search_path_2.sql + search_path = "chaos,b,c" + severity = "high" +} + +control "search_path_test_6" { + title = "Control to test search path and prefix functionality when entered through control" + description = "Control to test search path and prefix functionality when entered through control." + sql = query.search_path_1.sql + search_path_prefix = "aws" + search_path = "a,b,c" + severity = "high" +} \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/mod.sp b/tests/acceptance/test_data/functionality_test_mod/mod.sp new file mode 100644 index 000000000..cc01b0705 --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/mod.sp @@ -0,0 +1,4 @@ +mod "functionality_test_mod"{ + title = "Functionality test mod" + description = "This is a simple mod used for testing different steampipe features and funtionalities." +} \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/query/check_cache.sql b/tests/acceptance/test_data/functionality_test_mod/query/check_cache.sql new file mode 100644 index 000000000..df0eeaa58 --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/query/check_cache.sql @@ -0,0 +1,8 @@ +select + case + when mod(id,2)=0 then 'alarm' + when mod(id,2)=1 then 'ok' + end status, + time_now as resource, + id as reason +from chaos.chaos_cache_check where id=2 \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/query/check_plugincrash_normalquery1.sql b/tests/acceptance/test_data/functionality_test_mod/query/check_plugincrash_normalquery1.sql new file mode 100644 index 000000000..d5c1f257e --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/query/check_plugincrash_normalquery1.sql @@ -0,0 +1,8 @@ +select + case + when mod(id,2)=0 then 'alarm' + when mod(id,2)=1 then 'ok' + end status, + int8_data as resource, + int16_data as reason +from chaos_all_numeric_column \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/query/check_plugincrash_normalquery2.sql b/tests/acceptance/test_data/functionality_test_mod/query/check_plugincrash_normalquery2.sql new file mode 100644 index 000000000..c97e25983 --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/query/check_plugincrash_normalquery2.sql @@ -0,0 +1,8 @@ +select + case + when mod(id,2)=0 then 'alarm' + when mod(id,2)=1 then 'ok' + end status, + fatal_error as resource, + retryable_error as reason +from chaos_get_errors limit 10 \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/query/query_params.sp b/tests/acceptance/test_data/functionality_test_mod/query/query_params.sp new file mode 100644 index 000000000..ae097a39f --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/query/query_params.sp @@ -0,0 +1,56 @@ +query "query_params_with_all_defaults"{ + description = "query 1 - 3 params all with defaults" + sql = "select 'ok' as status, 'steampipe' as resource, concat($1::text, ' ', $2::text, ' ', $3::text) as reason" + param "p1"{ + description = "First parameter" + default = "default_parameter_1" + } + param "p2"{ + description = "Second parameter" + default = "default_parameter_2" + } + param "p3"{ + description = "Third parameter" + default = "default_parameter_3" + } +} + +query "query_params_with_no_defaults"{ + description = "query 1 - 3 params with no defaults" + sql = "select 'ok' as status, 'steampipe' as resource, concat($1::text, ' ', $2::text, ' ', $3::text) as reason" + param "p1"{ + description = "First parameter" + } + param "p2"{ + description = "Second parameter" + } + param "p3"{ + description = "Third parameter" + } +} + +query "query_array_params_with_default"{ + description = "query an array parameter with default" + sql = "select 'ok' as status, 'steampipe' as resource, $1::jsonb->1 as reason" + param "p1"{ + description = "Array parameter" + default = ["default_p1_element_01", "default_p1_element_02", "default_p1_element_03"] + } +} + +query "query_map_params_with_default"{ + description = "query a map parameter with default" + sql = "select 'ok' as status, 'steampipe' as resource, $1::json->'default_property_01' as reason" + param "p1"{ + description = "Map parameter" + default = {"default_property_01": "default_property_value_01", "default_property_02": "default_property_value_02"} + } +} + +query "query_map_params_with_no_default"{ + description = "query a map parameter with no default" + sql = "select 'ok' as status, 'steampipe' as resource, $1::json->'default_property_01' as reason" + param "p1"{ + description = "Map parameter" + } +} \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/query/search_path_1.sql b/tests/acceptance/test_data/functionality_test_mod/query/search_path_1.sql new file mode 100644 index 000000000..a5c725f56 --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/query/search_path_1.sql @@ -0,0 +1,11 @@ +WITH s_path AS (select setting from pg_settings where name='search_path') +SELECT s_path.setting as resource, +CASE + WHEN s_path.setting LIKE 'aws%' THEN 'ok' + ELSE 'alarm' +END as status, +CASE + WHEN s_path.setting LIKE 'aws%' THEN 'Starts with "aws"' + ELSE 'Does not start with "aws"' +END as reason +FROM s_path \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/query/search_path_2.sql b/tests/acceptance/test_data/functionality_test_mod/query/search_path_2.sql new file mode 100644 index 000000000..6d4b23087 --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/query/search_path_2.sql @@ -0,0 +1,11 @@ +WITH s_path AS (select setting from pg_settings where name='search_path') +SELECT s_path.setting as resource, +CASE + WHEN s_path.setting LIKE 'chaos, b, c%' THEN 'ok' + ELSE 'alarm' +END as status, +CASE + WHEN s_path.setting LIKE 'aws%' THEN 'Starts with "chaos, b, c"' + ELSE 'Does not start with "chaos, b, c"' +END as reason +FROM s_path \ No newline at end of file diff --git a/tests/acceptance/test_data/functionality_test_mod/query/static_query.sql b/tests/acceptance/test_data/functionality_test_mod/query/static_query.sql new file mode 100644 index 000000000..ac6e8f8a6 --- /dev/null +++ b/tests/acceptance/test_data/functionality_test_mod/query/static_query.sql @@ -0,0 +1,19 @@ +select + case + when num=1 then 'ok' + when mod(num,2)=0 then 'alarm' + when mod(num,3)=0 then 'ok' + when mod(num,5)=0 then 'error' + when mod(num,7)=0 then 'info' + when mod(num,11)=0 then 'skip' + end status, + 'steampipe' as resource, + case + when num=1 then 'ok' + when mod(num,2)=0 then 'alarm' + when mod(num,3)=0 then 'ok' + when mod(num,5)=0 then 'error' + when mod(num,7)=0 then 'info' + when mod(num,11)=0 then 'skip' + end reason +from generate_series(1, 12) num \ No newline at end of file diff --git a/tests/acceptance/test_data/introspection_table_mod/mod.sp b/tests/acceptance/test_data/introspection_table_mod/mod.sp index 400333c22..1531a2c63 100644 --- a/tests/acceptance/test_data/introspection_table_mod/mod.sp +++ b/tests/acceptance/test_data/introspection_table_mod/mod.sp @@ -1,4 +1,4 @@ mod "introspection_table_mod"{ title = "Introspection table test mod" - description = "This is a simple mod used for testing the introspection table features" + description = "This is a simple mod used for testing the introspection table features. Do not expand this mod." } \ No newline at end of file diff --git a/tests/acceptance/test_files/009.check-search-path.bats b/tests/acceptance/test_files/009.check-search-path.bats index 8987f0afe..c723dce11 100644 --- a/tests/acceptance/test_files/009.check-search-path.bats +++ b/tests/acceptance/test_files/009.check-search-path.bats @@ -2,42 +2,42 @@ load "$LIB_BATS_ASSERT/load.bash" load "$LIB_BATS_SUPPORT/load.bash" @test "steampipe check search_path_prefix when passed through command line" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.search_path_test_1 --output json --search-path-prefix aws --export output.json assert_equal "$(cat output.json | jq '.controls[0].results[0].status')" '"ok"' rm -f output.json } @test "steampipe check search_path when passed through command line" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.search_path_test_2 --output json --search-path chaos,b,c --export output.json assert_equal "$(cat output.json | jq '.controls[0].results[0].status')" '"ok"' rm -f output.json } @test "steampipe check search_path and search_path_prefix when passed through command line" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.search_path_test_3 --output json --search-path chaos,b,c --search-path-prefix aws --export output.json assert_equal "$(cat output.json | jq '.controls[0].results[0].status')" '"ok"' rm -f output.json } @test "steampipe check search_path_prefix when passed in the control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.search_path_test_4 --output json --export output.json assert_equal "$(cat output.json | jq '.controls[0].results[0].status')" '"ok"' rm -f output.json } @test "steampipe check search_path when passed in the control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.search_path_test_5 --output json --export output.json assert_equal "$(cat output.json | jq '.controls[0].results[0].status')" '"ok"' rm -f output.json } @test "steampipe check search_path and search_path_prefix when passed in the control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.search_path_test_6 --output json --export output.json assert_equal "$(cat output.json | jq '.controls[0].results[0].status')" '"ok"' rm -f output.json diff --git a/tests/acceptance/test_files/011.check-plugin-crash.bats b/tests/acceptance/test_files/011.check-plugin-crash.bats index ada12928c..7cad9d169 100644 --- a/tests/acceptance/test_files/011.check-plugin-crash.bats +++ b/tests/acceptance/test_files/011.check-plugin-crash.bats @@ -2,7 +2,7 @@ load "$LIB_BATS_ASSERT/load.bash" load "$LIB_BATS_SUPPORT/load.bash" @test "check whether the plugin is crashing or not" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check benchmark.check_plugin_crash_benchmark echo $output [ $(echo $output | grep "ERROR: context canceled" | wc -l | tr -d ' ') -eq 0 ] diff --git a/tests/acceptance/test_files/012.cache.bats b/tests/acceptance/test_files/012.cache.bats index 7c1f776d8..832580249 100644 --- a/tests/acceptance/test_files/012.cache.bats +++ b/tests/acceptance/test_files/012.cache.bats @@ -3,7 +3,7 @@ load "$LIB_BATS_SUPPORT/load.bash" @test "steampipe cache functionality check ON" { run steampipe plugin install chaos - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check benchmark.check_cache_benchmark --export=output.json @@ -21,7 +21,7 @@ load "$LIB_BATS_SUPPORT/load.bash" @test "steampipe cache functionality check OFF" { run steampipe plugin install chaos - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD # set the env variable to false export STEAMPIPE_CACHE=false diff --git a/tests/acceptance/test_files/013.query-params.bats b/tests/acceptance/test_files/013.query-params.bats index 608acd320..25f2b04b3 100644 --- a/tests/acceptance/test_files/013.query-params.bats +++ b/tests/acceptance/test_files/013.query-params.bats @@ -4,7 +4,7 @@ load "$LIB_BATS_SUPPORT/load.bash" ############### QUERIES ############### @test "query with default params and no params passed through CLI" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe query query.query_params_with_all_defaults --output json # store the reason field in `content` @@ -14,7 +14,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "query with default params and some positional params passed through CLI" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe query "query.query_params_with_all_defaults(\"command_param_1\")" --output json # store the reason field in `content` @@ -24,7 +24,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "query with default params and some named params passed through CLI" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe query "query.query_params_with_all_defaults(p1 => \"command_param_1\")" --output json # store the reason field in `content` @@ -34,7 +34,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "query with no default params and no params passed through CLI" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe query query.query_params_with_no_defaults --output json # should return an error `failed to resolve value for 3 parameters` @@ -42,7 +42,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "query with no default params and all params passed through CLI" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe query "query.query_params_with_all_defaults(\"command_param_1\",\"command_param_2\",\"command_param_3\")" --output json # store the reason field in `content` @@ -52,7 +52,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "query specific array index from param - DISABLED" { - # cd $WORKSPACE_DIR + # cd $FUNCTIONALITY_TEST_MOD # run steampipe query query.query_array_params_with_default --output json # # store the reason field in `content` @@ -62,7 +62,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "query specific property from map param" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe query query.query_map_params_with_default --output json # store the reason field in `content` @@ -72,7 +72,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "query with invalid param syntax" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe query "query.query_map_params_with_default(\"foo \")" --output json # should return an error `invalid input syntax for type json` @@ -82,7 +82,7 @@ load "$LIB_BATS_SUPPORT/load.bash" ############### CONTROLS ############### @test "control with default params and no args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_params_with_defaults_and_no_args --export=output.json # store the reason field in `content` @@ -93,7 +93,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with default params and partial named args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_params_with_defaults_and_partial_named_args --export=output.json # store the reason field in `content` @@ -104,7 +104,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with default params and partial positional args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_params_with_defaults_and_partial_positional_args --export=output.json # store the reason field in `content` @@ -115,7 +115,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with default params and all named args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_params_with_defaults_and_all_named_args --export=output.json # store the reason field in `content` @@ -126,7 +126,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with default params and all positional args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_params_with_defaults_and_all_positional_args --export=output.json # store the reason field in `content` @@ -137,7 +137,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with no default params and no args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_params_with_no_defaults_and_no_args --output json # should return an error `failed to resolve value for 3 parameters` @@ -146,7 +146,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with no default params and all args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_params_with_no_defaults_with_named_args --export=output.json # store the reason field in `content` @@ -157,7 +157,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control to access specific array index from param - DISABLED" { - # cd $WORKSPACE_DIR + # cd $FUNCTIONALITY_TEST_MOD # run steampipe check control.query_params_array_with_default --export=output.json # # store the reason field in `content` @@ -168,7 +168,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control to access specific property from map" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_params_map_with_default --export=output.json # store the reason field in `content` @@ -179,7 +179,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with invaild args syntax passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_params_invalid_arg_syntax --output json # store the results field in `content` @@ -190,7 +190,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with inline sql with partial named args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_inline_sql_from_control_with_partial_named_args --export=output.json # store the reason field in `content` @@ -201,7 +201,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with inline sql with partial positional args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_inline_sql_from_control_with_partial_positional_args --export=output.json # store the reason field in `content` @@ -212,7 +212,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with inline sql with no args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_inline_sql_from_control_with_no_args --export=output.json # store the reason field in `content` @@ -223,7 +223,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with inline sql with all named args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_inline_sql_from_control_with_all_named_args --export=output.json # store the reason field in `content` @@ -234,7 +234,7 @@ load "$LIB_BATS_SUPPORT/load.bash" } @test "control with inline sql with all positional args passed in control" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check control.query_inline_sql_from_control_with_all_positional_args --export=output.json # store the reason field in `content` diff --git a/tests/acceptance/test_files/017.check-summary.bats b/tests/acceptance/test_files/017.check-summary.bats index dfd2ce889..7c10498aa 100644 --- a/tests/acceptance/test_files/017.check-summary.bats +++ b/tests/acceptance/test_files/017.check-summary.bats @@ -3,7 +3,7 @@ load "$LIB_BATS_SUPPORT/load.bash" # testing the check summary output feature in steampipe @test "check summary output" { - cd $WORKSPACE_DIR + cd $FUNCTIONALITY_TEST_MOD run steampipe check benchmark.control_summary_benchmark --theme plain echo $output