github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/tests/acceptance/test_files/mod_require.bats (about) 1 load "$LIB_BATS_ASSERT/load.bash" 2 load "$LIB_BATS_SUPPORT/load.bash" 3 4 ### require tests ### 5 6 @test "running steampipe query with mod plugin requirement not met" { 7 cd $FILE_PATH/test_data/mods/bad_mod_with_plugin_require_not_met 8 9 run steampipe query "select 1" 10 assert_output --partial 'Warning: could not find plugin which satisfies requirement' 11 cd - 12 } 13 14 @test "running steampipe check with mod plugin requirement not met" { 15 cd $FILE_PATH/test_data/mods/bad_mod_with_plugin_require_not_met 16 17 run steampipe check all 18 assert_output --partial 'Warning: could not find plugin which satisfies requirement' 19 cd - 20 } 21 22 @test "running steampipe dashboard with mod plugin requirement not met" { 23 cd $FILE_PATH/test_data/mods/bad_mod_with_plugin_require_not_met 24 25 run steampipe dashboard dashboard.sample_dashboard 26 assert_output --partial "Warning: could not find plugin which satisfies requirement 'gcp@99.21.0' - required by 'bad_mod_with_require_not_met'" 27 cd - 28 } 29 30 @test "running steampipe query with steampipe CLI version requirement not met" { 31 cd $FILE_PATH/test_data/mods/bad_mod_with_sp_version_require_not_met 32 33 run steampipe query "select 1" 34 assert_output --partial 'does not satisfy mod.bad_mod_with_sp_version_require_not_met which requires version 10.99.99' 35 cd - 36 } 37 38 @test "running steampipe check with steampipe CLI version requirement not met" { 39 cd $FILE_PATH/test_data/mods/bad_mod_with_sp_version_require_not_met 40 41 run steampipe check all 42 assert_output --partial 'does not satisfy mod.bad_mod_with_sp_version_require_not_met which requires version 10.99.99' 43 cd - 44 } 45 46 @test "running steampipe dashboard with steampipe CLI version requirement not met" { 47 cd $FILE_PATH/test_data/mods/bad_mod_with_sp_version_require_not_met 48 49 run steampipe dashboard dashboard.sample_dashboard 50 assert_output --partial 'does not satisfy mod.bad_mod_with_sp_version_require_not_met which requires version 10.99.99' 51 cd - 52 } 53 54 @test "running steampipe query with dependant mod version requirement not met(not installed)" { 55 cd $FILE_PATH/test_data/mods/bad_mod_with_dep_mod_version_require_not_met 56 57 run steampipe query "select 1" 58 assert_output --partial 'Error: failed to load workspace: not all dependencies are installed' 59 60 run steampipe mod install 61 assert_output --partial 'Error: 1 dependency failed to install - no version of github.com/turbot/steampipe-mod-aws-compliance found satisfying version constraint: 99.21.0' 62 cd - 63 } 64 65 @test "running steampipe check with dependant mod version requirement not met(not installed)" { 66 cd $FILE_PATH/test_data/mods/bad_mod_with_dep_mod_version_require_not_met 67 68 run steampipe check all 69 assert_output --partial 'Error: failed to load workspace: not all dependencies are installed' 70 71 run steampipe mod install 72 assert_output --partial 'Error: 1 dependency failed to install - no version of github.com/turbot/steampipe-mod-aws-compliance found satisfying version constraint: 99.21.0' 73 cd - 74 } 75 76 @test "running steampipe dashboard with dependant mod version requirement not met(not installed)" { 77 cd $FILE_PATH/test_data/mods/bad_mod_with_dep_mod_version_require_not_met 78 79 run steampipe dashboard dashboard.sample_dashboard 80 assert_output --partial 'Error: failed to load workspace: not all dependencies are installed' 81 82 run steampipe mod install 83 assert_output --partial 'Error: 1 dependency failed to install - no version of github.com/turbot/steampipe-mod-aws-compliance found satisfying version constraint: 99.21.0' 84 cd - 85 } 86 87 ### deprecation tests ### 88 89 @test "old steampipe property" { 90 # go to the mod directory and run steampipe to get the deprectaion warning 91 # or error, and check the output 92 cd $FILE_PATH/test_data/mods/mod_with_old_steampipe_in_require 93 run steampipe query "select 1" 94 95 assert_output --partial "Warning: Property 'steampipe' is deprecated for mod require block - use a steampipe block instead" 96 } 97 98 @test "new steampipe block with old steampipe property" { 99 # go to the mod directory and run steampipe to get the deprectaion warning 100 # or error, and check the output 101 cd $FILE_PATH/test_data/mods/mod_with_old_steampipe_and_new_steampipe_block_in_require 102 run steampipe query "select 1" 103 104 assert_output --partial "Both 'steampipe' block and deprecated 'steampipe' property are set" 105 } 106 107 @test "new steampipe block with min_version" { 108 # go to the mod directory and run steampipe to get the deprectaion warning 109 # or error, and check the output 110 cd $FILE_PATH/test_data/mods/mod_with_new_steampipe_block 111 run steampipe query "select 1" 112 113 assert_output --partial "1" 114 } 115 116 @test "legacy 'requires' block" { 117 # go to the mod directory and run steampipe to get the deprectaion warning 118 # or error, and check the output 119 cd $FILE_PATH/test_data/mods/mod_with_legacy_requires_block 120 run steampipe query "select 1" 121 122 # TODO: update this test when the deprecation warning for legacy 'requries' 123 # block is added 124 assert_output --partial "1" 125 } 126 127 function teardown_file() { 128 # list running processes 129 ps -ef | grep steampipe 130 131 # check if any processes are running 132 num=$(ps aux | grep steampipe | grep -v bats | grep -v grep | grep -v tests/acceptance | wc -l | tr -d ' ') 133 assert_equal $num 0 134 }