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

add non-empty string validation for datacenters #5665

Merged
merged 2 commits into from
May 13, 2019
Merged

Conversation

jazzyfresh
Copy link
Contributor

@jazzyfresh jazzyfresh commented May 8, 2019

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

Copy link
Contributor

@notnoop notnoop left a 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") {
Copy link
Contributor

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

Suggested change
if !strings.Contains(mErr.Error(), "datacenter must be non-empty string") {
require.Contains(t, mErr.Error(), "datacenter must be non-empty string")

@jazzyfresh jazzyfresh merged commit 2d23f90 into master May 13, 2019
@endocrimes endocrimes deleted the b-empty-datacenters branch May 13, 2019 18:21
nickethier added a commit that referenced this pull request May 14, 2019
* 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
  ...
@github-actions
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants