cleanup test-superusers

This commit is contained in:
Michael Hoennig 2025-02-03 20:51:16 +01:00
parent d898cddf15
commit d15a8a81e4
4 changed files with 16 additions and 10 deletions

View File

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

View File

@ -100,4 +100,4 @@
<RunAsTest>true</RunAsTest>
<method v="2" />
</configuration>
</component>
</component>

View File

@ -1,7 +1,7 @@
--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);
@ -19,3 +19,14 @@ DROP PROCEDURE IF EXISTS hs_office.sepamandate_create_test_data(IN forpartnernum
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
@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)
@ExtendWith(OrderedDependedTestsExtension.class)
@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)
void liquibaseMigrationForBookingAndHosting() {
liquibase.assertReferenceStatusAfterRestore(286, "hs-booking-SCHEMA");
makeSureThatTheImportAdminUserExists();
liquibase.runWithContexts("migration", "without-test-data");
liquibase.assertThatCurrentMigrationsGotApplied(331, "hs-booking-SCHEMA");
}
@ -745,13 +746,6 @@ public class ImportHostingAssets extends CsvDataImport {
// --------------------------------------------------------------------------------------------
@Test
@Order(19000)
@Commit
void prepareDataBase() {
makeSureThatTheImportAdminUserExists();
}
@Test
@Order(19100)
@Commit