Skip to content

Commit

Permalink
Merge pull request #10784 from hashicorp/b-dlskf
Browse files Browse the repository at this point in the history
e2e: fix a couple recent e2e bugs
  • Loading branch information
shoenig authored Jun 18, 2021
2 parents 2520d83 + 15d39f0 commit 6dcada4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions command/agent/job_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ func ApiTgToStructsTG(job *structs.Job, taskGroup *api.TaskGroup, tg *structs.Ta
tg.Constraints = ApiConstraintsToStructs(taskGroup.Constraints)
tg.Affinities = ApiAffinitiesToStructs(taskGroup.Affinities)
tg.Networks = ApiNetworkResourceToStructs(taskGroup.Networks)
tg.Services = ApiServicesToStructs(taskGroup.Services)
tg.Services = ApiServicesToStructs(taskGroup.Services, true)
tg.Consul = apiConsulToStructs(taskGroup.Consul)

tg.RestartPolicy = &structs.RestartPolicy{
Expand Down Expand Up @@ -1044,7 +1044,7 @@ func ApiTaskToStructsTask(job *structs.Job, group *structs.TaskGroup,
}
}

structsTask.Services = ApiServicesToStructs(apiTask.Services)
structsTask.Services = ApiServicesToStructs(apiTask.Services, false)

structsTask.Resources = ApiResourcesToStructs(apiTask.Resources)

Expand Down Expand Up @@ -1212,7 +1212,7 @@ func ApiPortToStructs(in api.Port) structs.Port {
}
}

func ApiServicesToStructs(in []*api.Service) []*structs.Service {
func ApiServicesToStructs(in []*api.Service, group bool) []*structs.Service {
if len(in) == 0 {
return nil
}
Expand Down Expand Up @@ -1258,11 +1258,16 @@ func ApiServicesToStructs(in []*api.Service) []*structs.Service {
Body: check.Body,
GRPCService: check.GRPCService,
GRPCUseTLS: check.GRPCUseTLS,
TaskName: check.TaskName,
SuccessBeforePassing: check.SuccessBeforePassing,
FailuresBeforeCritical: check.FailuresBeforeCritical,
OnUpdate: onUpdate,
}

if group {
// only copy over task name for group level checks
out[i].Checks[j].TaskName = check.TaskName
}

if check.CheckRestart != nil {
out[i].Checks[j].CheckRestart = &structs.CheckRestart{
Limit: check.CheckRestart.Limit,
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2eutil/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// Register registers a jobspec from a file but with a unique ID.
// The caller is responsible for recording that ID for later cleanup.
func Register(jobID, jobFilePath string) error {
cmd := exec.Command("nomad", "job", "run", "-")
cmd := exec.Command("nomad", "job", "run", "-detach", "-")
stdin, err := cmd.StdinPipe()
if err != nil {
return fmt.Errorf("could not open stdin?: %w", err)
Expand Down

0 comments on commit 6dcada4

Please sign in to comment.