update and enable config precedence tests

This commit is contained in:
Puskar Basu
2024-10-15 15:18:09 +05:30
parent abf5796ab0
commit ad1259f888
11 changed files with 40 additions and 116 deletions

4
go.mod
View File

@@ -44,8 +44,8 @@ require (
github.com/spf13/viper v1.19.0 github.com/spf13/viper v1.19.0
github.com/thediveo/enumflag/v2 v2.0.5 github.com/thediveo/enumflag/v2 v2.0.5
github.com/turbot/go-kit v0.10.0-rc.0 github.com/turbot/go-kit v0.10.0-rc.0
// v1.6.x ec08115 (Update SteampipeWorkspaceProfile to warn for removed args in workspace instead or erroring...) // v1.6.x 11f7dce (Update SteampipeWorkspaceProfile to warn for removed args in workspace instead or erroring...)
github.com/turbot/pipe-fittings v1.6.0-beta.1.0.20241008150745-ec081153b1b3 github.com/turbot/pipe-fittings v1.6.0-beta.1.0.20241011155452-11f7dcedff30
github.com/turbot/steampipe-cloud-sdk-go v0.6.0 github.com/turbot/steampipe-cloud-sdk-go v0.6.0
// branch: workspace_profiles // branch: workspace_profiles
github.com/turbot/steampipe-plugin-sdk/v5 v5.11.0-rc.1 github.com/turbot/steampipe-plugin-sdk/v5 v5.11.0-rc.1

4
go.sum
View File

@@ -774,8 +774,8 @@ github.com/turbot/go-kit v0.10.0-rc.0 h1:kd+jp2ibbIV33Hc8SsMAN410Dl9Pz6SJ40axbKU
github.com/turbot/go-kit v0.10.0-rc.0/go.mod h1:fFQqR59I5z5JeeBLfK1PjSifn4Oprs3NiQx0CxeSJxs= github.com/turbot/go-kit v0.10.0-rc.0/go.mod h1:fFQqR59I5z5JeeBLfK1PjSifn4Oprs3NiQx0CxeSJxs=
github.com/turbot/go-prompt v0.2.6-steampipe.0.0.20221028122246-eb118ec58d50 h1:zs87uA6QZsYLk4RRxDOIxt8ro/B2V6HzoMWm05Lo7ao= github.com/turbot/go-prompt v0.2.6-steampipe.0.0.20221028122246-eb118ec58d50 h1:zs87uA6QZsYLk4RRxDOIxt8ro/B2V6HzoMWm05Lo7ao=
github.com/turbot/go-prompt v0.2.6-steampipe.0.0.20221028122246-eb118ec58d50/go.mod h1:vFnjEGDIIA/Lib7giyE4E9c50Lvl8j0S+7FVlAwDAVw= github.com/turbot/go-prompt v0.2.6-steampipe.0.0.20221028122246-eb118ec58d50/go.mod h1:vFnjEGDIIA/Lib7giyE4E9c50Lvl8j0S+7FVlAwDAVw=
github.com/turbot/pipe-fittings v1.6.0-beta.1.0.20241008150745-ec081153b1b3 h1:Ws96Wk9uDEqqVSWe+lw8IfSCvbZJ/wTuvxMHlFC8FB8= github.com/turbot/pipe-fittings v1.6.0-beta.1.0.20241011155452-11f7dcedff30 h1:OnGIXpnB08vYcjVNNsGgiLy54fKgDp1DFNLheTGdIXg=
github.com/turbot/pipe-fittings v1.6.0-beta.1.0.20241008150745-ec081153b1b3/go.mod h1:bBriS3DBSCvv6aJsHu5UZviRDHEMrNrfMvMsK8K5hc8= github.com/turbot/pipe-fittings v1.6.0-beta.1.0.20241011155452-11f7dcedff30/go.mod h1:bBriS3DBSCvv6aJsHu5UZviRDHEMrNrfMvMsK8K5hc8=
github.com/turbot/pipes-sdk-go v0.9.1 h1:2yRojY2wymvJn6NQyE6A0EDFV267MNe+yDLxPVvsBwM= github.com/turbot/pipes-sdk-go v0.9.1 h1:2yRojY2wymvJn6NQyE6A0EDFV267MNe+yDLxPVvsBwM=
github.com/turbot/pipes-sdk-go v0.9.1/go.mod h1:Mb+KhvqqEdRbz/6TSZc2QWDrMa5BN3E4Xw+gPt2TRkc= github.com/turbot/pipes-sdk-go v0.9.1/go.mod h1:Mb+KhvqqEdRbz/6TSZc2QWDrMa5BN3E4Xw+gPt2TRkc=
github.com/turbot/steampipe-cloud-sdk-go v0.6.0 h1:ufAxOpKS1uq7eejuE5sfEu1+d7QAd0RBjl8Bn6+mIs8= github.com/turbot/steampipe-cloud-sdk-go v0.6.0 h1:ufAxOpKS1uq7eejuE5sfEu1+d7QAd0RBjl8Bn6+mIs8=

View File

@@ -1,10 +0,0 @@
package constants
//
// metaquery mode arguments
var ArgOutput = ArgFromMetaquery(CmdOutput)
var ArgSeparator = ArgFromMetaquery(CmdSeparator)
var ArgHeader = ArgFromMetaquery(CmdHeaders)
var ArgMultiLine = ArgFromMetaquery(CmdMulti)
var ArgAutoComplete = ArgFromMetaquery(CmdAutoComplete)

View File

@@ -1,7 +1,5 @@
package constants package constants
import "fmt"
// Metaquery commands // Metaquery commands
const ( const (
@@ -23,11 +21,3 @@ const (
CmdCacheTtl = ".cache_ttl" // set cache ttl CmdCacheTtl = ".cache_ttl" // set cache ttl
CmdAutoComplete = ".autocomplete" // enable or disable auto complete CmdAutoComplete = ".autocomplete" // enable or disable auto complete
) )
// ArgFromMetaquery converts a metaquery of form '.header' into the config argument used to set the mode, i.e. 'header'
func ArgFromMetaquery(cmd string) string {
if cmd[:1] != "." {
panic(fmt.Sprintf("ArgFromMetaquery called for non-metyaquery: %s", cmd))
}
return cmd[1:]
}

View File

@@ -56,7 +56,7 @@ func init() {
constants.CmdHeaders: { constants.CmdHeaders: {
title: "headers", title: "headers",
handler: setHeader, handler: setHeader,
validator: booleanValidator(constants.CmdHeaders, validatorFromArgsOf(constants.CmdHeaders)), validator: booleanValidator(constants.CmdHeaders, pconstants.ArgHeader, validatorFromArgsOf(constants.CmdHeaders)),
description: "Enable or disable column headers", description: "Enable or disable column headers",
args: []metaQueryArg{ args: []metaQueryArg{
{value: pconstants.ArgOn, description: "Turn on headers in output"}, {value: pconstants.ArgOn, description: "Turn on headers in output"},
@@ -67,7 +67,7 @@ func init() {
constants.CmdMulti: { constants.CmdMulti: {
title: "multi-line", title: "multi-line",
handler: setMultiLine, handler: setMultiLine,
validator: booleanValidator(constants.CmdMulti, validatorFromArgsOf(constants.CmdMulti)), validator: booleanValidator(constants.CmdMulti, pconstants.ArgMultiLine, validatorFromArgsOf(constants.CmdMulti)),
description: "Enable or disable multiline mode", description: "Enable or disable multiline mode",
args: []metaQueryArg{ args: []metaQueryArg{
{value: pconstants.ArgOn, description: "Turn on multiline mode"}, {value: pconstants.ArgOn, description: "Turn on multiline mode"},
@@ -155,7 +155,7 @@ func init() {
constants.CmdAutoComplete: { constants.CmdAutoComplete: {
title: "auto-complete", title: "auto-complete",
handler: setAutoComplete, handler: setAutoComplete,
validator: booleanValidator(constants.CmdAutoComplete, validatorFromArgsOf(constants.CmdAutoComplete)), validator: booleanValidator(constants.CmdAutoComplete, pconstants.ArgAutoComplete, validatorFromArgsOf(constants.CmdAutoComplete)),
description: "Enable or disable auto-completion", description: "Enable or disable auto-completion",
args: []metaQueryArg{ args: []metaQueryArg{
{value: pconstants.ArgOn, description: "Turn on auto-completion"}, {value: pconstants.ArgOn, description: "Turn on auto-completion"},

View File

@@ -8,7 +8,6 @@ import (
pconstants "github.com/turbot/pipe-fittings/constants" pconstants "github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/utils" "github.com/turbot/pipe-fittings/utils"
"github.com/turbot/steampipe/pkg/cmdconfig" "github.com/turbot/steampipe/pkg/cmdconfig"
"github.com/turbot/steampipe/pkg/constants"
"golang.org/x/text/cases" "golang.org/x/text/cases"
"golang.org/x/text/language" "golang.org/x/text/language"
) )
@@ -46,7 +45,7 @@ func titleSentenceCase(title string) string {
return strings.Join(titleSegments, "-") return strings.Join(titleSegments, "-")
} }
func booleanValidator(metaquery string, validators ...validator) validator { func booleanValidator(metaquery, arg string, validators ...validator) validator {
return func(args []string) ValidationResult { return func(args []string) ValidationResult {
// Error: argument required multi-line mode is off. You can enable it with: .multi on // Error: argument required multi-line mode is off. You can enable it with: .multi on
// headers mode is off. You can enable it with: .headers on // headers mode is off. You can enable it with: .headers on
@@ -57,7 +56,7 @@ func booleanValidator(metaquery string, validators ...validator) validator {
if numArgs == 0 { if numArgs == 0 {
// get the current status of this mode (convert metaquery name into arg name) // get the current status of this mode (convert metaquery name into arg name)
// NOTE - request second arg from cast even though we donl;t use it - to avoid panic // NOTE - request second arg from cast even though we donl;t use it - to avoid panic
currentStatus := cmdconfig.Viper().GetBool(constants.ArgFromMetaquery(metaquery)) currentStatus := cmdconfig.Viper().GetBool(arg)
// what is the new status (the opposite) // what is the new status (the opposite)
newStatus := !currentStatus newStatus := !currentStatus

View File

@@ -257,7 +257,7 @@ func loadConfig(ctx context.Context, configFolder string, steampipeConfig *Steam
} }
// do a partial decode // do a partial decode
content, moreDiags := body.Content(pparse.ConfigBlockSchema) content, moreDiags := body.Content(pparse.SteampipeConfigBlockSchema)
if moreDiags.HasErrors() { if moreDiags.HasErrors() {
diags = append(diags, moreDiags...) diags = append(diags, moreDiags...)
return perror_helpers.DiagsToErrorsAndWarnings("Failed to load config", diags) return perror_helpers.DiagsToErrorsAndWarnings("Failed to load config", diags)

View File

@@ -1,20 +1,16 @@
workspace "default" { workspace "default" {
introspection = "info"
pipes_host = "latestpipe.turbot.io/" pipes_host = "latestpipe.turbot.io/"
pipes_token = "spt_012faketoken34567890_012faketoken3456789099999" pipes_token = "spt_012faketoken34567890_012faketoken3456789099999"
install_dir = "sp_install_dir_default" install_dir = "sp_install_dir_default"
mod_location = "sp_install_dir_default"
snapshot_location = "snaps" snapshot_location = "snaps"
workspace_database = "fk43e7" workspace_database = "fk43e7"
} }
workspace "sample" { workspace "sample" {
introspection = "control"
pipes_host = "testpipe.turbot.io" pipes_host = "testpipe.turbot.io"
pipes_token = "spt_012faketoken34567890_012faketoken3456789099999" pipes_token = "spt_012faketoken34567890_012faketoken3456789099999"
install_dir = "sp_install_dir_sample" install_dir = "sp_install_dir_sample"
mod_location = "sp_install_dir_sample"
snapshot_location = "snap" snapshot_location = "snap"
workspace_database = "fk43e8" workspace_database = "fk43e8"
} }

View File

@@ -1,12 +1,10 @@
workspace "default" { workspace "default" {
pipes_host = "latestpipe.turbot.io/" pipes_host = "latestpipe.turbot.io/"
pipes_token = "spt_012faketoken34567890_012faketoken3456789099999" pipes_token = "spt_012faketoken34567890_012faketoken3456789099999"
mod_location = "sp_install_dir_default"
snapshot_location = "snaps" snapshot_location = "snaps"
workspace_database = "fk43e7" workspace_database = "fk43e7"
search_path = "" search_path = ""
search_path_prefix = "abc" search_path_prefix = "abc"
watch = false
options "query" { options "query" {
autocomplete = false autocomplete = false
header = false header = false
@@ -15,23 +13,15 @@ workspace "default" {
separator = "|" separator = "|"
timing = true timing = true
} }
options "check" {
header = false
output = "json"
separator = "|"
timing = true
}
} }
workspace "sample" { workspace "sample" {
pipes_host = "latestpipe.turbot.io/" pipes_host = "latestpipe.turbot.io/"
pipes_token = "spt_012faketoken34567890_012faketoken3456789099999" pipes_token = "spt_012faketoken34567890_012faketoken3456789099999"
mod_location = "sp_install_dir_sample"
snapshot_location = "snaps" snapshot_location = "snaps"
workspace_database = "fk43e7" workspace_database = "fk43e7"
search_path = "abc" search_path = "abc"
search_path_prefix = "abc, def" search_path_prefix = "abc, def"
watch = false
options "query" { options "query" {
autocomplete = true autocomplete = true
header = false header = false
@@ -40,10 +30,4 @@ workspace "sample" {
separator = ";" separator = ";"
timing = true timing = true
} }
options "check" {
header = false
output = "csv"
separator = ";"
timing = true
}
} }

View File

@@ -10,11 +10,9 @@
"args": [] "args": []
}, },
"expected": { "expected": {
"introspection": "info",
"pipes-host": "latestpipe.turbot.io/", "pipes-host": "latestpipe.turbot.io/",
"pipes-token": "spt_012faketoken34567890_012faketoken3456789099999", "pipes-token": "spt_012faketoken34567890_012faketoken3456789099999",
"install-dir": "sp_install_dir_default", "install-dir": "sp_install_dir_default",
"mod-location": "sp_install_dir_default",
"snapshot-location": "snaps", "snapshot-location": "snaps",
"workspace": "default", "workspace": "default",
"workspace-database": "fk43e7" "workspace-database": "fk43e7"
@@ -28,16 +26,13 @@
"env": [ "env": [
"STEAMPIPE_WORKSPACE_PROFILES_LOCATION=workspace_profiles", "STEAMPIPE_WORKSPACE_PROFILES_LOCATION=workspace_profiles",
"PIPES_HOST=testpipe.turbot.io", "PIPES_HOST=testpipe.turbot.io",
"STEAMPIPE_MOD_LOCATION=sp_install_dir_env",
"STEAMPIPE_INSTALL_DIR=sp_install_dir_env", "STEAMPIPE_INSTALL_DIR=sp_install_dir_env",
"PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099996", "PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099996",
"STEAMPIPE_SNAPSHOT_LOCATION=snapshot", "STEAMPIPE_SNAPSHOT_LOCATION=snapshot",
"STEAMPIPE_WORKSPACE_DATABASE=fk/43e7", "STEAMPIPE_WORKSPACE_DATABASE=fk/43e7"
"STEAMPIPE_INTROSPECTION=none"
], ],
"args": [ "args": [
"--install-dir=sp_install_dir_default", "--install-dir=sp_install_dir_default",
"--mod-location=sp_install_dir_default",
"--pipes-host=fastestpipe.turbot.io", "--pipes-host=fastestpipe.turbot.io",
"--pipes-token=spt_012faketoken34567890_012faketoken3456789099990", "--pipes-token=spt_012faketoken34567890_012faketoken3456789099990",
"--snapshot-location=snaps", "--snapshot-location=snaps",
@@ -45,11 +40,9 @@
] ]
}, },
"expected": { "expected": {
"introspection": "none",
"pipes-host": "fastestpipe.turbot.io", "pipes-host": "fastestpipe.turbot.io",
"pipes-token": "spt_012faketoken34567890_012faketoken3456789099990", "pipes-token": "spt_012faketoken34567890_012faketoken3456789099990",
"install-dir": "sp_install_dir_default", "install-dir": "sp_install_dir_default",
"mod-location": "sp_install_dir_default",
"snapshot-location": "snaps", "snapshot-location": "snaps",
"workspace": "default", "workspace": "default",
"workspace-database": "fk43e9" "workspace-database": "fk43e9"
@@ -63,7 +56,6 @@
"env": [ "env": [
"PIPES_HOST=latestpipe.turbot.io/", "PIPES_HOST=latestpipe.turbot.io/",
"STEAMPIPE_INSTALL_DIR=sp_install_dir_env", "STEAMPIPE_INSTALL_DIR=sp_install_dir_env",
"STEAMPIPE_MOD_LOCATION=sp_install_dir_env",
"PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099999", "PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099999",
"STEAMPIPE_SNAPSHOT_LOCATION=snaps", "STEAMPIPE_SNAPSHOT_LOCATION=snaps",
"STEAMPIPE_WORKSPACE_DATABASE=fk43e7" "STEAMPIPE_WORKSPACE_DATABASE=fk43e7"
@@ -74,7 +66,6 @@
"pipes-host": "latestpipe.turbot.io/", "pipes-host": "latestpipe.turbot.io/",
"pipes-token": "spt_012faketoken34567890_012faketoken3456789099999", "pipes-token": "spt_012faketoken34567890_012faketoken3456789099999",
"install-dir": "sp_install_dir_env", "install-dir": "sp_install_dir_env",
"mod-location": "sp_install_dir_env",
"snapshot-location": "snaps", "snapshot-location": "snaps",
"workspace": "default", "workspace": "default",
"workspace-database": "fk43e7" "workspace-database": "fk43e7"
@@ -93,11 +84,9 @@
] ]
}, },
"expected": { "expected": {
"introspection": "control",
"pipes-host": "testpipe.turbot.io", "pipes-host": "testpipe.turbot.io",
"pipes-token": "spt_012faketoken34567890_012faketoken3456789099999", "pipes-token": "spt_012faketoken34567890_012faketoken3456789099999",
"install-dir": "sp_install_dir_sample", "install-dir": "sp_install_dir_sample",
"mod-location": "sp_install_dir_sample",
"snapshot-location": "snap", "snapshot-location": "snap",
"workspace": "sample", "workspace": "sample",
"workspace-database": "fk43e8" "workspace-database": "fk43e8"
@@ -111,7 +100,6 @@
"env": [], "env": [],
"args": [ "args": [
"--install-dir=sp_install_dir_sample", "--install-dir=sp_install_dir_sample",
"--mod-location=sp_install_dir_sample",
"--pipes-host=fastestpipe.turbot.io", "--pipes-host=fastestpipe.turbot.io",
"--pipes-token=spt_012faketoken34567890_012faketoken3456789099990", "--pipes-token=spt_012faketoken34567890_012faketoken3456789099990",
"--snapshot-location=snaps", "--snapshot-location=snaps",
@@ -122,7 +110,6 @@
"pipes-host": "fastestpipe.turbot.io", "pipes-host": "fastestpipe.turbot.io",
"pipes-token": "spt_012faketoken34567890_012faketoken3456789099990", "pipes-token": "spt_012faketoken34567890_012faketoken3456789099990",
"install-dir": "sp_install_dir_sample", "install-dir": "sp_install_dir_sample",
"mod-location": "sp_install_dir_sample",
"snapshot-location": "snaps", "snapshot-location": "snaps",
"workspace": "default", "workspace": "default",
"workspace-database": "fk43e9" "workspace-database": "fk43e9"
@@ -137,7 +124,6 @@
"STEAMPIPE_WORKSPACE_PROFILES_LOCATION=workspace_profiles", "STEAMPIPE_WORKSPACE_PROFILES_LOCATION=workspace_profiles",
"PIPES_HOST=fastestpipe.turbot.io/", "PIPES_HOST=fastestpipe.turbot.io/",
"STEAMPIPE_INSTALL_DIR=sp_install_dir_env", "STEAMPIPE_INSTALL_DIR=sp_install_dir_env",
"STEAMPIPE_MOD_LOCATION=sp_install_dir_env",
"PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099996", "PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099996",
"STEAMPIPE_SNAPSHOT_LOCATION=snapshot", "STEAMPIPE_SNAPSHOT_LOCATION=snapshot",
"STEAMPIPE_WORKSPACE_DATABASE=ab43e6" "STEAMPIPE_WORKSPACE_DATABASE=ab43e6"
@@ -148,7 +134,6 @@
"pipes-host": "fastestpipe.turbot.io/", "pipes-host": "fastestpipe.turbot.io/",
"pipes-token": "spt_012faketoken34567890_012faketoken3456789099996", "pipes-token": "spt_012faketoken34567890_012faketoken3456789099996",
"install-dir": "sp_install_dir_env", "install-dir": "sp_install_dir_env",
"mod-location": "sp_install_dir_env",
"snapshot-location": "snapshot", "snapshot-location": "snapshot",
"workspace": "default", "workspace": "default",
"workspace-database": "ab43e6" "workspace-database": "ab43e6"
@@ -163,7 +148,6 @@
"STEAMPIPE_WORKSPACE_PROFILES_LOCATION=workspace_profiles", "STEAMPIPE_WORKSPACE_PROFILES_LOCATION=workspace_profiles",
"PIPES_HOST=fastestpipe.turbot.io/", "PIPES_HOST=fastestpipe.turbot.io/",
"STEAMPIPE_INSTALL_DIR=sp_install_dir_env", "STEAMPIPE_INSTALL_DIR=sp_install_dir_env",
"STEAMPIPE_MOD_LOCATION=sp_install_dir_env",
"PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099996", "PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099996",
"STEAMPIPE_SNAPSHOT_LOCATION=snapshot", "STEAMPIPE_SNAPSHOT_LOCATION=snapshot",
"STEAMPIPE_WORKSPACE_DATABASE=ab43e6" "STEAMPIPE_WORKSPACE_DATABASE=ab43e6"
@@ -176,7 +160,6 @@
"pipes-host": "testpipe.turbot.io", "pipes-host": "testpipe.turbot.io",
"pipes-token": "spt_012faketoken34567890_012faketoken3456789099999", "pipes-token": "spt_012faketoken34567890_012faketoken3456789099999",
"install-dir": "sp_install_dir_sample", "install-dir": "sp_install_dir_sample",
"mod-location": "sp_install_dir_sample",
"snapshot-location": "snap", "snapshot-location": "snap",
"workspace": "sample", "workspace": "sample",
"workspace-database": "fk43e8" "workspace-database": "fk43e8"
@@ -191,7 +174,6 @@
"STEAMPIPE_WORKSPACE_PROFILES_LOCATION=workspace_profiles", "STEAMPIPE_WORKSPACE_PROFILES_LOCATION=workspace_profiles",
"PIPES_HOST=fastestpipe.turbot.io/", "PIPES_HOST=fastestpipe.turbot.io/",
"STEAMPIPE_INSTALL_DIR=sp_install_dir_env", "STEAMPIPE_INSTALL_DIR=sp_install_dir_env",
"STEAMPIPE_MOD_LOCATION=sp_install_dir_env",
"PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099996", "PIPES_TOKEN=spt_012faketoken34567890_012faketoken3456789099996",
"STEAMPIPE_SNAPSHOT_LOCATION=snapshot", "STEAMPIPE_SNAPSHOT_LOCATION=snapshot",
"STEAMPIPE_WORKSPACE_DATABASE=ab43e6" "STEAMPIPE_WORKSPACE_DATABASE=ab43e6"
@@ -204,7 +186,6 @@
"pipes-host": "testpipe.turbot.io", "pipes-host": "testpipe.turbot.io",
"pipes-token": "spt_012faketoken34567890_012faketoken3456789099999", "pipes-token": "spt_012faketoken34567890_012faketoken3456789099999",
"install-dir": "sp_install_dir_sample", "install-dir": "sp_install_dir_sample",
"mod-location": "sp_install_dir_sample",
"snapshot-location": "snap", "snapshot-location": "snap",
"workspace": "sample", "workspace": "sample",
"workspace-database": "fk43e8" "workspace-database": "fk43e8"
@@ -220,7 +201,6 @@
], ],
"args": [ "args": [
"--install-dir=sp_install_dir_default", "--install-dir=sp_install_dir_default",
"--mod-location=sp_install_dir_default",
"--pipes-host=fastestpipe.turbot.io", "--pipes-host=fastestpipe.turbot.io",
"--pipes-token=spt_012faketoken34567890_012faketoken3456789099990", "--pipes-token=spt_012faketoken34567890_012faketoken3456789099990",
"--snapshot-location=snaps", "--snapshot-location=snaps",
@@ -231,7 +211,6 @@
"pipes-host": "fastestpipe.turbot.io", "pipes-host": "fastestpipe.turbot.io",
"pipes-token": "spt_012faketoken34567890_012faketoken3456789099990", "pipes-token": "spt_012faketoken34567890_012faketoken3456789099990",
"install-dir": "sp_install_dir_default", "install-dir": "sp_install_dir_default",
"mod-location": "sp_install_dir_default",
"snapshot-location": "snaps", "snapshot-location": "snaps",
"workspace": "default", "workspace": "default",
"workspace-database": "fk43e9" "workspace-database": "fk43e9"
@@ -248,18 +227,16 @@
"args": [] "args": []
}, },
"expected": { "expected": {
"query.autocomplete": false, "query.auto-complete": false,
"query.header": false, "query.header": false,
"query.multi": true, "query.multi-line": true,
"query.output": "json", "query.output": "json",
"query-timeout": 0, "query-timeout": 0,
"search-path": "[ ]", "search-path": "[ ]",
"search-path-prefix": "[ abc ]", "search-path-prefix": "[ abc ]",
"query.separator": "|", "query.separator": "|",
"query.timing": true, "query.timing": true,
"telemetry": "info", "telemetry": "info"
"update-check": "false",
"watch": false
} }
}, },
{ {
@@ -296,17 +273,16 @@
] ]
}, },
"expected": { "expected": {
"query.autocomplete": true, "query.auto-complete": true,
"query.header": false, "query.header": false,
"query.multi": true, "query.multi-line": true,
"query.output": "csv", "query.output": "csv",
"search-path": "[ abc ]", "search-path": "[ abc ]",
"search-path-prefix": "[ abc, def ]", "search-path-prefix": "[ abc, def ]",
"query.separator": ";", "query.separator": ";",
"query.timing": true, "query.timing": true,
"telemetry": "none", "telemetry": "none",
"update-check": "true", "update-check": "true"
"watch": false
} }
}, },
{ {
@@ -322,12 +298,11 @@
"--search-path=abc", "--search-path=abc",
"--search-path-prefix=def", "--search-path-prefix=def",
"--separator=+", "--separator=+",
"--timing=true", "--timing=true"
"--watch=true"
] ]
}, },
"expected": { "expected": {
"query.autocomplete": false, "query.auto-complete": false,
"header": true, "header": true,
"output": "table", "output": "table",
"query-timeout": 190, "query-timeout": 190,
@@ -335,8 +310,7 @@
"search-path-prefix": "[ def ]", "search-path-prefix": "[ def ]",
"separator": "+", "separator": "+",
"telemetry": "none", "telemetry": "none",
"update-check": "true", "update-check": "true"
"watch": true
} }
}, },
{ {
@@ -354,18 +328,17 @@
"args": [] "args": []
}, },
"expected": { "expected": {
"query.autocomplete": false, "query.auto-complete": false,
"query.header": false, "query.header": false,
"max-parallel": 10, "max-parallel": 10,
"query.multi": true, "query.multi-line": true,
"query.output": "json", "query.output": "json",
"query-timeout": 100, "query-timeout": 100,
"search-path": "[ ]", "search-path": "[ ]",
"search-path-prefix": "[ abc ]", "search-path-prefix": "[ abc ]",
"query.separator": "|", "query.separator": "|",
"telemetry": "none", "telemetry": "none",
"update-check": true, "update-check": true
"watch": false
} }
}, },
{ {
@@ -385,18 +358,17 @@
] ]
}, },
"expected": { "expected": {
"autocomplete": true, "auto-complete": true,
"header": false, "header": false,
"max-parallel": 10, "max-parallel": 10,
"multi": true, "multi-line": true,
"output": "csv", "output": "csv",
"query-timeout": 100, "query-timeout": 100,
"search-path": "[ abc ]", "search-path": "[ abc ]",
"search-path-prefix": "[ abc, def ]", "search-path-prefix": "[ abc, def ]",
"separator": ";", "separator": ";",
"telemetry": "none", "telemetry": "none",
"update-check": true, "update-check": true
"watch": false
} }
}, },
{ {
@@ -415,18 +387,17 @@
"args": [] "args": []
}, },
"expected": { "expected": {
"autocomplete": true, "auto-complete": true,
"header": false, "header": false,
"max-parallel": 10, "max-parallel": 10,
"multi": true, "multi-line": true,
"output": "csv", "output": "csv",
"query-timeout": 100, "query-timeout": 100,
"search-path": "[ abc ]", "search-path": "[ abc ]",
"search-path-prefix": "[ abc, def ]", "search-path-prefix": "[ abc, def ]",
"separator": ";", "separator": ";",
"telemetry": "none", "telemetry": "none",
"update-check": true, "update-check": true
"watch": false
} }
}, },
{ {
@@ -449,23 +420,21 @@
"--search-path=xyz", "--search-path=xyz",
"--search-path-prefix=pqr", "--search-path-prefix=pqr",
"--separator=+", "--separator=+",
"--timing=true", "--timing=true"
"--watch=true"
] ]
}, },
"expected": { "expected": {
"autocomplete": true, "auto-complete": true,
"header": true, "header": true,
"max-parallel": 10, "max-parallel": 10,
"multi": true, "multi-line": true,
"output": "table", "output": "table",
"query-timeout": 190, "query-timeout": 190,
"search-path": "[ xyz ]", "search-path": "[ xyz ]",
"search-path-prefix": "[ pqr ]", "search-path-prefix": "[ pqr ]",
"separator": "+", "separator": "+",
"telemetry": "none", "telemetry": "none",
"update-check": true, "update-check": true
"watch": true
} }
}, },
{ {
@@ -487,23 +456,21 @@
"--search-path=xyz", "--search-path=xyz",
"--search-path-prefix=pqr", "--search-path-prefix=pqr",
"--separator=+", "--separator=+",
"--timing=true", "--timing=true"
"--watch=true"
] ]
}, },
"expected": { "expected": {
"autocomplete": true, "auto-complete": true,
"header": true, "header": true,
"max-parallel": 10, "max-parallel": 10,
"multi": true, "multi-line": true,
"output": "table", "output": "table",
"query-timeout": 190, "query-timeout": 190,
"search-path": "[ xyz ]", "search-path": "[ xyz ]",
"search-path-prefix": "[ pqr ]", "search-path-prefix": "[ pqr ]",
"separator": "+", "separator": "+",
"telemetry": "none", "telemetry": "none",
"update-check": true, "update-check": true
"watch": true
} }
}, },
{ {
@@ -520,18 +487,17 @@
"args": [] "args": []
}, },
"expected": { "expected": {
"autocomplete": true, "auto-complete": true,
"header": false, "header": false,
"max-parallel": 10, "max-parallel": 10,
"multi": true, "multi-line": true,
"output": "csv", "output": "csv",
"query-timeout": 100, "query-timeout": 100,
"search-path": "[ abc ]", "search-path": "[ abc ]",
"search-path-prefix": "[ abc, def ]", "search-path-prefix": "[ abc, def ]",
"separator": ";", "separator": ";",
"telemetry": "none", "telemetry": "none",
"update-check": true, "update-check": true
"watch": false
} }
} }
] ]

View File

@@ -4,7 +4,6 @@ load "$LIB_BATS_SUPPORT/load.bash"
## workspace tests ## workspace tests
@test "generic config precedence test" { @test "generic config precedence test" {
skip 'TODO - update and enable this test'
cp $FILE_PATH/test_data/source_files/config_tests/default.spc $STEAMPIPE_INSTALL_DIR/config/default.spc cp $FILE_PATH/test_data/source_files/config_tests/default.spc $STEAMPIPE_INSTALL_DIR/config/default.spc
# setup test folder and read the test-cases file # setup test folder and read the test-cases file