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

[JenkinsQueueJobV2] Fix job hang out after unexpected response from Jenkins #13034

Conversation

alexander-smolyakov
Copy link
Contributor

PR fix #9 and applying the following changes:

Fixes

  • Fixed situation when the job hang out after unexpected response from Jenkins
  • Fixed About this task link, previously it redirects on Jenkins site instead of docs.microsoft.com

Code refactor

  • Resolved all tslint warnings
  • Logics for checking state transition was exported into separate function - checkStateTransitions
  • JobState enum and checkStateTransitions function was exported into a separate module and refactored.
  • Documentation for job states was rewritten on JSdocs
  • Refactored DoWork method from the Job class. The if-else was replaced on switch.
  • Equals Operator was replaced on Strict Equals Operator for checking HTTP-request response. (Since this task using node package request for working with http-requests, all responses are instances of http.IncomingMessage class where statusCode type documented as number. So it's safe to use Strict Equals Operator.)

Unit tests

  • Added test with the longest test scenario of the state transitions
  • Added test for checking that transition rules are defined for all job states

Testing

  • Changes were tested with self-hosted windows agent and local Jenkins instance.
  • All unit tests have passed.

* Export JobState enum
* Export logics for job state transitions validation into a separate function
* Add unit test for checking job state transitions
* Refactor the function for state transitions validation
* Add new unit test for testing state transition
* Refactor the "DoWork" method from Job class
* Add new status for job
* Add stop when we get unexcpectd response from Jenkins on finishing state
* Fix link on the task
* Rewrite commentaries for job states on JSdoc
* Refactor the "getFullErrorMessage" function
* Modify log-message for killed jobs
* Change the title of the test on more clear
* Fixed typo in the test title
@leantk
Copy link
Contributor

leantk commented May 29, 2020

Nice refactor 👍

@alexander-smolyakov alexander-smolyakov merged commit b3a36e9 into master Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants