Skip to content

Conversation

@phillipj
Copy link
Member

This is a precursor to fixing #212.

These changes are primarily done so we can get more reliable integration tests. Previously the incoming requests was responded to, before we knew whether or not the Jenkins status has been successfully pushed to GitHub.

That makes it challenging to know when we can assert what we want to verify in integration tests, as we don't know when the entire operation has finished.

Although the previous approach worked in practise when run in production, it should be just as important to have reliable tests that we can rely on when doing changes going forward.

/cc @nodejs/github-bot

The previous approach of testing if network requests had been sent from
the bot, via nock scopes, didn't test more then one network request.

That's because we tested all scoped in a one-liner like this;

```js
prCommitsScope.done() && scope.done()
```

It turns out that the above will not invoke the second `scope.done()`,
meaning only the first nock scope (read: outgoing network request) was
asserted. By going away from that one-liner and invoking one by one on
each line, tests starts to explode.

A fix to the bot's source will come in the next commit.
These changes are primarily done so we can get more reliable integration
tests. Previously the incoming requests was responded to, before we
knew whether or not the Jenkins status has been successfully pushed to
GitHub.

That makes it challenging to know when we can assert what we want to
verify in integration tests, as we don't know when the entire operation
has finished. Although the previous approach did what it should in
practise when run in production, it should be just as important to have
reliable tests that we can rely on when doing changes going forward.
Will be squased into 28d8a86 before
merged to master.
Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

As it's way more intuitive to have those outgoing HTTP request
assertions alongside other assertions, than as part of the test tear
down process.
@phillipj phillipj merged commit b5904f9 into master Mar 24, 2019
@phillipj phillipj deleted the fix-push-jenkins-tests branch March 24, 2019 20:33
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.

3 participants