mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-19 18:12:43 -05:00
update and re-enable snapshot tests
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
status,resource,reason
|
||||
ok,1,ok
|
||||
alarm,2,alarm
|
||||
|
||||
|
@@ -1,62 +1,80 @@
|
||||
[
|
||||
{
|
||||
"reason": "ok",
|
||||
"resource": 1,
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 2,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "ok",
|
||||
"resource": 3,
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 4,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "error",
|
||||
"resource": 5,
|
||||
"status": "error"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 6,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "info",
|
||||
"resource": 7,
|
||||
"status": "info"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 8,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "ok",
|
||||
"resource": 9,
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 10,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "skip",
|
||||
"resource": 11,
|
||||
"status": "skip"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 12,
|
||||
"status": "alarm"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
{
|
||||
"columns": [
|
||||
{
|
||||
"name": "status",
|
||||
"data_type": "text"
|
||||
},
|
||||
{
|
||||
"name": "resource",
|
||||
"data_type": "int4"
|
||||
},
|
||||
{
|
||||
"name": "reason",
|
||||
"data_type": "text"
|
||||
}
|
||||
],
|
||||
"rows": [
|
||||
{
|
||||
"reason": "ok",
|
||||
"resource": 1,
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 2,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "ok",
|
||||
"resource": 3,
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 4,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "error",
|
||||
"resource": 5,
|
||||
"status": "error"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 6,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "info",
|
||||
"resource": 7,
|
||||
"status": "info"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 8,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "ok",
|
||||
"resource": 9,
|
||||
"status": "ok"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 10,
|
||||
"status": "alarm"
|
||||
},
|
||||
{
|
||||
"reason": "skip",
|
||||
"resource": 11,
|
||||
"status": "skip"
|
||||
},
|
||||
{
|
||||
"reason": "alarm",
|
||||
"resource": 12,
|
||||
"status": "alarm"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
+--------+----------+--------+
|
||||
| status | resource | reason |
|
||||
+--------+----------+--------+
|
||||
|
||||
@@ -15,10 +15,8 @@ function setup() {
|
||||
# Related to https://github.com/turbot/steampipe/issues/3112
|
||||
|
||||
@test "snapshot mode - query output csv" {
|
||||
skip "TODO with querying sql file instead of named query"
|
||||
cd $FILE_PATH/test_data/mods/functionality_test_mod
|
||||
|
||||
steampipe query query.static_query_2 --snapshot --output csv --pipes-token $SPIPETOOLS_TOKEN --snapshot-location turbot-ops/clitesting > output.csv
|
||||
steampipe query $FILE_PATH/test_data/mods/functionality_test_mod/query/static_query_2.sql --snapshot --output csv --pipes-token $SPIPETOOLS_TOKEN --snapshot-location turbot-ops/clitesting > output.csv
|
||||
|
||||
# extract the snapshot url from the output
|
||||
url=$(grep -o 'http[^"]*' output.csv)
|
||||
@@ -27,9 +25,9 @@ function setup() {
|
||||
# checking for OS type, since sed command is different for linux and OSX
|
||||
# removing the 15th line, since it contains snapshot upload link, which will be different in each run
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
run sed -i ".csv" "15d" output.csv
|
||||
run sed -i ".csv" "2d" output.csv
|
||||
else
|
||||
run sed -i "15d" output.csv
|
||||
run sed -i "2d" output.csv
|
||||
fi
|
||||
cat output.csv
|
||||
|
||||
@@ -45,10 +43,8 @@ function setup() {
|
||||
}
|
||||
|
||||
@test "snapshot mode - query output json" {
|
||||
skip "TODO with querying sql file instead of named query"
|
||||
cd $FILE_PATH/test_data/mods/functionality_test_mod
|
||||
|
||||
steampipe query query.static_query_2 --snapshot --output json --pipes-token $SPIPETOOLS_TOKEN --snapshot-location turbot-ops/clitesting > output.json
|
||||
skip
|
||||
steampipe query $FILE_PATH/test_data/mods/functionality_test_mod/query/static_query_2.sql --snapshot --output json --pipes-token $SPIPETOOLS_TOKEN --snapshot-location turbot-ops/clitesting > output.json
|
||||
|
||||
# extract the snapshot url from the output
|
||||
url=$(grep -o 'http[^"]*' output.json)
|
||||
@@ -57,9 +53,9 @@ function setup() {
|
||||
# checking for OS type, since sed command is different for linux and OSX
|
||||
# removing the 64th line, since it contains snapshot upload link, which will be different in each run
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
run sed -i ".csv" "64d" output.json
|
||||
run sed -i ".csv" "2d" output.json
|
||||
else
|
||||
run sed -i "64d" output.json
|
||||
run sed -i "2d" output.json
|
||||
fi
|
||||
cat output.json
|
||||
|
||||
@@ -75,10 +71,8 @@ function setup() {
|
||||
}
|
||||
|
||||
@test "snapshot mode - query output table" {
|
||||
skip "TODO with querying sql file instead of named query"
|
||||
cd $FILE_PATH/test_data/mods/functionality_test_mod
|
||||
|
||||
steampipe query query.static_query_2 --snapshot --output table --pipes-token $SPIPETOOLS_TOKEN --snapshot-location turbot-ops/clitesting > output.txt
|
||||
steampipe query $FILE_PATH/test_data/mods/functionality_test_mod/query/static_query_2.sql --snapshot --output table --pipes-token $SPIPETOOLS_TOKEN --snapshot-location turbot-ops/clitesting > output.txt
|
||||
|
||||
# extract the snapshot url from the output
|
||||
url=$(grep -o 'http[^"]*' output.txt)
|
||||
@@ -87,9 +81,9 @@ function setup() {
|
||||
# checking for OS type, since sed command is different for linux and OSX
|
||||
# removing the 18th line, since it contains snapshot upload link, which will be different in each run
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
run sed -i ".csv" "18d" output.txt
|
||||
run sed -i ".csv" "2d" output.txt
|
||||
else
|
||||
run sed -i "18d" output.txt
|
||||
run sed -i "2d" output.txt
|
||||
fi
|
||||
cat output.txt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user