github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/tests/acceptance/test_files/dynamic_aggregators.bats (about)

     1  load "$LIB_BATS_ASSERT/load.bash"
     2  load "$LIB_BATS_SUPPORT/load.bash"
     3  
     4  # all tests are skipped - https://github.com/turbot/steampipe/issues/3742
     5  
     6  # Aggregating two connections with same table and same columns defined.
     7  @test "dynamic aggregator - same table and columns" {
     8    skip "currently does not pass due to bug - https://github.com/turbot/steampipe/issues/3743"
     9    cp $SRC_DATA_DIR/dynamic_aggregator_tests/dynamic_aggregator_same_table_cols.spc $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_same_table_cols.spc
    10  
    11    steampipe query "select c1,c2 from dyn_agg.t1 order by c1" --output json > output.json
    12    run jd "$TEST_DATA_DIR/dynamic_aggregators_same_tables_cols_result.json" output.json
    13    echo $output
    14    assert_success
    15    rm -f output.json
    16    rm -f $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_same_table_cols.spc
    17  }
    18  
    19  # Aggregating two connections with different tables defined.
    20  # Connection `con1` defines a table `t1` whereas connection `con2` defines table `t2`.
    21  @test "dynamic aggregator - table mismatch" {
    22    skip "currently does not pass due to bug - https://github.com/turbot/steampipe/issues/3743"
    23    cp $SRC_DATA_DIR/dynamic_aggregator_tests/dynamic_aggregator_table_mismatch.spc $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_table_mismatch.spc
    24  
    25    steampipe query "select c1,c2 from dyn_agg.t1 order by c1" --output json > output.json
    26    run jd "$TEST_DATA_DIR/dynamic_aggregators_table_mismatch_t1.json" output.json
    27    echo $output
    28    assert_success
    29    rm -f output.json
    30  
    31    steampipe query "select c1,c2 from dyn_agg.t2 order by c1" --output json > output.json
    32    run jd "$TEST_DATA_DIR/dynamic_aggregators_table_mismatch_t2.json" output.json
    33    echo $output
    34    assert_success
    35    rm -f output.json
    36    rm -f $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_table_mismatch.spc
    37  }
    38  
    39  # Aggregating two connections with same tables defined, but mismatching columns.
    40  # Connection `con1` defines a table `t1` which has columns `c1` and `c2`, whereas connection `con2` also has a table `t1`
    41  # but has columns `c1` and `c3`.
    42  @test "dynamic aggregator - column mismatch" {
    43    skip "currently does not pass due to bug - https://github.com/turbot/steampipe/issues/3743"
    44    cp $SRC_DATA_DIR/dynamic_aggregator_tests/dynamic_aggregator_col_mismatch.spc $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_mismatch.spc
    45  
    46    steampipe query "select c1,c2,c3 from dyn_agg.t1 order by c1,c2,c3" --output json > output.json
    47    run jd "$TEST_DATA_DIR/dynamic_aggregators_col_mismatch.json" output.json
    48    echo $output
    49    assert_success
    50    rm -f output.json
    51    rm -f $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_mismatch.spc
    52  }
    53  
    54  # Aggregating two connections with same tables defined, but mismatching type of columns.
    55  # Connection `con1` defines a table `t1` which has columns `c1(string)` and `c2(string)`, whereas connection `con2` also has a table `t1`
    56  # but has columns `c1(string)` and `c2(int)`.
    57  @test "dynamic aggregator - column type mismatch(string and int)" {
    58    skip "currently does not pass due to bug - https://github.com/turbot/steampipe/issues/3743"
    59    cp $SRC_DATA_DIR/dynamic_aggregator_tests/dynamic_aggregator_col_type_mismatch.spc $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_type_mismatch.spc
    60  
    61    steampipe query "select c1, c2 from dyn_agg.t1 order by c2" --output json > output.json
    62    run jd "$TEST_DATA_DIR/dynamic_aggregators_col_type_mismatch.json" output.json
    63    echo $output
    64    assert_success
    65    rm -f output.json
    66    rm -f $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_type_mismatch.spc
    67  }
    68  
    69  # Aggregating two connections with same tables defined, but mismatching type of columns.
    70  # Connection `con1` defines a table `t1` which has columns `c1(string)` and `c2(string)`, whereas connection `con2` also has a table `t1`
    71  # but has columns `c1(string)` and `c2(double)`.
    72  @test "dynamic aggregator - column type mismatch(string and double)" {
    73    skip "currently does not pass due to bug - https://github.com/turbot/steampipe/issues/3743"
    74    cp $SRC_DATA_DIR/dynamic_aggregator_tests/dynamic_aggregator_col_type_mismatch_2.spc $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_type_mismatch_2.spc
    75  
    76    steampipe query "select c1, c2 from dyn_agg.t1 order by c2" --output json > output.json
    77    run jd "$TEST_DATA_DIR/dynamic_aggregators_col_type_mismatch_2.json" output.json
    78    echo $output
    79    assert_success
    80    rm -f output.json
    81    rm -f $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_type_mismatch_2.spc
    82  }
    83  
    84  # Aggregating two connections with same tables defined, but mismatching type of columns.
    85  # Connection `con1` defines a table `t1` which has columns `c1(string)` and `c2(string)`, whereas connection `con2` also has a table `t1`
    86  # but has columns `c1(string)` and `c2(bool)`.
    87  @test "dynamic aggregator - column type mismatch(string and bool)" {
    88    skip "currently does not pass due to bug - https://github.com/turbot/steampipe/issues/3743"
    89    cp $SRC_DATA_DIR/dynamic_aggregator_tests/dynamic_aggregator_col_type_mismatch_3.spc $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_type_mismatch_3.spc
    90  
    91    steampipe query "select c1, c2 from dyn_agg.t1 order by c2" --output json > output.json
    92    run jd "$TEST_DATA_DIR/dynamic_aggregators_col_type_mismatch_3.json" output.json
    93    echo $output
    94    assert_success
    95    rm -f output.json
    96    rm -f $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_type_mismatch_3.spc
    97  }
    98  
    99  # Aggregating two connections with same tables defined, but mismatching type of columns.
   100  # Connection `con1` defines a table `t1` which has columns `c1(string)` and `c2(string)`, whereas connection `con2` also has a table `t1`
   101  # but has columns `c1(string)` and `c2(ipaddr)`.
   102  @test "dynamic aggregator - column type mismatch(string and ipaddr)" {
   103    skip "currently does not pass due to bug - https://github.com/turbot/steampipe/issues/3743"
   104    cp $SRC_DATA_DIR/dynamic_aggregator_tests/dynamic_aggregator_col_type_mismatch_4.spc $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_type_mismatch_4.spc
   105  
   106    run steampipe query "select c1, c2 from dyn_agg.t1 order by c1,c2" --output json
   107    run jd "$TEST_DATA_DIR/dynamic_aggregators_col_type_mismatch_4.json" output.json
   108    echo $output
   109    assert_success
   110    rm -f output.json
   111    rm -f $STEAMPIPE_INSTALL_DIR/config/dynamic_aggregator_col_type_mismatch_4.spc
   112  }
   113  
   114  function setup_file() {
   115    export STEAMPIPE_SYNC_REFRESH=true
   116  }
   117  
   118  function teardown_file() {
   119    # list running processes
   120    ps -ef | grep steampipe
   121  
   122    # check if any processes are running
   123    num=$(ps aux | grep steampipe | grep -v bats | grep -v grep | grep -v tests/acceptance | wc -l | tr -d ' ')
   124    assert_equal $num 0
   125  }