address review comments

This commit is contained in:
Mahmood Ali
2020-01-15 08:57:05 -05:00
parent 4f36d4b308
commit 3291523d8c
4 changed files with 26 additions and 23 deletions

View File

@@ -604,6 +604,9 @@ func (b *Builder) setAlloc(alloc *structs.Allocation) *Builder {
tg := alloc.Job.LookupTaskGroup(alloc.TaskGroup)
b.otherPorts = make(map[string]string, len(tg.Tasks)*2)
// Protect against invalid allocs where AllocatedResources isn't set.
// TestClient_AddAllocError explicitly tests for this condition
if alloc.AllocatedResources != nil {
// Populate task resources
if tr, ok := alloc.AllocatedResources.Tasks[b.taskName]; ok {