From 9a70bfa977f09fb8ffeae033c2668fb371b3db8f Mon Sep 17 00:00:00 2001 From: Raphael Randschau Date: Thu, 18 Aug 2016 19:11:19 +0200 Subject: [PATCH] provider/archiver fix test output path breaking other tests (#8291) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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… --- builtin/providers/archive/resource_archive_file.go | 2 +- builtin/providers/archive/resource_archive_file_test.go | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/builtin/providers/archive/resource_archive_file.go b/builtin/providers/archive/resource_archive_file.go index b2bd551cca..1efad60464 100644 --- a/builtin/providers/archive/resource_archive_file.go +++ b/builtin/providers/archive/resource_archive_file.go @@ -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 } } diff --git a/builtin/providers/archive/resource_archive_file_test.go b/builtin/providers/archive/resource_archive_file_test.go index d19f8201c5..639bfb2952 100644 --- a/builtin/providers/archive/resource_archive_file_test.go +++ b/builtin/providers/archive/resource_archive_file_test.go @@ -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" {