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:
parent
20ed831060
commit
9a70bfa977
|
@ -102,7 +102,7 @@ func resourceArchiveFileUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||||
outputDirectory := path.Dir(outputPath)
|
outputDirectory := path.Dir(outputPath)
|
||||||
if outputDirectory != "" {
|
if outputDirectory != "" {
|
||||||
if _, err := os.Stat(outputDirectory); err != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ func TestAccArchiveFile_Basic(t *testing.T) {
|
||||||
r.TestStep{
|
r.TestStep{
|
||||||
Config: testAccArchiveFileOutputPath,
|
Config: testAccArchiveFileOutputPath,
|
||||||
Check: r.ComposeTestCheckFunc(
|
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" {
|
resource "archive_file" "foo" {
|
||||||
type = "zip"
|
type = "zip"
|
||||||
source_content = "This is some content"
|
source_content = "This is some content"
|
||||||
source_content_filename = "content.txt"
|
source_content_filename = "content.txt"
|
||||||
output_path = "example/path/test.zip"
|
output_path = "%s/test.zip"
|
||||||
}
|
}
|
||||||
`
|
`, tmpDir)
|
||||||
|
|
||||||
var testAccArchiveFileFileConfig = `
|
var testAccArchiveFileFileConfig = `
|
||||||
resource "archive_file" "foo" {
|
resource "archive_file" "foo" {
|
||||||
|
|
Loading…
Reference in New Issue