@@ -372,36 +372,30 @@ resource "github_repository" "test" {
372372 t .Run ("configures_topics_for_a_repository" , func (t * testing.T ) {
373373 randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
374374 testRepoName := fmt .Sprintf ("%stopic-%s" , testResourcePrefix , randomID )
375- config := fmt .Sprintf (`
375+ topicsBefore := `["terraform", "testing"]`
376+ topicsAfter := `["terraform", "testing", "extra-topic"]`
377+ config := `
376378 resource "github_repository" "test" {
377379 name = "%s"
378380 description = "Terraform acceptance tests %[1]s"
379- topics = ["terraform", "testing"]
381+ topics = %s
380382 }
381- ` , testRepoName )
383+ `
382384
383385 resource .Test (t , resource.TestCase {
384386 PreCheck : func () { skipUnauthenticated (t ) },
385387 ProviderFactories : providerFactories ,
386388 Steps : []resource.TestStep {
387389 {
388- Config : config ,
390+ Config : fmt . Sprintf ( config , testRepoName , topicsBefore ) ,
389391 Check : resource .ComposeTestCheckFunc (
390- resource .TestCheckResourceAttr (
391- "github_repository.test" , "topics.#" ,
392- "2" ,
393- ),
392+ resource .TestCheckResourceAttr ("github_repository.test" , "topics.#" , "2" ),
394393 ),
395394 },
396395 {
397- Config : strings .Replace (config ,
398- `topics = ["terraform", "testing"]` ,
399- `topics = ["terraform", "testing", "extra-topic"]` , 1 ),
396+ Config : fmt .Sprintf (config , testRepoName , topicsAfter ),
400397 Check : resource .ComposeTestCheckFunc (
401- resource .TestCheckResourceAttr (
402- "github_repository.test" , "topics.#" ,
403- "3" ,
404- ),
398+ resource .TestCheckResourceAttr ("github_repository.test" , "topics.#" , "3" ),
405399 ),
406400 },
407401 },
0 commit comments