-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: Always use default trust policy and append patches #148
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5c2dc2d
chore: ignore tool files
kevdowney 9aa3387
feat: always use default trust policy and append
kevdowney 598ce78
chore: go mod tidy
kevdowney b26e929
fix: tests
kevdowney e217500
fix: more test fixes
kevdowney 24cb1f6
Merge branch 'master' into default-trust-policy
kevdowney 697a351
chore: minor updates
kevdowney 395b55a
Merge branch 'default-trust-policy' of https://github.com/kevdowney/i…
kevdowney 21c144c
chore: go mod tidy
kevdowney 6866263
feat: add Id() helper method and tests
kevdowney e5fc3a3
fix: tests
kevdowney b2deb61
fix: tests
kevdowney 3394bdc
fix: use append function
kevdowney 0e3731d
fix: tests ordering
kevdowney 3e4c36b
Merge branch 'master' into default-trust-policy
kevdowney f626bc5
fix: more tests
kevdowney c53edd8
chore: refactor the append statements
kevdowney d2eade1
fix: tests ordering
kevdowney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ kubebuilder* | |
#IDE files | ||
.idea/ | ||
bin/ | ||
.tool-versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package v1alpha1 | ||
|
||
import "testing" | ||
|
||
func TestTrustPolicyStatement_Id(t *testing.T) { | ||
type fields struct { | ||
Effect Effect | ||
Action string | ||
Principal Principal | ||
Condition *Condition | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
want string | ||
}{ | ||
{ | ||
name: "test1", | ||
fields: fields{ | ||
Effect: "Allow", | ||
Action: "sts:AssumeRoleWithWebIdentity", | ||
Principal: Principal{ | ||
Federated: "arn:aws:iam::123456789012:oidc-provider/oidc.eks.us-east-2.amazonaws.com/id/EXAMPLED539D4633E53DE1B716D3041", | ||
}, | ||
}, | ||
want: "AllowStsAssumeRoleWithWebIdentityef522ae8", | ||
}, | ||
{ | ||
name: "test2: with conditions", | ||
fields: fields{ | ||
Effect: "Allow", | ||
Action: "sts:AssumeRoleWithWebIdentity", | ||
Principal: Principal{ | ||
Federated: "arn:aws:iam::123456789012:oidc-provider/oidc.eks.us-east-2.amazonaws.com/id/EXAMPLED539D4633E53DE1B716D3041", | ||
}, | ||
}, | ||
want: "AllowStsAssumeRoleWithWebIdentityef522ae8", // same as test1 | ||
}, | ||
{ | ||
name: "test3", | ||
fields: fields{ | ||
Effect: "Allow", | ||
Action: "sts:AssumeRole", | ||
Principal: Principal{ | ||
AWS: []string{ | ||
"arn:aws:iam::123456789012:root", | ||
}, | ||
}, | ||
}, | ||
want: "AllowStsAssumeRole21d512f8", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
tps := &TrustPolicyStatement{ | ||
Effect: tt.fields.Effect, | ||
Action: tt.fields.Action, | ||
Principal: tt.fields.Principal, | ||
Condition: tt.fields.Condition, | ||
} | ||
if got := tps.Id(); got != tt.want { | ||
t.Errorf("Id() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we change this to
map[string]bool
? I thinkbool
as map value is easier to understand then indexi
andlen(statements)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use the index value, it's required to maintain the ordering otherwise we get random order and failed tests.