cleanup test-superusers

This commit is contained in:
Michael Hoennig 2025-02-03 20:51:16 +01:00
parent d898cddf15
commit 850aa032f3
3 changed files with 15 additions and 9 deletions

View File

@ -6,6 +6,7 @@
<entry key="HSADMINNG_MIGRATION_DATA_PATH" value="migration" /> <entry key="HSADMINNG_MIGRATION_DATA_PATH" value="migration" />
<entry key="HSADMINNG_POSTGRES_ADMIN_USERNAME" value="admin" /> <entry key="HSADMINNG_POSTGRES_ADMIN_USERNAME" value="admin" />
<entry key="HSADMINNG_POSTGRES_RESTRICTED_USERNAME" value="restricted" /> <entry key="HSADMINNG_POSTGRES_RESTRICTED_USERNAME" value="restricted" />
<entry key="HSADMINNG_SUPERUSER" value="import-superuser@hostsharing.net" />
</map> </map>
</option> </option>
<option name="executionName" /> <option name="executionName" />

View File

@ -1,7 +1,7 @@
--liquibase formatted sql --liquibase formatted sql
-- ============================================================================ -- ============================================================================
--changeset michael.hoennig:hs-global-cleanup endDelimiter:--// --changeset michael.hoennig:hs-global-ddl-cleanup context:hosting-asset-import endDelimiter:--//
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
DROP PROCEDURE IF EXISTS hs_office.bankaccount_create_test_data(IN givenholder character varying, IN giveniban character varying, IN givenbic character varying); DROP PROCEDURE IF EXISTS hs_office.bankaccount_create_test_data(IN givenholder character varying, IN giveniban character varying, IN givenbic character varying);
@ -19,3 +19,14 @@ DROP PROCEDURE IF EXISTS hs_office.sepamandate_create_test_data(IN forpartnernum
DROP SCHEMA IF EXISTS rbactest CASCADE; DROP SCHEMA IF EXISTS rbactest CASCADE;
--// --//
-- ============================================================================
--changeset michael.hoennig:hs-global-dml-cleanup context:hosting-asset-import endDelimiter:--//
-- ----------------------------------------------------------------------------
call base.defineContext('9800-cleanup', null, '${HSADMINNG_SUPERUSER}', null);
DELETE FROM rbac.subject WHERE name='superuser-alex@hostsharing.net';
DELETE FROM rbac.subject WHERE name='superuser-fran@hostsharing.net';
--//

View File

@ -92,7 +92,7 @@ import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.BEFORE_TE
}) })
@DirtiesContext @DirtiesContext
@Import({ Context.class, JpaAttempt.class, LiquibaseConfig.class }) @Import({ Context.class, JpaAttempt.class, LiquibaseConfig.class })
@ActiveProfiles({ "without-test-data", "liquibase-migration" }) @ActiveProfiles({ "without-test-data", "liquibase-migration", "hosting-asset-import" })
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@ExtendWith(OrderedDependedTestsExtension.class) @ExtendWith(OrderedDependedTestsExtension.class)
@Sql(value = "/db/released-only-office-schema-with-import-test-data.sql", executionPhase = BEFORE_TEST_CLASS) // release-schema @Sql(value = "/db/released-only-office-schema-with-import-test-data.sql", executionPhase = BEFORE_TEST_CLASS) // release-schema
@ -137,6 +137,7 @@ public class ImportHostingAssets extends CsvDataImport {
@Order(11000) @Order(11000)
void liquibaseMigrationForBookingAndHosting() { void liquibaseMigrationForBookingAndHosting() {
liquibase.assertReferenceStatusAfterRestore(286, "hs-booking-SCHEMA"); liquibase.assertReferenceStatusAfterRestore(286, "hs-booking-SCHEMA");
makeSureThatTheImportAdminUserExists();
liquibase.runWithContexts("migration", "without-test-data"); liquibase.runWithContexts("migration", "without-test-data");
liquibase.assertThatCurrentMigrationsGotApplied(331, "hs-booking-SCHEMA"); liquibase.assertThatCurrentMigrationsGotApplied(331, "hs-booking-SCHEMA");
} }
@ -745,13 +746,6 @@ public class ImportHostingAssets extends CsvDataImport {
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@Test
@Order(19000)
@Commit
void prepareDataBase() {
makeSureThatTheImportAdminUserExists();
}
@Test @Test
@Order(19100) @Order(19100)
@Commit @Commit