-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Always use default trust policy and append patches (#148)
Signed-off-by: kevdowney <[email protected]> Signed-off-by: Kevin Downey <[email protected]>
- Loading branch information
Showing
7 changed files
with
225 additions
and
21 deletions.
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