herokuautomated-testsheroku-ci

Heroku CI running tests twice per deploy


Looking at my tests overview in Heroku, I see that tests run twice for every build I want to push to production. The first time runs when I've opened a PR for a branch (I've prevented pushing directly to master) and the second after I've successfully merged.

two tests in heroku ci view

Should this be happening and is there a way to avoid duplicate test runs and only run them on the branch I'm about to merge?


Solution

  • Yes, this is expected. Whenever you merge the PR, the master branch is updated. So the tests are rerun there.

    Let's imagine 2 PRs:

    master
     |- commit A - PR1
     |- commit B - PR2
    

    You start by merging PR1. Commit A gets added to master. Then, you merge PR2.
    But when that second PR was tested, it didn't have commit A in it's tree. So your tests could be failing.