@@ -386,36 +386,30 @@ func TestAccGithubRepository(t *testing.T) {
386386 t .Run ("configures_topics_for_a_repository" , func (t * testing.T ) {
387387 randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
388388 testRepoName := fmt .Sprintf ("%stopic-%s" , testResourcePrefix , randomID )
389- config := fmt .Sprintf (`
389+ topicsBefore := `["terraform", "testing"]`
390+ topicsAfter := `["terraform", "testing", "extra-topic"]`
391+ config := `
390392 resource "github_repository" "test" {
391393 name = "%s"
392394 description = "Terraform acceptance tests %[1]s"
393- topics = ["terraform", "testing"]
395+ topics = %s
394396 }
395- ` , testRepoName )
397+ `
396398
397399 resource .Test (t , resource.TestCase {
398400 PreCheck : func () { skipUnauthenticated (t ) },
399401 ProviderFactories : providerFactories ,
400402 Steps : []resource.TestStep {
401403 {
402- Config : config ,
404+ Config : fmt . Sprintf ( config , testRepoName , topicsBefore ) ,
403405 Check : resource .ComposeTestCheckFunc (
404- resource .TestCheckResourceAttr (
405- "github_repository.test" , "topics.#" ,
406- "2" ,
407- ),
406+ resource .TestCheckResourceAttr ("github_repository.test" , "topics.#" , "2" ),
408407 ),
409408 },
410409 {
411- Config : strings .Replace (config ,
412- `topics = ["terraform", "testing"]` ,
413- `topics = ["terraform", "testing", "extra-topic"]` , 1 ),
410+ Config : fmt .Sprintf (config , testRepoName , topicsAfter ),
414411 Check : resource .ComposeTestCheckFunc (
415- resource .TestCheckResourceAttr (
416- "github_repository.test" , "topics.#" ,
417- "3" ,
418- ),
412+ resource .TestCheckResourceAttr ("github_repository.test" , "topics.#" , "3" ),
419413 ),
420414 },
421415 },
0 commit comments