(t *testing.T)
| 27 | var postgresqlExample string |
| 28 | |
| 29 | func TestInit(t *testing.T) { |
| 30 | configs := []struct { |
| 31 | name string |
| 32 | source string |
| 33 | destination string |
| 34 | yes bool |
| 35 | expectedPath string |
| 36 | expectedSpec func(*testing.T, *specs.SpecReader) |
| 37 | }{ |
| 38 | { |
| 39 | name: "accept defaults with --yes flag is set", |
| 40 | yes: true, |
| 41 | expectedPath: "aws_to_postgresql.yaml", |
| 42 | expectedSpec: func(t *testing.T, specs *specs.SpecReader) { |
| 43 | require.Len(t, specs.Sources, 1) |
| 44 | require.Len(t, specs.Destinations, 1) |
| 45 | require.Equal(t, "aws", specs.Sources[0].Name) |
| 46 | require.Equal(t, "cloudquery/aws", specs.Sources[0].Path) |
| 47 | require.Equal(t, "postgresql", specs.Destinations[0].Name) |
| 48 | require.Equal(t, "cloudquery/postgresql", specs.Destinations[0].Path) |
| 49 | }, |
| 50 | }, |
| 51 | { |
| 52 | name: "uses source and destination flags", |
| 53 | source: "cloudquery/gcp", |
| 54 | destination: "cloudquery/sqlite", |
| 55 | expectedPath: "gcp_to_sqlite.yaml", |
| 56 | expectedSpec: func(t *testing.T, specs *specs.SpecReader) { |
| 57 | require.Len(t, specs.Sources, 1) |
| 58 | require.Len(t, specs.Destinations, 1) |
| 59 | require.Equal(t, "gcp", specs.Sources[0].Name) |
| 60 | require.Equal(t, "cloudquery/gcp", specs.Sources[0].Path) |
| 61 | require.Equal(t, "sqlite", specs.Destinations[0].Name) |
| 62 | require.Equal(t, "cloudquery/sqlite", specs.Destinations[0].Path) |
| 63 | }, |
| 64 | }, |
| 65 | { |
| 66 | name: "automatically prepends cloudquery/ to source and destination", |
| 67 | source: "azure", |
| 68 | destination: "bigquery", |
| 69 | expectedPath: "azure_to_bigquery.yaml", |
| 70 | expectedSpec: func(t *testing.T, specs *specs.SpecReader) { |
| 71 | require.Len(t, specs.Sources, 1) |
| 72 | require.Len(t, specs.Destinations, 1) |
| 73 | require.Equal(t, "azure", specs.Sources[0].Name) |
| 74 | require.Equal(t, "cloudquery/azure", specs.Sources[0].Path) |
| 75 | require.Equal(t, "bigquery", specs.Destinations[0].Name) |
| 76 | require.Equal(t, "cloudquery/bigquery", specs.Destinations[0].Path) |
| 77 | }, |
| 78 | }, |
| 79 | { |
| 80 | name: "can generate spec file for community plugins", |
| 81 | source: "hermanschaaf/chess-com", |
| 82 | destination: "bigquery", |
| 83 | expectedPath: "chess-com_to_bigquery.yaml", |
| 84 | expectedSpec: func(t *testing.T, specs *specs.SpecReader) { |
| 85 | require.Len(t, specs.Sources, 1) |
| 86 | require.Len(t, specs.Destinations, 1) |
nothing calls this directly
no test coverage detected