Skip to content

Commit

Permalink
Add Test Jar for Collate Testing (#14010)
Browse files Browse the repository at this point in the history
* Add Test Jar for Collate Testing

* Add Extension Path for Tests
  • Loading branch information
mohityadav766 authored Nov 17, 2023
1 parent 6fb3f12 commit 8abaeb5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
11 changes: 11 additions & 0 deletions openmetadata-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,17 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,24 @@ public static void createApplication() throws Exception {
sqlContainer.withConnectTimeoutSeconds(240);
sqlContainer.start();

final String flyWayMigrationScripsLocation =
final String flyWayMigrationScriptsLocation =
ResourceHelpers.resourceFilePath("db/sql/migrations/flyway/" + sqlContainer.getDriverClassName());
final String nativeMigrationScripsLocation = ResourceHelpers.resourceFilePath("db/sql/migrations/native/");
final String nativeMigrationScriptsLocation = ResourceHelpers.resourceFilePath("db/sql/migrations/native/");

// Extension Config
String extensionMigrationScripsLocation = "";
try {
extensionMigrationScripsLocation = ResourceHelpers.resourceFilePath("extension/sql/migrations/");
configOverrides.add(
ConfigOverride.config("migrationConfiguration.extensionPath", extensionMigrationScripsLocation));
} catch (Exception ex) {
LOG.info("Extension migrations not found");
}
Flyway flyway =
Flyway.configure()
.dataSource(sqlContainer.getJdbcUrl(), sqlContainer.getUsername(), sqlContainer.getPassword())
.table("DATABASE_CHANGE_LOG")
.locations("filesystem:" + flyWayMigrationScripsLocation)
.locations("filesystem:" + flyWayMigrationScriptsLocation)
.sqlMigrationPrefix("v")
.cleanDisabled(false)
.load();
Expand All @@ -127,8 +137,8 @@ public static void createApplication() throws Exception {
overrideDatabaseConfig(sqlContainer);

// Migration overrides
configOverrides.add(ConfigOverride.config("migrationConfiguration.flywayPath", flyWayMigrationScripsLocation));
configOverrides.add(ConfigOverride.config("migrationConfiguration.nativePath", nativeMigrationScripsLocation));
configOverrides.add(ConfigOverride.config("migrationConfiguration.flywayPath", flyWayMigrationScriptsLocation));
configOverrides.add(ConfigOverride.config("migrationConfiguration.nativePath", nativeMigrationScriptsLocation));

ConfigOverride[] configOverridesArray = configOverrides.toArray(new ConfigOverride[0]);
APP = new DropwizardAppExtension<>(OpenMetadataApplication.class, CONFIG_PATH, configOverridesArray);
Expand All @@ -141,8 +151,8 @@ public static void createApplication() throws Exception {
jdbi,
config,
ConnectionType.from(sqlContainer.getDriverClassName()),
nativeMigrationScripsLocation,
null,
nativeMigrationScriptsLocation,
extensionMigrationScripsLocation,
false);
APP.before();
createClient();
Expand Down

0 comments on commit 8abaeb5

Please sign in to comment.