provider/archiver fix test output path breaking other tests (#8291)

* provider/archive: grant more permissions for output directories

* provider/archive: place test output in temp dir

we don't want to pollute terraform source folders…
This commit is contained in:
Raphael Randschau 2016-08-18 19:11:19 +02:00 committed by Paul Stack
parent 20ed831060
commit 9a70bfa977
2 changed files with 6 additions and 5 deletions

View File

@ -102,7 +102,7 @@ func resourceArchiveFileUpdate(d *schema.ResourceData, meta interface{}) error {
outputDirectory := path.Dir(outputPath)
if outputDirectory != "" {
if _, err := os.Stat(outputDirectory); err != nil {
if err := os.MkdirAll(outputDirectory, 755); err != nil {
if err := os.MkdirAll(outputDirectory, 0777); err != nil {
return err
}
}

View File

@ -41,7 +41,7 @@ func TestAccArchiveFile_Basic(t *testing.T) {
r.TestStep{
Config: testAccArchiveFileOutputPath,
Check: r.ComposeTestCheckFunc(
testAccArchiveFileExists("example/path/test.zip", &fileSize),
testAccArchiveFileExists(fmt.Sprintf("%s/test.zip", tmpDir), &fileSize),
),
},
},
@ -82,14 +82,15 @@ resource "archive_file" "foo" {
}
`
var testAccArchiveFileOutputPath = `
var tmpDir = os.TempDir() + "/test"
var testAccArchiveFileOutputPath = fmt.Sprintf(`
resource "archive_file" "foo" {
type = "zip"
source_content = "This is some content"
source_content_filename = "content.txt"
output_path = "example/path/test.zip"
output_path = "%s/test.zip"
}
`
`, tmpDir)
var testAccArchiveFileFileConfig = `
resource "archive_file" "foo" {