From 05214d8f9a9c0d1becd19c08e72ef4c4abc5caf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Mon, 24 Jun 2024 16:52:51 +0200 Subject: [PATCH] (core) Port allocation fix in TestServer Summary: - Fixing port allocation in TestServer - Extending logging in the Billing test - Fixing negative rowIds support for add/remove actions - Making FormulaEditor and CardView tests less flacky Test Plan: Existing Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz, dsagal Differential Revision: https://phab.getgrist.com/D4280 --- sandbox/grist/useractions.py | 8 +++++++- test/server/lib/helpers/TestServer.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sandbox/grist/useractions.py b/sandbox/grist/useractions.py index ac9261ef..95f5a49c 100644 --- a/sandbox/grist/useractions.py +++ b/sandbox/grist/useractions.py @@ -395,7 +395,7 @@ class UserActions(object): # Whenever we add new rows, remember the mapping from any negative row_ids to their final # values. This allows the negative_row_ids to be used as Reference values in subsequent - # actions in the same bundle. + # actions in the same bundle, and in UpdateRecord/RemoveRecord actions. self._engine.out_actions.summary.update_new_rows_map(table_id, row_ids, filled_row_ids) # Convert entered values to the correct types. @@ -446,6 +446,9 @@ class UserActions(object): # ---------------------------------------- def doBulkUpdateRecord(self, table_id, row_ids, columns): + # Replace negative ids that may refer to rows just added to this table in this bundle. + row_ids = self._engine.out_actions.summary.translate_new_row_ids(table_id, row_ids) + # Convert passed-in values to the column's correct types (or alttext, or errors) and trim any # unchanged values. action, extra_actions = self._engine.convert_action_values( @@ -1071,6 +1074,9 @@ class UserActions(object): assert all(isinstance(r, (int, table.Record)) for r in row_ids_or_records) row_ids = [int(r) for r in row_ids_or_records] + # Replace negative ids that may refer to rows just added to this table in this bundle. + row_ids = self._engine.out_actions.summary.translate_new_row_ids(table_id, row_ids) + self._do_doc_action(actions.BulkRemoveRecord(table_id, row_ids)) # Also remove any references to this row from other tables. diff --git a/test/server/lib/helpers/TestServer.ts b/test/server/lib/helpers/TestServer.ts index 95946859..080abb1e 100644 --- a/test/server/lib/helpers/TestServer.ts +++ b/test/server/lib/helpers/TestServer.ts @@ -79,7 +79,7 @@ export class TestServer { throw new Error(`Path of testingSocket too long: ${this.testingSocket.length} (${this.testingSocket})`); } - const port = await getAvailablePort(); + const port = await getAvailablePort(Number(process.env.GET_AVAILABLE_PORT_START || '8000')); this._serverUrl = `http://localhost:${port}`; const homeUrl = _homeUrl ?? (this._serverTypes.includes('home') ? this._serverUrl : undefined);