-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44833 Truncate AssumeRole session name to API limits
- Loading branch information
1 parent
6acad6c
commit 16b65e8
Showing
4 changed files
with
36 additions
and
2 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
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 |
---|---|---|
|
@@ -493,3 +493,26 @@ func TestResourceARN(t *testing.T) { | |
}) | ||
} | ||
} | ||
|
||
func TestTruncateRoleSessionName(t *testing.T) { | ||
for _, tt := range []struct { | ||
name string | ||
role string | ||
expected string | ||
}{ | ||
{ | ||
name: "role session name not truncated, less than 64 characters", | ||
role: "MyRole", | ||
expected: "MyRole", | ||
}, | ||
{ | ||
name: "role session name truncated, longer than 64 characters", | ||
role: "remote-raimundo.oliveira@abigcompany.com-teleport.abigcompany.com", | ||
expected: "[email protected]", | ||
}, | ||
} { | ||
t.Run(tt.name, func(t *testing.T) { | ||
require.Equal(t, tt.expected, TruncateRoleSessionName(tt.role)) | ||
}) | ||
} | ||
} |
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