(t *testing.T)
| 138 | } |
| 139 | |
| 140 | func TestValidateCommandBadVersion(t *testing.T) { |
| 141 | c := &ValidateCommand{ |
| 142 | Meta: TestMetaFile(t), |
| 143 | } |
| 144 | args := []string{ |
| 145 | filepath.Join(testFixture("validate"), "template.json"), |
| 146 | } |
| 147 | |
| 148 | // This should fail with an invalid configuration version |
| 149 | c.CoreConfig.Version = "100.0.0" |
| 150 | if code := c.Run(args); code != 1 { |
| 151 | t.Errorf("Expected exit code 1") |
| 152 | } |
| 153 | |
| 154 | stdout, stderr := GetStdoutAndErrFromTestMeta(t, c.Meta) |
| 155 | expected := `Error: |
| 156 | |
| 157 | This template requires Packer version 101.0.0 or higher; using 100.0.0 |
| 158 | |
| 159 | |
| 160 | ` |
| 161 | |
| 162 | if diff := cmp.Diff(expected, stderr); diff != "" { |
| 163 | t.Errorf("Unexpected output: %s", diff) |
| 164 | } |
| 165 | t.Log(stdout) |
| 166 | } |
| 167 | |
| 168 | func TestValidateCommandExcept(t *testing.T) { |
| 169 | tt := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…