Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List workspace variable sets #552

Merged
merged 3 commits into from
Oct 17, 2022
Merged

List workspace variable sets #552

merged 3 commits into from
Oct 17, 2022

Conversation

sebasslash
Copy link
Contributor

Description

Build off of #520 and #551, maintaining the original interface but adding missing test helper to apply a variable set to a workspace (otherwise test fails).

This also fixes the assertion that a given variable set is contained within the list fetched from workspace. assert.Contains() is a tricky call because it performs deep equality. A resource may or may not have relationships defined depending on the endpoint you're calling, in this case:

// when we create a Variable Set
vsTest := client.VariableSets.Create() //omit params
vsTest.Workspaces == [] // true

// after applying vsTest to a workspace
vsList := client.VariableSets.ListForWorkspace()
vsTest.Items[0].Workspaces == [] // false

// therefore
assert.Contains(t, vsList.Items, vsTest) // false

@sebasslash sebasslash requested a review from a team as a code owner October 17, 2022 17:49
variable_set.go Outdated Show resolved Hide resolved
variable_set.go Outdated Show resolved Hide resolved
@sebasslash sebasslash force-pushed the list-workspace-variable-sets branch 3 times, most recently from 00db685 to ff6cb30 Compare October 17, 2022 18:44

t.Run("when Workspace ID is an invalid ID", func(t *testing.T) {
vsl, err := client.VariableSets.ListForWorkspace(ctx, badIdentifier, nil)
assert.Nil(t, vsl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test assertion ErrInvalidWorkspaceID instead of ErrInvalidOrg

Copy link
Contributor

@Uk1288 Uk1288 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 🎉

Copy link
Contributor

@Uk1288 Uk1288 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@sebasslash sebasslash merged commit 5c31a0c into main Oct 17, 2022
@sebasslash sebasslash deleted the list-workspace-variable-sets branch October 17, 2022 20:07
@github-actions
Copy link

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants