canonical / test_observer

Flutter based dashboard for visualising SRU regression test results
2 stars 2 forks source link

Fix bug with promote script #172

Closed omar-selo closed 2 months ago

omar-selo commented 2 months ago

Found a bug with promote script. The helper method queries.artefact_architectures filters by ArtefactBuild.id == artefact_id where it should've filtered by ArtefactBuild.artefact_id == artefact_id. This meant that in some cases promote script couldn't promote debs.

This is a particularly nasty bug because the tests pass. But if you ran pytest on just promote.py file then the test would fail. Which begs the question, why? The answer turns out to be because database transaction rollback doesn't reset the auto increment value of a primary key. Hence in some cases it could just happen that ArtefactBuild.id == artefact_id. In other cases it would not be. That all depends on what tests ran before this particular failing test. (Learning point, database transaction rollback doesn't rollback the incrementation of primary keys)