provider/github: Randomize team repository acc tests

This commit is contained in:
Radek Simko 2017-05-13 11:08:04 +02:00
parent af47810e30
commit 23bb27e5f5
No known key found for this signature in database
GPG Key ID: 6823F3DCCE01BB19
1 changed files with 16 additions and 5 deletions

View File

@ -13,7 +13,9 @@ import (
func TestAccGithubTeamRepository_basic(t *testing.T) {
var repository github.Repository
randString := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
repoName := fmt.Sprintf("tf-acc-test-team-%s", acctest.RandString(5))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -21,14 +23,14 @@ func TestAccGithubTeamRepository_basic(t *testing.T) {
CheckDestroy: testAccCheckGithubTeamRepositoryDestroy,
Steps: []resource.TestStep{
{
Config: testAccGithubTeamRepositoryConfig(randString, testRepo),
Config: testAccGithubTeamRepositoryConfig(randString, repoName),
Check: resource.ComposeTestCheckFunc(
testAccCheckGithubTeamRepositoryExists("github_team_repository.test_team_test_repo", &repository),
testAccCheckGithubTeamRepositoryRoleState("pull", &repository),
),
},
{
Config: testAccGithubTeamRepositoryUpdateConfig(randString, testRepo),
Config: testAccGithubTeamRepositoryUpdateConfig(randString, repoName),
Check: resource.ComposeTestCheckFunc(
testAccCheckGithubTeamRepositoryExists("github_team_repository.test_team_test_repo", &repository),
testAccCheckGithubTeamRepositoryRoleState("push", &repository),
@ -40,6 +42,7 @@ func TestAccGithubTeamRepository_basic(t *testing.T) {
func TestAccGithubTeamRepository_importBasic(t *testing.T) {
randString := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
repoName := fmt.Sprintf("tf-acc-test-team-%s", acctest.RandString(5))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -47,7 +50,7 @@ func TestAccGithubTeamRepository_importBasic(t *testing.T) {
CheckDestroy: testAccCheckGithubTeamRepositoryDestroy,
Steps: []resource.TestStep{
{
Config: testAccGithubTeamRepositoryConfig(randString, testRepo),
Config: testAccGithubTeamRepositoryConfig(randString, repoName),
},
{
ResourceName: "github_team_repository.test_team_test_repo",
@ -159,9 +162,13 @@ resource "github_team" "test_team" {
description = "Terraform acc test group"
}
resource "github_repository" "test" {
name = "%s"
}
resource "github_team_repository" "test_team_test_repo" {
team_id = "${github_team.test_team.id}"
repository = "%s"
repository = "${github_repository.test.name}"
permission = "pull"
}
`, randString, repoName)
@ -174,9 +181,13 @@ resource "github_team" "test_team" {
description = "Terraform acc test group"
}
resource "github_repository" "test" {
name = "%s"
}
resource "github_team_repository" "test_team_test_repo" {
team_id = "${github_team.test_team.id}"
repository = "%s"
repository = "${github_repository.test.name}"
permission = "push"
}
`, randString, repoName)