Skip to content

Commit 9593186

Browse files
committed
Add failing test to verify problem in #3030
Signed-off-by: Timo Sand <[email protected]>
1 parent e842c58 commit 9593186

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

github/resource_github_emu_group_mapping_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,47 @@ func TestAccGithubEMUGroupMapping(t *testing.T) {
5959
},
6060
})
6161
})
62+
t.Run("imports EMU group mapping with multiple teams", func(t *testing.T) {
63+
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
64+
teamName := fmt.Sprintf("%steam1-emu-%s", testResourcePrefix, randomID)
65+
teamName2 := fmt.Sprintf("%steam2-emu-%s", testResourcePrefix, randomID)
66+
rn := "github_emu_group_mapping.test1"
67+
config := fmt.Sprintf(`
68+
resource "github_team" "test1" {
69+
name = "%s"
70+
description = "EMU group mapping test team 1"
71+
}
72+
resource "github_team" "test2" {
73+
name = "%s"
74+
description = "EMU group mapping test team 2"
75+
}
76+
resource "github_emu_group_mapping" "test1" {
77+
team_slug = github_team.test1.slug
78+
group_id = %d
79+
}
80+
resource "github_emu_group_mapping" "test2" {
81+
team_slug = github_team.test2.slug
82+
group_id = %[3]d
83+
}
84+
`, teamName, teamName2, groupID)
85+
86+
resource.Test(t, resource.TestCase{
87+
PreCheck: func() { skipUnlessMode(t, enterprise) },
88+
ProviderFactories: providerFactories,
89+
CheckDestroy: testAccCheckGithubEMUGroupMappingDestroy,
90+
Steps: []resource.TestStep{
91+
{
92+
Config: config,
93+
},
94+
{
95+
ResourceName: rn,
96+
ImportState: true,
97+
ImportStateIdFunc: testAccGithubEMUGroupMappingImportStateIdFunc(rn),
98+
ImportStateVerify: true,
99+
},
100+
},
101+
})
102+
})
62103

63104
t.Run("handles team slug update by recreating", func(t *testing.T) {
64105
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)

0 commit comments

Comments
 (0)