Files
steampipe/pkg/interactive/metaquery/utils_test.go
kaidaguerre 40804a3201 Execute RefreshConnections asyncronously and optimise for high connection count. Add connection_state table.
- Execute RefreshConnections asyncronously
- Add connection_state table to indicate the loading state of connections
- Optimise RefreshConnections by cloning connection schemas
- Add locking to ensure only a single instance of RefreshConnections runs
- Start executing queries without waiting for connections to load, add smart error handling to wait for required connection
- Optimise autocomplete for high connection count
- Autocomplete and inspect data available before all conections are refreshed
- Update file watcher to respond to CHMOD, so thaat it pickes up deletion of file contents

 Closes #3394
 Closes #3267
2023-05-10 09:05:08 +01:00

30 lines
713 B
Go

package metaquery
import (
"reflect"
"testing"
)
type CmdAndArgsExpected struct {
cmd string
args []string
}
func TestGetCmdAndArgs(t *testing.T) {
cases := map[string]CmdAndArgsExpected{
`.cmd arg1`: {cmd: ".cmd", args: []string{"arg1"}},
`.cmd arg1 arg2`: {cmd: ".cmd", args: []string{"arg1", "arg2"}},
`.cmd "arg1a arg1b" arg2`: {cmd: ".cmd", args: []string{"arg1a arg1b", "arg2"}},
}
for input, expected := range cases {
actualCmd, actualArgs := getCmdAndArgs(input)
if actualCmd != expected.cmd {
t.Errorf("%s != %s", actualCmd, expected.cmd)
}
if !reflect.DeepEqual(actualArgs, expected.args) {
t.Errorf("%v != %v", actualArgs, expected.args)
}
}
}