From: Steve Marion Date: Thu, 23 Feb 2023 10:46:40 +0000 (+0100) Subject: [SONAR-18502] add test for index drop change X-Git-Tag: 10.0.0.68432~198 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c0d0fcd0aba4fb75e6077768e07c1bef481ad9d2;p=sonarqube.git [SONAR-18502] add test for index drop change explicitely test the case where actual index is different and longer than authorized --- diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest.java index 663b1ba237f..9824d61eeb5 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest.java @@ -41,6 +41,16 @@ public class DropIndexProjectsModuleUuidInComponentsTest { db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); } + @Test + public void execute_whenIndexNameWithPrefix_shouldStillDelete() throws SQLException { + String alteredIndexName = "idx_1234567891345678916456789_" + INDEX_NAME; + db.executeUpdateSql(String.format("ALTER INDEX %s RENAME TO %s;", INDEX_NAME, alteredIndexName)); + db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); + db.assertIndex(TABLE_NAME, alteredIndexName, COLUMN_NAME); + underTest.execute(); + db.assertIndexDoesNotExist(TABLE_NAME, alteredIndexName); + } + @Test public void migration_is_reentrant() throws SQLException { db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);