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

Revert permission target resource back to SDKv2 version #842

Merged
merged 4 commits into from
Nov 6, 2023

Conversation

alexhung
Copy link
Member

@alexhung alexhung commented Nov 3, 2023

close #757, #805

@alexhung alexhung added the enhancement New feature or request label Nov 3, 2023
@@ -439,8 +434,7 @@ func TestAccPermissionTarget_addBuild(t *testing.T) {
resource.TestCheckResourceAttr(permFqrn, "repo.0.actions.0.users.#", "1"),
resource.TestCheckResourceAttr(permFqrn, "repo.0.actions.0.groups.#", "0"),
resource.TestCheckResourceAttr(permFqrn, "repo.0.repositories.#", "1"),
resource.TestCheckResourceAttr(permFqrn, "repo.0.includes_pattern.#", "1"),
resource.TestCheckResourceAttr(permFqrn, "repo.0.includes_pattern.0", "**"),
resource.TestCheckResourceAttr(permFqrn, "repo.0.includes_pattern.#", "0"),
Copy link
Member Author

Choose a reason for hiding this comment

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

SDKv2 doesn't allow setting default values for "set" attribute. 😞

@@ -159,15 +159,12 @@ const testLength = `
repo {
includes_pattern = ["foo/**"]
repositories = ["{{ .repo_name }}"]
actions {
}
Copy link
Member Author

Choose a reason for hiding this comment

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

actions is an optional field in the API so I don't know why test for empty attribute. Can be framework related.

}

entityDataList := rawEntityData.([]interface{})
if len(entityDataList) == 0 || entityDataList[0] == nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

Add additional nil check to prevent crash

@alexhung alexhung marked this pull request as ready for review November 3, 2023 18:44
@alexhung alexhung requested a review from danielmkn as a code owner November 3, 2023 18:45
@alexhung alexhung linked an issue Nov 6, 2023 that may be closed by this pull request
@alexhung alexhung merged commit e315c99 into master Nov 6, 2023
@alexhung alexhung deleted the revert-permission-target-to-sdkv2 branch November 6, 2023 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants