-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: user aws-auth configmap for the cluster config
[skip ci]
- Loading branch information
1 parent
2053323
commit 7862b99
Showing
2 changed files
with
57 additions
and
1 deletion.
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
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,27 @@ | ||
package kubernetes | ||
|
||
import "testing" | ||
|
||
func Test_extractAccountIDFromARN(t *testing.T) { | ||
type args struct { | ||
input string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{ | ||
name: "xx", | ||
args: args{input: `- groups:\n - system:masters\n rolearn: arn:aws:iam::123456789:role/kubernetes-admin\n username: admin\n- groups:\n - system:bootstrappers\n - system:nodes\n rolearn: arn:aws:iam::123456789:role/eksctl-mission-control-demo-clust-NodeInstanceRole-VRLF7VBIVK3M\n username: system:node:{{EC2PrivateDNSName}}\n`}, | ||
want: "123456789", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := extractAccountIDFromARN(tt.args.input); got != tt.want { | ||
t.Errorf("extractAccountIDFromARN() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |