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)
Found a bug with promote script. The helper method
queries.artefact_architectures
filters byArtefactBuild.id == artefact_id
where it should've filtered byArtefactBuild.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 thatArtefactBuild.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)