-
Notifications
You must be signed in to change notification settings - Fork 107
Fix group case insensitive #1711
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
base: main
Are you sure you want to change the base?
Conversation
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.
Hi @rbiamru thank you for your contribution. I left a small comment about the resulting UX, let's see what other folks think.
pkg/groups/manager.go
Outdated
// Lowercase the group name before checking for existence | ||
name = strings.ToLower(name) |
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.
issue: I don't think this is the right way of fixing this problem.
The way this is implemented, the user would think that he/she was able to create a group named MyGroup
with a mix of uppercase and lowercase letters, while that's not the case. Since this is a user defined property and the user will refer to it from the CLI, it might be better to ensure that name == strings.ToLower(name)
and return a specific error when that's not the case.
Note that this would apply to all routines, not just Create
.
@amirejaz what do you think about it?
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.
I agree @blkt , enforcing lowercase with a clear error across all routines makes sense.
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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1711 +/- ##
==========================================
+ Coverage 33.42% 33.43% +0.01%
==========================================
Files 216 216
Lines 26716 26721 +5
==========================================
+ Hits 8929 8934 +5
Misses 17138 17138
Partials 649 649 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #1699
What was happening
Group names were treated as case-sensitive on Linux. This allowed creating both
default
anddefAult
as separate groups, even though groups were intended to be case-insensitive.What I changed
manager.go
(Create
,Get
,Delete
,Exists
).TestManager_Create
(uppercase + mixed-case).How I tested
nginx
workload)../thv group create MyGroup
→ error./thv run --group MyGroup docker.io/library/nginx:latest
→ error./thv group create mygroup
→ success