Skip to content

Commit

Permalink
remove include field from listoptions in policy set
Browse files Browse the repository at this point in the history
  • Loading branch information
uturunku1 committed Mar 3, 2022
1 parent 9f9d966 commit e1eb23a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 32 deletions.
14 changes: 7 additions & 7 deletions agent_pool_integration_test.go
Expand Up @@ -115,13 +115,6 @@ func TestAgentPoolsRead(t *testing.T) {
pool, poolCleanup := createAgentPool(t, client, orgTest)
defer poolCleanup()

wTest, wTestCleanup := createWorkspaceWithVCS(t, client, orgTest, WorkspaceCreateOptions{
Name: String("foo"),
ExecutionMode: String("agent"),
AgentPoolID: String(pool.ID),
})
defer wTestCleanup()

t.Run("when the agent pool exists", func(t *testing.T) {
k, err := client.AgentPools.Read(ctx, pool.ID)
require.NoError(t, err)
Expand All @@ -147,6 +140,13 @@ func TestAgentPoolsRead(t *testing.T) {
// AgentPoolID: String(pool.ID),
// })

wTest, wTestCleanup := createWorkspaceWithVCS(t, client, orgTest, WorkspaceCreateOptions{
Name: String("foo"),
ExecutionMode: String("agent"),
AgentPoolID: String(pool.ID),
})
defer wTestCleanup()

fmt.Println(wTest.AgentPoolID)

k, err := client.AgentPools.ReadWithOptions(ctx, pool.ID, &AgentPoolReadOptions{
Expand Down
17 changes: 0 additions & 17 deletions policy_set.go
Expand Up @@ -103,8 +103,6 @@ type PolicySetListOptions struct {

// Optional: A search string (partial policy set name) used to filter the results.
Search string `url:"search[name],omitempty"`

Include []PolicySetIncludeOpt `url:"include,omitempty"`
}

// PolicySetReadOptions are read options.
Expand Down Expand Up @@ -216,9 +214,6 @@ func (s *policySets) List(ctx context.Context, organization string, options *Pol
if !validStringID(&organization) {
return nil, ErrInvalidOrg
}
if err := options.valid(); err != nil {
return nil, err
}

u := fmt.Sprintf("organizations/%s/policy-sets", url.QueryEscape(organization))
req, err := s.client.newRequest("GET", u, options)
Expand Down Expand Up @@ -456,18 +451,6 @@ func (o PolicySetAddWorkspacesOptions) valid() error {
return nil
}

func (o *PolicySetListOptions) valid() error {
if o == nil {
return nil // nothing to validate
}

if err := validatePolicySetIncludeParams(o.Include); err != nil {
return err
}

return nil
}

func (o *PolicySetReadOptions) valid() error {
if o == nil {
return nil // nothing to validate
Expand Down
8 changes: 0 additions & 8 deletions policy_set_integration_test.go
Expand Up @@ -68,14 +68,6 @@ func TestPolicySetsList(t *testing.T) {
assert.Equal(t, 1, psl.TotalCount)
})

t.Run("with Include option", func(t *testing.T) {
psl, err := client.PolicySets.List(ctx, orgTest.Name, &PolicySetListOptions{
Include: []PolicySetIncludeOpt{PolicySetWorkspaces},
})
require.NoError(t, err)
assert.NotEmpty(t, psl.Items[0].Workspaces[0].Name)
})

t.Run("without a valid organization", func(t *testing.T) {
ps, err := client.PolicySets.List(ctx, badIdentifier, nil)
assert.Nil(t, ps)
Expand Down

0 comments on commit e1eb23a

Please sign in to comment.