Commit 433e7a1f authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #40132 from…

Merge pull request #40132 from bruceauyeung/k8s-branch-add-invalid-and-valid-tokens-in-TestValidateToken-testcase Automatic merge from submit-queue add test tokens for TestValidateToken Signed-off-by: 's avatarbruceauyeung <ouyang.qinhua@zte.com.cn> **What this PR does / why we need it**: 1. add invalid tokens which token ID and token secret contain special characters such as `*` 2. add valid tokens which token ID and token secret contain mixed lowercase characters and numeric numbers
parents a951727a cc198d32
...@@ -89,6 +89,8 @@ func TestValidateToken(t *testing.T) { ...@@ -89,6 +89,8 @@ func TestValidateToken(t *testing.T) {
{ID: "12345", Secret: "1234567890123456"}, {ID: "12345", Secret: "1234567890123456"},
{ID: "Abcdef", Secret: "1234567890123456"}, {ID: "Abcdef", Secret: "1234567890123456"},
{ID: "123456", Secret: "AABBCCDDEEFFGGHH"}, {ID: "123456", Secret: "AABBCCDDEEFFGGHH"},
{ID: "abc*ef", Secret: "1234567890123456"},
{ID: "abcdef", Secret: "123456789*123456"},
} }
for _, token := range invalidTokens { for _, token := range invalidTokens {
...@@ -100,6 +102,8 @@ func TestValidateToken(t *testing.T) { ...@@ -100,6 +102,8 @@ func TestValidateToken(t *testing.T) {
validTokens := []*kubeadmapi.TokenDiscovery{ validTokens := []*kubeadmapi.TokenDiscovery{
{ID: "abcdef", Secret: "1234567890123456"}, {ID: "abcdef", Secret: "1234567890123456"},
{ID: "123456", Secret: "aabbccddeeffgghh"}, {ID: "123456", Secret: "aabbccddeeffgghh"},
{ID: "abc456", Secret: "1234567890123456"},
{ID: "abcdef", Secret: "123456ddeeffgghh"},
} }
for _, token := range validTokens { for _, token := range validTokens {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment