-
Notifications
You must be signed in to change notification settings - Fork 2k
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 non-empty string validation for datacenters #5665
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.
Awesome lgtm
minor nitpick about using testify/require - but the file is using old style of tests so consistency is ok too.
} | ||
err = j.Validate() | ||
mErr = err.(*multierror.Error) | ||
if !strings.Contains(mErr.Error(), "datacenter must be non-empty string") { |
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.
You can use testify require here instead of using Fatalf
directly
if !strings.Contains(mErr.Error(), "datacenter must be non-empty string") { | |
require.Contains(t, mErr.Error(), "datacenter must be non-empty string") |
* master: (912 commits) Update redirects.txt Added redirect for Spark guide link client: log when server list changes docs: mention regression in task config validation fix update to changelog update CHANGELOG with datacenter config validation #5665 typo: "atleast" -> "at least" implement nomad exec for rkt docs: fixed typo use pty/tty terminology similar to github.com/kr/pty vendor github.com/kr/pty drivers: implement streaming exec for executor based drivers executors: implement streaming exec executor: scaffolding for executor grpc handling client: expose allocated memory per task client improve a comment in updateNetworks stalebot: Add 'thinking' as an exempt label (#5684) Added Sparrow link update links to use new canonical location Add redirects for restructing done in GH-5667 ...
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Overview
Currently the command agent accepts jobs with empty-string datacenters
Implementation
Add empty-string check to job validation in
nomad/structs/structs.go
TODO
clean up tests (--> parameterize job validation tests?)parameterization not necessary for these tests