Esempio n. 1
0
    def test_ignores_recent_jobs(self, sync_build_delay):
        dt = datetime.utcnow()

        build = self.create_build(
            project=self.project,
            date_created=dt,
            status=Status.queued,
        )

        cleanup_builds()

        assert not sync_build_delay.called

        build = Build.query.get(build.id)

        assert build.date_modified == dt
Esempio n. 2
0
    def test_expires_builds(self, sync_build_delay):
        dt = datetime.utcnow() - (EXPIRE_BUILDS * 2)

        build = self.create_build(
            project=self.project,
            date_created=dt,
            status=Status.queued,
        )

        cleanup_builds()

        assert not sync_build_delay.called

        build = Build.query.get(build.id)

        assert build.date_modified != dt
        assert build.result == Result.aborted
        assert build.status == Status.finished
Esempio n. 3
0
    def test_queues_jobs(self, sync_build_delay):
        dt = datetime.utcnow() - (CHECK_BUILDS * 2)

        build = self.create_build(
            project=self.project,
            date_created=dt,
            status=Status.queued,
        )

        cleanup_builds()

        sync_build_delay.assert_called_once_with(
            build_id=build.id.hex,
            task_id=build.id.hex,
        )

        build = Build.query.get(build.id)

        assert build.date_modified != dt