MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / TestSync_IsolatedPluginEnvironmentsInCloud

Function TestSync_IsolatedPluginEnvironmentsInCloud

cli/cmd/sync_test.go:601–635  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

599}
600
601func TestSync_IsolatedPluginEnvironmentsInCloud(t *testing.T) {
602 configs := []struct {
603 name string
604 config string
605 err string
606 }{
607 {
608 name: "source-with-env",
609 config: "source-with-env.yml",
610 },
611 }
612 _, filename, _, _ := runtime.Caller(0)
613 currentDir := path.Dir(filename)
614
615 t.Setenv("CQ_CLOUD", "1")
616 t.Setenv("_CQ_TEAM_NAME", "cloudquery")
617 t.Setenv("_CQ_SYNC_NAME", "test_sync")
618 t.Setenv("_CQ_SYNC_RUN_ID", uuid.Must(uuid.NewUUID()).String())
619 t.Setenv("__SOURCE_TEST__TEST_KEY", "test_value")
620 t.Setenv("NOT_TEST_ENV", "should_not_be_visible_to_plugin")
621
622 for _, tc := range configs {
623 t.Run(tc.name, func(t *testing.T) {
624 testConfig := path.Join(currentDir, "testdata", tc.config)
625 cmd := NewCmdRoot()
626 cmd.SetArgs(append([]string{"sync", testConfig}, testCommandArgs(t)...))
627 err := cmd.Execute()
628 if tc.err != "" {
629 assert.Contains(t, err.Error(), tc.err)
630 } else {
631 assert.NoError(t, err)
632 }
633 })
634 }
635}
636
637func TestSync_FilterPluginEnv(t *testing.T) {
638 cases := []struct {

Callers

nothing calls this directly

Calls 5

testCommandArgsFunction · 0.85
RunMethod · 0.80
NewCmdRootFunction · 0.70
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected