Add failing test for compress interpolation

This commit is contained in:
Chris Bednarski 2015-08-03 16:34:24 -07:00
parent 6a2bedb699
commit 8d6719e71f
1 changed files with 29 additions and 0 deletions

View File

@ -150,6 +150,35 @@ func TestCompressOptions(t *testing.T) {
}
}
func TestCompressInterpolation(t *testing.T) {
const config = `
{
"post-processors": [
{
"type": "compress",
"output": "{{ .BuildName }}.gz"
}
]
}
`
artifact := testArchive(t, config)
defer artifact.Destroy()
filename := "file.gz"
archive, err := os.Open(filename)
if err != nil {
t.Fatalf("Unable to read %s: %s", filename, err)
}
gzipReader, _ := gzip.NewReader(archive)
data, _ := ioutil.ReadAll(gzipReader)
if string(data) != expectedFileContents {
t.Errorf("Expected:\n%s\nFound:\n%s\n", expectedFileContents, data)
}
}
// Test Helpers
func setup(t *testing.T) (packer.Ui, packer.Artifact, error) {