@@ -385,36 +385,30 @@ func TestAccGithubRepository(t *testing.T) {
385385 t .Run ("configures_topics_for_a_repository" , func (t * testing.T ) {
386386 randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
387387 testRepoName := fmt .Sprintf ("%stopic-%s" , testResourcePrefix , randomID )
388- config := fmt .Sprintf (`
388+ topicsBefore := `["terraform", "testing"]`
389+ topicsAfter := `["terraform", "testing", "extra-topic"]`
390+ config := `
389391 resource "github_repository" "test" {
390392 name = "%s"
391393 description = "Terraform acceptance tests %[1]s"
392- topics = ["terraform", "testing"]
394+ topics = %s
393395 }
394- ` , testRepoName )
396+ `
395397
396398 resource .Test (t , resource.TestCase {
397399 PreCheck : func () { skipUnauthenticated (t ) },
398400 ProviderFactories : providerFactories ,
399401 Steps : []resource.TestStep {
400402 {
401- Config : config ,
403+ Config : fmt . Sprintf ( config , testRepoName , topicsBefore ) ,
402404 Check : resource .ComposeTestCheckFunc (
403- resource .TestCheckResourceAttr (
404- "github_repository.test" , "topics.#" ,
405- "2" ,
406- ),
405+ resource .TestCheckResourceAttr ("github_repository.test" , "topics.#" , "2" ),
407406 ),
408407 },
409408 {
410- Config : strings .Replace (config ,
411- `topics = ["terraform", "testing"]` ,
412- `topics = ["terraform", "testing", "extra-topic"]` , 1 ),
409+ Config : fmt .Sprintf (config , testRepoName , topicsAfter ),
413410 Check : resource .ComposeTestCheckFunc (
414- resource .TestCheckResourceAttr (
415- "github_repository.test" , "topics.#" ,
416- "3" ,
417- ),
411+ resource .TestCheckResourceAttr ("github_repository.test" , "topics.#" , "3" ),
418412 ),
419413 },
420414 },
0 commit comments