Skip to content

Commit

Permalink
Checker: Assign boolean values to cancel_checks
Browse files Browse the repository at this point in the history
SQLite works fine with integers but Postgres only permits boolean
values.

Fixes: 739fc6f (Checker: Terminate Checker Scripts after competition has finished, 2023-04-22)
  • Loading branch information
rudis committed Aug 31, 2023
1 parent 03e0d03 commit 0bd5eae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ctf_gameserver/controller/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_control_info(db_conn, prohibit_changes=False):
def increase_tick(db_conn, prohibit_changes=False):

with transaction_cursor(db_conn, prohibit_changes) as cursor:
cursor.execute('UPDATE scoring_gamecontrol SET current_tick = current_tick + 1, cancel_checks = 0')
cursor.execute('UPDATE scoring_gamecontrol SET current_tick = current_tick + 1, cancel_checks = false')
# Create flags for every service and team in the new tick
cursor.execute('INSERT INTO scoring_flag (service_id, protecting_team_id, tick)'
' SELECT service.id, team.user_id, control.current_tick'
Expand All @@ -39,7 +39,7 @@ def increase_tick(db_conn, prohibit_changes=False):
def cancel_checks(db_conn, prohibit_changes=False):

with transaction_cursor(db_conn, prohibit_changes) as cursor:
cursor.execute('UPDATE scoring_gamecontrol SET cancel_checks = 1')
cursor.execute('UPDATE scoring_gamecontrol SET cancel_checks = true')


def update_scoring(db_conn):
Expand Down
2 changes: 1 addition & 1 deletion tests/checker/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def test_cancel_checks(self, monotonic_mock, warning_mock):
os.kill(checkerscript_pid, 0)

with transaction_cursor(self.connection) as cursor:
cursor.execute('UPDATE scoring_gamecontrol SET cancel_checks=1')
cursor.execute('UPDATE scoring_gamecontrol SET cancel_checks=true')

master_loop.supervisor.queue_timeout = 0.01
monotonic_mock.return_value = 190
Expand Down
2 changes: 1 addition & 1 deletion tests/controller/test_main_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_next_tick_overdue(self, sleep_mock, _):
with transaction_cursor(self.connection) as cursor:
cursor.execute('UPDATE scoring_gamecontrol SET start=datetime("now", "-19 minutes"), '
' end=datetime("now", "+1421 minutes"), '
' current_tick=5, cancel_checks=1')
' current_tick=5, cancel_checks=true')

controller.main_loop_step(self.connection, self.metrics, False)

Expand Down

0 comments on commit 0bd5eae

Please sign in to comment.