-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differentiating between external and internal stage in testing (#427)
When working on this PR: #426 I found that external stage and internal stage are slightly different, and should be tested. Tests fail until the referenced PR is merged.
- Loading branch information
Showing
3 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package resources_test | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAcc_ExternalStage(t *testing.T) { | ||
accName := strings.ToUpper(acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
Providers: providers(), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: externalStageConfig(accName), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("snowflake_stage.test", "name", accName), | ||
resource.TestCheckResourceAttr("snowflake_stage.test", "database", accName), | ||
resource.TestCheckResourceAttr("snowflake_stage.test", "schema", accName), | ||
resource.TestCheckResourceAttr("snowflake_stage.test", "comment", "Terraform acceptance test"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func externalStageConfig(n string) string { | ||
return fmt.Sprintf(` | ||
resource "snowflake_database" "test" { | ||
name = "%v" | ||
comment = "Terraform acceptance test" | ||
} | ||
resource "snowflake_schema" "test" { | ||
name = "%v" | ||
database = snowflake_database.test.name | ||
comment = "Terraform acceptance test" | ||
} | ||
resource "snowflake_stage" "test" { | ||
name = "%v" | ||
url = "s3://com.example.bucket/prefix" | ||
database = snowflake_database.test.name | ||
schema = snowflake_schema.test.name | ||
comment = "Terraform acceptance test" | ||
} | ||
`, n, n, n) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters