Fix situations when request's job is not set 34/189134/11
authorLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Thu, 13 Sep 2018 15:20:48 +0000 (17:20 +0200)
committerLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Thu, 4 Oct 2018 13:30:47 +0000 (15:30 +0200)
commitd8adb45bae098fb128232717235f0ca2695a1aaf
tree37c14231dec7a791db1ef6670cc6bfc6abca9163
parent70f4a1bb1750c17c5b3691c22a621291b32fa067
Fix situations when request's job is not set

It is a good practice to check if pointer is not nil, before
dereferencing it. Verification if Job field of request is set
in closeRequest is such situation.

It is not an error situation if Worker state transition:
RUN->MAINTENANCE or RUN->FAIL happen and a request's is not run
by any Job. It can occur e.g. when worker is already booked for
a Job (in RUN state) and creation of Job is not yet completed
or failed.

Change-Id: Ib1790fdaab293b9478dc67f86b69f04a6808c50b
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
requests/requests.go
requests/requests_test.go
requests/requests_workerchange_test.go