(t *testing.T)
| 599 | } |
| 600 | |
| 601 | func 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 | |
| 637 | func TestSync_FilterPluginEnv(t *testing.T) { |
| 638 | cases := []struct { |
nothing calls this directly
no test coverage detected