(t *testing.T)
| 70 | } |
| 71 | |
| 72 | func TestValidateCommand_SkipDatasourceExecution(t *testing.T) { |
| 73 | datasourceMock := &packersdk.MockDatasource{} |
| 74 | meta := TestMetaFile(t) |
| 75 | meta.CoreConfig.Components.PluginConfig.DataSources = packer.MapOfDatasource{ |
| 76 | "mock": func() (packersdk.Datasource, error) { |
| 77 | return datasourceMock, nil |
| 78 | }, |
| 79 | } |
| 80 | c := &ValidateCommand{ |
| 81 | Meta: meta, |
| 82 | } |
| 83 | args := []string{filepath.Join(testFixture("validate"), "datasource.pkr.hcl")} |
| 84 | if code := c.Run(args); code != 0 { |
| 85 | fatalCommand(t, c.Meta) |
| 86 | } |
| 87 | if datasourceMock.ExecuteCalled { |
| 88 | t.Fatalf("Datasource should not be executed on validation") |
| 89 | } |
| 90 | if !datasourceMock.OutputSpecCalled { |
| 91 | t.Fatalf("Datasource OutPutSpec should be called on validation") |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | func TestValidateCommand_SyntaxOnly(t *testing.T) { |
| 96 | tt := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…