Skip to content

Commit 0b52c2c

Browse files
committed
Enable primary_language test
Signed-off-by: Timo Sand <[email protected]>
1 parent 503e6d1 commit 0b52c2c

1 file changed

Lines changed: 33 additions & 35 deletions

File tree

github/resource_github_repository_test.go

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -832,41 +832,39 @@ resource "github_repository" "test" {
832832
})
833833
})
834834

835-
// t.Run("create a repository with go as primary_language", func(t *testing.T) {
836-
// randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
837-
// testResourceName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID)
838-
// config := fmt.Sprintf(`
839-
// resource "github_repository" "test" {
840-
// name = "%s"
841-
// auto_init = true
842-
// }
843-
// resource "github_repository_file" "test" {
844-
// repository = github_repository.test.name
845-
// file = "test.go"
846-
// content = "package main"
847-
// }
848-
// `, testResourceName)
849-
850-
// check := resource.ComposeTestCheckFunc(
851-
// resource.TestCheckResourceAttr("github_repository.test", "primary_language", "Go"),
852-
// )
853-
854-
// resource.ParallelTest(t, resource.TestCase{
855-
// PreCheck: func() { skipUnauthenticated(t) },
856-
// ProviderFactories: providerFactories,
857-
// Steps: []resource.TestStep{
858-
// {
859-
// // Not doing any checks since the file needs to be created before the language can be updated
860-
// Config: config,
861-
// },
862-
// {
863-
// // Re-running the terraform will refresh the language since the go-file has been created
864-
// Config: config,
865-
// Check: check,
866-
// },
867-
// },
868-
// })
869-
// })
835+
t.Run("create a repository with go as primary_language", func(t *testing.T) {
836+
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
837+
testResourceName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID)
838+
config := fmt.Sprintf(`
839+
resource "github_repository" "test" {
840+
name = "%s"
841+
auto_init = true
842+
}
843+
resource "github_repository_file" "test" {
844+
repository = github_repository.test.name
845+
file = "test.go"
846+
content = "package main"
847+
}
848+
`, testResourceName)
849+
850+
resource.ParallelTest(t, resource.TestCase{
851+
PreCheck: func() { skipUnauthenticated(t) },
852+
ProviderFactories: providerFactories,
853+
Steps: []resource.TestStep{
854+
{
855+
// Not doing any checks since the file needs to be created before the language can be updated
856+
Config: config,
857+
},
858+
{
859+
// Re-running the terraform will refresh the language since the go-file has been created
860+
Config: config,
861+
ConfigStateChecks: []statecheck.StateCheck{
862+
statecheck.ExpectKnownValue("github_repository.test", tfjsonpath.New("primary_language"), knownvalue.StringExact("Go")),
863+
},
864+
},
865+
},
866+
})
867+
})
870868

871869
t.Run("manages the legacy pages feature for a repository", func(t *testing.T) {
872870
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)

0 commit comments

Comments
 (0)