-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
add groups tokenfile #15704
add groups tokenfile #15704
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ func TestTokenFile(t *testing.T) { | |
auth, err := newWithContents(t, ` | ||
token1,user1,uid1 | ||
token2,user2,uid2 | ||
token3,user3,uid3,group1,group2 | ||
token4,user4,uid4,group2 | ||
`) | ||
if err != nil { | ||
t.Fatalf("unable to read tokenfile: %v", err) | ||
|
@@ -52,9 +54,19 @@ token2,user2,uid2 | |
}, | ||
{ | ||
Token: "token3", | ||
User: &user.DefaultInfo{Name: "user3", UID: "uid3", Groups: []string{"group1", "group2"}}, | ||
Ok: true, | ||
}, | ||
{ | ||
Token: "token4", | ||
User: &user.DefaultInfo{Name: "user4", UID: "uid4", Groups: []string{"group2"}}, | ||
Ok: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need a test of an invalid token (all your test cases are valid tokens now) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've copied in the old false tests from master and squashed down to a single commit again |
||
}, | ||
{ | ||
Token: "token5", | ||
}, | ||
{ | ||
Token: "token6", | ||
}, | ||
} | ||
for i, testCase := range testCases { | ||
|
@@ -66,6 +78,7 @@ token2,user2,uid2 | |
} else if !reflect.DeepEqual(testCase.User, user) { | ||
t.Errorf("%d: expected user %#v, got %#v", i, testCase.User, user) | ||
} | ||
|
||
if testCase.Ok != ok { | ||
t.Errorf("%d: expected auth %v, got %v", i, testCase.Ok, ok) | ||
} | ||
|
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.
We can never add another column to this now, since group is repeated.
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.
if you used double quotes around a comma-separated list of groups, then this would not be a problem.
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.
strike now while the iron is hot
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.
lists inside lists is tricky, but I agree about not locking ourselves in