Skip to content
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

fail if the provided user name is not k8s compliant #94

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MatousJobanek
Copy link
Contributor

we should fail if the provided name of the user is not compliant with k8s names and label values.

@xcoulon
Copy link
Contributor

xcoulon commented Dec 17, 2024

we should fail if the provided name of the user is not compliant with k8s names and label values.

it's much simpler and much better than sanitizing the username, indeed!

Copy link
Contributor

@mfrancisc mfrancisc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this check 🙏

I have few minor questions/clarifications.

pkg/cmd/generate/cluster.go Show resolved Hide resolved
pkg/cmd/generate/cluster_test.go Show resolved Hide resolved
pkg/cmd/generate/cluster_test.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.02%. Comparing base (9ef0ea0) to head (7f3b039).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #94      +/-   ##
==========================================
+ Coverage   67.78%   68.02%   +0.23%     
==========================================
  Files          44       44              
  Lines        3216     3240      +24     
==========================================
+ Hits         2180     2204      +24     
  Misses        841      841              
  Partials      195      195              
Files with missing lines Coverage Δ
pkg/cmd/generate/cluster.go 85.71% <100.00%> (+8.79%) ⬆️

Copy link
Contributor

@mfrancisc mfrancisc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

Thanks for answering my questions 🙏

Copy link
Contributor

@alexeykazakov alexeykazakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

err := ensureUsers(clusterCtx, objectsCache{})

// then
require.Error(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually prefer checking the actual error just to make sure the error message is informative and it's actually the expected error and not something else. Unless it's tricky to hardcode the expected error message in the test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to checking the actual error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@fbm3307 fbm3307 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, i liked this approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants