mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
backfill region from job hcl in jobUpdate and jobPlan endpoints
- updated region in job metadata that gets persisted to nomad datastore - fixed many unrelated unit tests that used an invalid region value (they previously passed because hcl wasn't getting picked up and the job would default to global region)
This commit is contained in:
@@ -37,7 +37,7 @@ func TestCompose(t *testing.T) {
|
||||
AddTask(task)
|
||||
|
||||
// Compose a job
|
||||
job := NewServiceJob("job1", "myjob", "region1", 2).
|
||||
job := NewServiceJob("job1", "myjob", "global", 2).
|
||||
SetMeta("foo", "bar").
|
||||
AddDatacenter("dc1").
|
||||
Constrain(NewConstraint("kernel.name", "=", "linux")).
|
||||
@@ -45,7 +45,7 @@ func TestCompose(t *testing.T) {
|
||||
|
||||
// Check that the composed result looks correct
|
||||
expect := &Job{
|
||||
Region: stringToPtr("region1"),
|
||||
Region: stringToPtr("global"),
|
||||
ID: stringToPtr("job1"),
|
||||
Name: stringToPtr("myjob"),
|
||||
Type: stringToPtr(JobTypeService),
|
||||
|
||||
@@ -1206,9 +1206,9 @@ func TestJobs_JobSummary(t *testing.T) {
|
||||
|
||||
func TestJobs_NewBatchJob(t *testing.T) {
|
||||
t.Parallel()
|
||||
job := NewBatchJob("job1", "myjob", "region1", 5)
|
||||
job := NewBatchJob("job1", "myjob", "global", 5)
|
||||
expect := &Job{
|
||||
Region: stringToPtr("region1"),
|
||||
Region: stringToPtr("global"),
|
||||
ID: stringToPtr("job1"),
|
||||
Name: stringToPtr("myjob"),
|
||||
Type: stringToPtr(JobTypeBatch),
|
||||
@@ -1221,9 +1221,9 @@ func TestJobs_NewBatchJob(t *testing.T) {
|
||||
|
||||
func TestJobs_NewServiceJob(t *testing.T) {
|
||||
t.Parallel()
|
||||
job := NewServiceJob("job1", "myjob", "region1", 5)
|
||||
job := NewServiceJob("job1", "myjob", "global", 5)
|
||||
expect := &Job{
|
||||
Region: stringToPtr("region1"),
|
||||
Region: stringToPtr("global"),
|
||||
ID: stringToPtr("job1"),
|
||||
Name: stringToPtr("myjob"),
|
||||
Type: stringToPtr(JobTypeService),
|
||||
|
||||
@@ -39,7 +39,7 @@ func testJob() *Job {
|
||||
SizeMB: intToPtr(25),
|
||||
})
|
||||
|
||||
job := NewBatchJob("job1", "redis", "region1", 1).
|
||||
job := NewBatchJob("job1", "redis", "global", 1).
|
||||
AddDatacenter("dc1").
|
||||
AddTaskGroup(group)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user