Skip to content

Commit 4722fe7

Browse files
committed
rebase + fix conflicts
1 parent bb3dc7b commit 4722fe7

3 files changed

+19
-17
lines changed

helper_test.go

+10-8
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ func createPolicySet(t *testing.T, client *Client, org *Organization, policies [
697697
}
698698
}
699699

700-
func createPolicySetWithOptions(t *testing.T, client *Client, org *Organization, policies []*Policy, workspaces []*Workspace, opts PolicySetCreateOptions) (*PolicySet, func()) {
700+
func createPolicySetWithOptions(t *testing.T, client *Client, org *Organization, policies []*Policy, workspaces, excludedWorkspace []*Workspace, projects []*Project, opts PolicySetCreateOptions) (*PolicySet, func()) {
701701
var orgCleanup func()
702702

703703
if org == nil {
@@ -706,13 +706,15 @@ func createPolicySetWithOptions(t *testing.T, client *Client, org *Organization,
706706

707707
ctx := context.Background()
708708
ps, err := client.PolicySets.Create(ctx, org.Name, PolicySetCreateOptions{
709-
Name: String(randomString(t)),
710-
Policies: policies,
711-
Workspaces: workspaces,
712-
Kind: opts.Kind,
713-
Overridable: opts.Overridable,
714-
AgentEnabled: opts.AgentEnabled,
715-
PolicyToolVersion: opts.PolicyToolVersion,
709+
Name: String(randomString(t)),
710+
Policies: policies,
711+
Workspaces: workspaces,
712+
WorkspaceExclusions: excludedWorkspace,
713+
Projects: projects,
714+
Kind: opts.Kind,
715+
Overridable: opts.Overridable,
716+
AgentEnabled: opts.AgentEnabled,
717+
PolicyToolVersion: opts.PolicyToolVersion,
716718
})
717719
if err != nil {
718720
t.Fatal(err)

policy_set_integration_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ func TestPolicySetsList(t *testing.T) {
3636
Overridable: Bool(true),
3737
}
3838

39-
psTest1, psTestCleanup1 := createPolicySetWithOptions(t, client, orgTest, nil, []*Workspace{workspace}, []*Workspace{excludedWorkspace}, options)
39+
psTest1, psTestCleanup1 := createPolicySetWithOptions(t, client, orgTest, nil, []*Workspace{workspace}, []*Workspace{excludedWorkspace}, nil, options)
4040
defer psTestCleanup1()
41-
psTest2, psTestCleanup2 := createPolicySetWithOptions(t, client, orgTest, nil, []*Workspace{workspace}, []*Workspace{excludedWorkspace}, options)
41+
psTest2, psTestCleanup2 := createPolicySetWithOptions(t, client, orgTest, nil, []*Workspace{workspace}, []*Workspace{excludedWorkspace}, nil, options)
4242
defer psTestCleanup2()
43-
psTest3, psTestCleanup3 := createPolicySet(t, client, orgTest, nil, []*Workspace{workspace}, nil, OPA)
43+
psTest3, psTestCleanup3 := createPolicySet(t, client, orgTest, nil, []*Workspace{workspace}, []*Workspace{excludedWorkspace}, nil, OPA)
4444
defer psTestCleanup3()
4545

4646
t.Run("without list options", func(t *testing.T) {
@@ -105,7 +105,7 @@ func TestPolicySetsList(t *testing.T) {
105105
Include: []PolicySetIncludeOpt{PolicySetWorkspaceExclusions},
106106
})
107107
require.NoError(t, err)
108-
assert.Equal(t, 2, len(psl.Items))
108+
assert.Equal(t, 3, len(psl.Items))
109109

110110
assert.NotNil(t, psl.Items[0].WorkspaceExclusions)
111111
assert.Equal(t, 1, len(psl.Items[0].WorkspaceExclusions))
@@ -634,9 +634,9 @@ func TestPolicySetsUpdate(t *testing.T) {
634634
Overridable: Bool(true),
635635
}
636636

637-
psTest, psTestCleanup := createPolicySetWithOptions(t, client, orgTest, nil, nil, options)
637+
psTest, psTestCleanup := createPolicySetWithOptions(t, client, orgTest, nil, nil, nil, nil, options)
638638
defer psTestCleanup()
639-
psTest2, psTestCleanup2 := createPolicySet(t, client, orgTest, nil, nil, nil, "opa")
639+
psTest2, psTestCleanup2 := createPolicySet(t, client, orgTest, nil, nil, nil, nil, "opa")
640640
defer psTestCleanup2()
641641

642642
t.Run("with valid attributes", func(t *testing.T) {

task_stages_integration_beta_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func TestTaskStageOverride_Beta(t *testing.T) {
200200
Kind: OPA,
201201
Overridable: Bool(true),
202202
}
203-
createPolicySetWithOptions(t, client, orgTest, []*Policy{pTest}, []*Workspace{wTest}, opts)
203+
createPolicySetWithOptions(t, client, orgTest, []*Policy{pTest}, []*Workspace{wTest}, nil, nil, opts)
204204
rTest, tTestCleanup := createRunWaitForStatus(t, client, wTest, RunPostPlanAwaitingDecision)
205205
defer tTestCleanup()
206206

@@ -239,7 +239,7 @@ func TestTaskStageOverride_Beta(t *testing.T) {
239239
Kind: OPA,
240240
Overridable: Bool(true),
241241
}
242-
createPolicySetWithOptions(t, client, orgTest, []*Policy{pTest}, []*Workspace{wTest}, opts)
242+
createPolicySetWithOptions(t, client, orgTest, []*Policy{pTest}, []*Workspace{wTest}, nil, nil, opts)
243243
rTest, tTestCleanup := createRunWaitForStatus(t, client, wTest, RunPostPlanAwaitingDecision)
244244
defer tTestCleanup()
245245

@@ -280,7 +280,7 @@ func TestTaskStageOverride_Beta(t *testing.T) {
280280
Kind: OPA,
281281
Overridable: Bool(true),
282282
}
283-
createPolicySetWithOptions(t, client, orgTest, []*Policy{pTest}, []*Workspace{wTest}, opts)
283+
createPolicySetWithOptions(t, client, orgTest, []*Policy{pTest}, []*Workspace{wTest}, nil, nil, opts)
284284
rTest, tTestCleanup := createPlannedRun(t, client, wTest)
285285
defer tTestCleanup()
286286

0 commit comments

Comments
 (0)