From a7b04aafaed4e3aea6a42bf77f845c8629593988 Mon Sep 17 00:00:00 2001 From: David Jardin Date: Wed, 12 Feb 2025 08:18:36 +0100 Subject: [PATCH 1/3] Use an update call instead of an insert for the metadata changes --- tests/System/support/commands/db.mjs | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/tests/System/support/commands/db.mjs b/tests/System/support/commands/db.mjs index 733b0c455f29f..bebcbcaf6eca1 100644 --- a/tests/System/support/commands/db.mjs +++ b/tests/System/support/commands/db.mjs @@ -631,19 +631,8 @@ Cypress.Commands.add('db_getUserId', () => { * @returns integer */ Cypress.Commands.add('db_setInvalidTufRoot', () => { - cy.task('queryDB', 'DELETE FROM #__tuf_metadata WHERE id = 1'); cy.task('queryDB', 'DELETE FROM #__updates WHERE update_site_id = 1'); - cy.task('queryDB', createInsertQuery( - 'tuf_metadata', - { - id: 1, - update_site_id: 1, - root: JSON.stringify(invalidTufMetadata.root), - targets: '', - snapshot: '', - timestamp: '', - }, - )); + cy.task('queryDB', `UPDATE #__tuf_metadata SET root = '${JSON.stringify(invalidTufMetadata.root)}', targets = '', snapshot = '', timestamp = '' WHERE id = 1`); }); /** @@ -652,17 +641,6 @@ Cypress.Commands.add('db_setInvalidTufRoot', () => { * @returns integer */ Cypress.Commands.add('db_setValidTufRoot', () => { - cy.task('queryDB', 'DELETE FROM #__tuf_metadata WHERE id = 1'); cy.task('queryDB', 'DELETE FROM #__updates WHERE update_site_id = 1'); - cy.task('queryDB', createInsertQuery( - 'tuf_metadata', - { - id: 1, - update_site_id: 1, - root: JSON.stringify(validTufMetadata.root), - targets: '', - snapshot: '', - timestamp: '', - }, - )); + cy.task('queryDB', `UPDATE #__tuf_metadata SET root = '${JSON.stringify(validTufMetadata.root)}', targets = '', snapshot = '', timestamp = '' WHERE id = 1`); }); From c39017715e9b8d66ef5c379554c0d73f78df5ff7 Mon Sep 17 00:00:00 2001 From: David Jardin Date: Wed, 12 Feb 2025 10:56:16 +0100 Subject: [PATCH 2/3] fix comment --- tests/System/support/commands/db.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/System/support/commands/db.mjs b/tests/System/support/commands/db.mjs index bebcbcaf6eca1..a7f52dcd0d2af 100644 --- a/tests/System/support/commands/db.mjs +++ b/tests/System/support/commands/db.mjs @@ -636,7 +636,7 @@ Cypress.Commands.add('db_setInvalidTufRoot', () => { }); /** - * Inserts an invalid tuf metadata set + * Inserts an valid tuf metadata set * * @returns integer */ From 475a64467779db79228142378bc03c8dc0a0a540 Mon Sep 17 00:00:00 2001 From: David Jardin Date: Wed, 12 Feb 2025 11:02:33 +0100 Subject: [PATCH 3/3] Update tests/System/support/commands/db.mjs Co-authored-by: Brian Teeman --- tests/System/support/commands/db.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/System/support/commands/db.mjs b/tests/System/support/commands/db.mjs index a7f52dcd0d2af..939372c80126a 100644 --- a/tests/System/support/commands/db.mjs +++ b/tests/System/support/commands/db.mjs @@ -636,7 +636,7 @@ Cypress.Commands.add('db_setInvalidTufRoot', () => { }); /** - * Inserts an valid tuf metadata set + * Inserts a valid tuf metadata set * * @returns integer */