diff --git a/integration/integration_test.go b/integration/integration_test.go index f9774c2..2d843fa 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -59,6 +59,11 @@ func TestIntegration(t *testing.T) { OrganizationID: me.OrganizationIDs[0], }) assert.NoError(t, err) + _, err = c.CreateGroup(ctx, me.OrganizationIDs[0], codersdk.CreateGroupRequest{ + Name: "bosses", + QuotaAllowance: 200, + }) + assert.NoError(t, err) }, assertF: func(t testing.TB, c *codersdk.Client) { // Check user fields. @@ -86,6 +91,14 @@ func TestIntegration(t *testing.T) { user, err = newClient.User(ctx, codersdk.Me) assert.NoError(t, err) assert.Equal(t, "dean", user.Username) + + // Check group + defaultOrg, err := c.OrganizationByName(ctx, "first-organization") + assert.NoError(t, err) + group, err := c.GroupByOrgAndName(ctx, defaultOrg.ID, "employees") + assert.NoError(t, err) + assert.Len(t, group.Members, 3) + assert.Equal(t, group.QuotaAllowance, 100) }, }, } { @@ -112,6 +125,7 @@ func TestIntegration(t *testing.T) { tt.preF(t, client) if err := tfCmd.Run(); !assert.NoError(t, err) { t.Logf(buf.String()) + t.FailNow() } tt.assertF(t, client) }) diff --git a/integration/user-test/main.tf b/integration/user-test/main.tf index 83bd655..d31c76b 100644 --- a/integration/user-test/main.tf +++ b/integration/user-test/main.tf @@ -28,3 +28,27 @@ resource "coderd_user" "ethan2" { roles = data.coderd_user.ethan.roles suspended = data.coderd_user.ethan.suspended } + +data "coderd_organization" "default" { + is_default = true +} + +data "coderd_group" "ethans_group" { + name = "bosses" + organization_id = data.coderd_organization.default.id +} + +resource "coderd_group" "employees" { + name = "employees" + organization_id = data.coderd_organization.default.id + quota_allowance = 100 + members = [ + resource.coderd_user.dean.id, + data.coderd_user.ethan.id, + resource.coderd_user.ethan2.id, + ] +} + +data "coderd_group" "employees" { + id = resource.coderd_group.employees.id +}