Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/nebula-pr-functional-aurora-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Run [aurora]functional tests on pull requests"
on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# test against JDK 17
java: [ 17 ]
name: Functional tests with Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v1
- name: Setup jdk
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v4
id: gradle-cache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}
restore-keys: |
- ${{ runner.os }}-gradle-
- uses: actions/cache@v4
id: gradle-wrapper-cache
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlewrapper-${{ hashFiles('gradle/wrapper/*') }}
restore-keys: |
- ${{ runner.os }}-gradlewrapper-
- name: Build with Gradle
run: ./gradlew --info --stacktrace functionalTestAurora
env:
CI_NAME: github_actions
CI_BUILD_NUMBER: ${{ github.sha }}
CI_BUILD_URL: 'https://github.com/${{ github.repository }}'
CI_BRANCH: ${{ github.ref }}
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ failure() }} |
- name=$(date +"%Y-%m-%d") && cat ./metacat-functional-tests/build/logs/metacat/catalina.$name.log
- name=$(date +"%Y-%m-%d") && cat ./metacat-functional-tests/build/logs/metacat/localhost.$name.log
- cat ./metacat-functional-tests/build/logs/metacat/spring.log

# Add a step to upload the test report
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report
path: |
**/build/reports/tests/functionalTestAurora
53 changes: 53 additions & 0 deletions .github/workflows/nebula-pr-functional-crdb-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Run [crdb]functional tests on pull requests"
on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# test against JDK 17
java: [ 17 ]
name: Functional tests with Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v1
- name: Setup jdk
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v4
id: gradle-cache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}
restore-keys: |
- ${{ runner.os }}-gradle-
- uses: actions/cache@v4
id: gradle-wrapper-cache
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlewrapper-${{ hashFiles('gradle/wrapper/*') }}
restore-keys: |
- ${{ runner.os }}-gradlewrapper-
- name: Build with Gradle
run: ./gradlew --info --stacktrace functionalTestCRDB
env:
CI_NAME: github_actions
CI_BUILD_NUMBER: ${{ github.sha }}
CI_BUILD_URL: 'https://github.com/${{ github.repository }}'
CI_BRANCH: ${{ github.ref }}
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ failure() }} |
- name=$(date +"%Y-%m-%d") && cat ./metacat-functional-tests/build/logs/metacat/catalina.$name.log
- name=$(date +"%Y-%m-%d") && cat ./metacat-functional-tests/build/logs/metacat/localhost.$name.log
- cat ./metacat-functional-tests/build/logs/metacat/spring.log

# Add a step to upload the test report
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report-crdb
path: |
**/build/reports/tests/functionalTestCRDB
5 changes: 3 additions & 2 deletions .github/workflows/nebula-pr-functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ jobs:
- name=$(date +"%Y-%m-%d") && cat ./metacat-functional-tests/build/logs/metacat/catalina.$name.log
- name=$(date +"%Y-%m-%d") && cat ./metacat-functional-tests/build/logs/metacat/localhost.$name.log
- cat ./metacat-functional-tests/build/logs/metacat/spring.log

# Add a step to upload the test report using version v4
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report-functional
path: /home/runner/work/metacat/metacat/metacat-metadata/build/reports/functionalTest
path: |
**/build/reports/functionalTest
8 changes: 8 additions & 0 deletions .github/workflows/nebula-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ jobs:
- name=$(date +"%Y-%m-%d") && cat ./metacat-functional-tests/build/logs/metacat/catalina.$name.log
- name=$(date +"%Y-%m-%d") && cat ./metacat-functional-tests/build/logs/metacat/localhost.$name.log
- cat ./metacat-functional-tests/build/logs/metacat/spring.log
# Add a step to upload the test report
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report
path: |
**/build/reports/tests/test
Original file line number Diff line number Diff line change
Expand Up @@ -657,5 +657,12 @@ public interface Config {
* @return True if it should be.
*/
boolean isDefinitionMetadataSelectForUpdateEnabled();

/**
* Whether aurora data source is enabled.
*
* @return True if it is.
*/
boolean isAuroraDataSourceEnabled();
}

Original file line number Diff line number Diff line change
Expand Up @@ -713,4 +713,9 @@ public ParentChildRelationshipProperties getParentChildRelationshipProperties()
public boolean isDefinitionMetadataSelectForUpdateEnabled() {
return this.metacatProperties.getUsermetadata().isDefinitionMetadataSelectForUpdateEnabled();
}

@Override
public boolean isAuroraDataSourceEnabled() {
return this.metacatProperties.getService().isAuroraDataSourceEnabled();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,23 @@ public MetacatProperties(final Environment env) {
this.env = env;
this.parentChildRelationshipProperties = new ParentChildRelationshipProperties(env);
}

/**
* Constructor for MetacatProperties.
*
*/
public MetacatProperties() {
this.env = null;
}

/**
* Constructor for MetacatProperties.
*
* @param env Spring Environment
* @param isAuroraEnabled isAuroraEnabled
*/
public MetacatProperties(final Environment env, final boolean isAuroraEnabled) {
this.env = env;
this.getService().setAuroraDataSourceEnabled(isAuroraEnabled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class ServiceProperties {
private Tables tables = new Tables();
private boolean listTableNamesByDefaultOnGetDatabase = true;
private boolean listDatabaseNameByDefaultOnGetCatalog = true;
private boolean auroraDataSourceEnabled;
private int listTableEntitiesPageSize = 1000;
private int listTableNamesPageSize = 10000;
private int listDatabaseEntitiesPageSize = 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* @since 1.2.0
*/
@Slf4j
public class DruidConnectorTableService implements ConnectorTableService {
public class DruidConnectorTableService implements ConnectorTableService {
private final MetacatDruidClient druidClient;
private final DruidConnectorInfoConverter druidConnectorInfoConverter;
/**
Expand Down
87 changes: 60 additions & 27 deletions metacat-connector-polaris/build.gradle
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
/*
*
* Copyright 2021 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

apply plugin: 'nebula.facet'

// Define the facets for functional testing
facets {
functionalTest {
parentSourceSet = "test"
includeInCheckLifecycle = true
testTaskName = 'functionalTestWithDifferentDB'
includeInCheckLifecycle = false
}
}

sourceSets {
functionalTest {
groovy {
srcDir 'src/functionalTest/java'
}
compileClasspath += sourceSets.main.output + sourceSets.test.output
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
}
}

// Define the property to control Docker container execution
ext {
runDockerContainers = project.hasProperty('startCluster') ? Boolean.getBoolean('startCluster') : true
}

// Define dependencies
dependencies {
/*******************************
* Compile Dependencies
Expand All @@ -41,10 +38,6 @@ dependencies {
api("org.springframework:spring-aspects")
api("com.h2database:h2")

/*******************************
* Provided Dependencies
*******************************/

/*******************************
* Runtime Dependencies
*******************************/
Expand All @@ -59,18 +52,18 @@ dependencies {
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'com.vaadin.external.google', module: 'android-json'
}

testImplementation 'org.postgresql:postgresql'

}

// Configure the test task
test {
useJUnitPlatform {
}
systemProperty 'spring.profiles.active', 'polaristest'
}

// Define tasks for starting and stopping CRDB cluster
task startCrdbCluster(type: Exec) {
commandLine '/bin/echo', project.file('src/functionalTest/scripts/start_docker_containers.sh')
commandLine 'sh',
project.file('src/functionalTest/scripts/start_docker_containers.sh'),
project.file('src/functionalTest/scripts/docker-compose.yml')
Expand All @@ -82,12 +75,52 @@ task stopCrdbCluster(type: Exec) {
project.file('src/functionalTest/scripts/docker-compose.yml')
}

functionalTest {
// Define tasks for starting and stopping Aurora cluster
task startAuroraCluster(type: Exec) {
commandLine 'sh',
project.file('src/functionalTest/scripts/start_docker_containers.sh'),
project.file('src/functionalTest/scripts/docker-compose-aurora.yml')
}

task stopAuroraCluster(type: Exec) {
commandLine 'sh',
project.file('src/functionalTest/scripts/stop_docker_containers.sh'),
project.file('src/functionalTest/scripts/docker-compose-aurora.yml')
}

// Define functionalTestCRDB task
task functionalTestCRDB(type: Test) {
outputs.upToDateWhen { false }

testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath

if (project.ext.runDockerContainers) {
useJUnitPlatform {
}
dependsOn 'startCrdbCluster'
finalizedBy 'stopCrdbCluster'
}
systemProperty 'spring.profiles.active', 'polaris_functional_test'
systemProperty 'service.auroraDataSourceEnabled', 'false'
}

// Define functionalTestAurora task
task functionalTestAurora(type: Test) {
outputs.upToDateWhen { false }

testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath

if (project.ext.runDockerContainers) {
useJUnitPlatform {
}
dependsOn 'startAuroraCluster'
finalizedBy 'stopAuroraCluster'
}
systemProperty 'spring.profiles.active', 'polaris_functional_aurora_test'
systemProperty 'service.auroraDataSourceEnabled', 'true'
}

// Disable SpotBugs for tests
spotbugsTest.enabled = false
Loading
Loading