Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional testcontainer migrations #551

Closed
wants to merge 5 commits into from
Closed
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
46 changes: 0 additions & 46 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,6 @@ jobs:
runs-on: ubuntu-latest

services:
sqlserver:
image: exoplatform/sqlserver:2017-CU8
env:
SA_PASSWORD: 5F4Dt9ky9dU$
SQLSERVER_DATABASE: sc
SQLSERVER_USER: user
SQLSERVER_PASSWORD: 5F4Dt9ky9dU$
ports:
- 1433:1433
postgres:
image: postgres:12.1
env:
POSTGRES_PASSWORD: 5F4Dt9ky9dU$
ports:
- 5432:5432
mysql:
image: mysql:8.0.19
env:
MYSQL_ROOT_PASSWORD: 5F4Dt9ky9dU$
MYSQL_DATABASE: sc
ports:
- 3306:3306
elasticsearch:
image: paulcwarren/elasticsearch:7.6.2
env:
Expand All @@ -48,12 +26,6 @@ jobs:
image: paulcwarren/solr
ports:
- 8983:8983
mongo:
image: mongo:3.6.12
env:
MONGO_INITDB_DATABASE: spring-content
ports:
- 27017:27017

steps:
- uses: actions/checkout@v2
Expand All @@ -74,28 +46,10 @@ jobs:
mvn -B -P tests -Dmaven.javadoc.skip=true install jacoco:report --file pom.xml
bash <(curl -s https://codecov.io/bash)
env:
SQLSERVER_USERNAME: "sa"
SQLSERVER_PASSWORD: "5F4Dt9ky9dU$"
SQLSERVER_DB_NAME: "sc"
SQLSERVER_HOST: "localhost"
POSTGRESQL_USERNAME: "postgres"
POSTGRESQL_PASSWORD: "5F4Dt9ky9dU$"
POSTGRESQL_URL: "jdbc:postgresql://localhost:5432/postgres?sslmode=disable"
MYSQL_USERNAME: "root"
MYSQL_PASSWORD: "5F4Dt9ky9dU$"
MYSQL_URL: "jdbc:mysql://localhost:3306/sc?emulateLocators=true&serverTimezone=UTC"
MONGODB_URL: "mongodb://localhost:27017/spring-content?retryWrites=false"
SOLR_USER: "solr"
SOLR_PASSWORD: "SolrRocks"
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_BUCKET: ${{secrets.AWS_BUCKET}}
AWS_REGION: ${{secrets.AWS_REGION}}
AWS_SECRET_KEY: ${{secrets.AWS_SECRET_KEY}}
GCP_STORAGE_BUCKET: ${{secrets.GCP_STORAGE_BUCKET}}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
AZURE_STORAGE_BUCKET: ${{ secrets.AZURE_STORAGE_BUCKET }}
AZURE_STORAGE_ENDPOINT: ${{ secrets.AZURE_STORAGE_ENDPOINT }}
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}

- name: Publish JARs
run: |
Expand Down
81 changes: 1 addition & 80 deletions .github/workflows/prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,6 @@ jobs:
runs-on: ubuntu-latest

services:
sqlserver:
image: exoplatform/sqlserver:2017-CU8
env:
SA_PASSWORD: 5F4Dt9ky9dU$
SQLSERVER_DATABASE: sc
SQLSERVER_USER: user
SQLSERVER_PASSWORD: 5F4Dt9ky9dU$
ports:
- 1433:1433
postgres:
image: postgres:12.1
env:
POSTGRES_PASSWORD: 5F4Dt9ky9dU$
ports:
- 5432:5432
mysql:
image: mysql:8.0.19
env:
MYSQL_ROOT_PASSWORD: 5F4Dt9ky9dU$
MYSQL_DATABASE: sc
ports:
- 3306:3306
elasticsearch:
image: paulcwarren/elasticsearch:7.6.2
env:
Expand All @@ -43,13 +21,7 @@ jobs:
solr:
image: paulcwarren/solr
ports:
- 8983:8983
mongo:
image: mongo:3.6.12
env:
MONGO_INITDB_DATABASE: spring-content
ports:
- 27017:27017
- 8983:8983

steps:
- uses: google-github-actions/setup-gcloud@master
Expand Down Expand Up @@ -85,78 +57,27 @@ jobs:
mvn -B -P tests -Dmaven.javadoc.skip=true install --file pom.xml
popd
env:
SQLSERVER_USERNAME: "sa"
SQLSERVER_PASSWORD: "5F4Dt9ky9dU$"
SQLSERVER_DB_NAME: "sc"
SQLSERVER_HOST: "localhost"
POSTGRESQL_USERNAME: "postgres"
POSTGRESQL_PASSWORD: "5F4Dt9ky9dU$"
POSTGRESQL_URL: "jdbc:postgresql://localhost:5432/postgres?sslmode=disable"
MYSQL_USERNAME: "root"
MYSQL_PASSWORD: "5F4Dt9ky9dU$"
MYSQL_URL: "jdbc:mysql://localhost:3306/sc?emulateLocators=true&serverTimezone=UTC"
MONGODB_URL: "mongodb://localhost:27017/spring-content?retryWrites=false"
SOLR_USER: "solr"
SOLR_PASSWORD: "SolrRocks"
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_BUCKET: ${{secrets.AWS_BUCKET}}
AWS_REGION: ${{secrets.AWS_REGION}}
AWS_SECRET_KEY: ${{secrets.AWS_SECRET_KEY}}
GCP_STORAGE_BUCKET: ${{secrets.GCP_STORAGE_BUCKET}}
GOOGLE_APPLICATION_CREDENTIALS: ${{env.GOOGLE_APPLICATION_CREDENTIALS}}
AZURE_STORAGE_BUCKET: ${{ secrets.AZURE_STORAGE_BUCKET }}
AZURE_STORAGE_ENDPOINT: ${{ secrets.AZURE_STORAGE_ENDPOINT }}
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}

- name: Validate examples
run: |
pushd spring-content-examples
mvn -B clean install
popd
env:
SQLSERVER_USERNAME: "sa"
SQLSERVER_PASSWORD: "5F4Dt9ky9dU$"
SQLSERVER_DB_NAME: "sc"
SQLSERVER_HOST: "localhost"
POSTGRESQL_USERNAME: "postgres"
POSTGRESQL_PASSWORD: "5F4Dt9ky9dU$"
POSTGRESQL_URL: "jdbc:postgresql://localhost:5432/postgres?sslmode=disable"
MYSQL_USERNAME: "root"
MYSQL_PASSWORD: "5F4Dt9ky9dU$"
MYSQL_URL: "jdbc:mysql://localhost:3306/sc?emulateLocators=true&serverTimezone=UTC"
MONGODB_URL: "mongodb://localhost:27017/spring-content?retryWrites=false"
SOLR_USER: "solr"
SOLR_PASSWORD: "SolrRocks"
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_BUCKET: ${{secrets.AWS_BUCKET}}
AWS_REGION: ${{secrets.AWS_REGION}}
AWS_SECRET_KEY: ${{secrets.AWS_SECRET_KEY}}
GCP_STORAGE_BUCKET: ${{secrets.GCP_STORAGE_BUCKET}}
GOOGLE_APPLICATION_CREDENTIALS: ${{env.GOOGLE_APPLICATION_CREDENTIALS}}
AZURE_STORAGE_BUCKET: ${{ secrets.AZURE_STORAGE_BUCKET }}
AZURE_STORAGE_ENDPOINT: ${{ secrets.AZURE_STORAGE_ENDPOINT }}
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}

- name: Validate gettingstarteds
run: |
pushd spring-content-gettingstarted
mvn -B clean install
popd
env:
SQLSERVER_USERNAME: "sa"
SQLSERVER_PASSWORD: "5F4Dt9ky9dU$"
SQLSERVER_DB_NAME: "sc"
SQLSERVER_HOST: "localhost"
POSTGRESQL_USERNAME: "postgres"
POSTGRESQL_PASSWORD: "5F4Dt9ky9dU$"
POSTGRESQL_URL: "jdbc:postgresql://localhost:5432/postgres?sslmode=disable"
MYSQL_USERNAME: "root"
MYSQL_PASSWORD: "5F4Dt9ky9dU$"
MYSQL_URL: "jdbc:mysql://localhost:3306/sc?emulateLocators=true&serverTimezone=UTC"
MONGODB_URL: "mongodb://localhost:27017/spring-content?retryWrites=false"
SOLR_USER: "solr"
SOLR_PASSWORD: "SolrRocks"
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_BUCKET: ${{secrets.AWS_BUCKET}}
AWS_REGION: ${{secrets.AWS_REGION}}
AWS_SECRET_KEY: ${{secrets.AWS_SECRET_KEY}}
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Integrates with Spring Data, Spring Data REST and Apache Solr</description>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<docs.output.dir>../target/generated-docs/refs/${env.BUILD_TYPE}/</docs.output.dir>

<test-containers.version>1.15.3</test-containers.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -79,6 +81,11 @@ Integrates with Spring Data, Spring Data REST and Apache Solr</description>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${test-containers.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@
@RunWith(Ginkgo4jRunner.class)
public class EnableAzureStorageTest {

private static BlobServiceClientBuilder builder = Azurite.getBlobServiceClientBuilder();
private static BlobContainerClient client = null;
private static final BlobServiceClientBuilder builder = Azurite.getBlobServiceClientBuilder();
private static final BlobContainerClient client = builder.buildClient().getBlobContainerClient("test");

static {
client = builder.buildClient().getBlobContainerClient("test");
if (!client.exists()) {
client.create();
}
Expand All @@ -55,7 +54,6 @@ public class EnableAzureStorageTest {

// mocks
static AzureStorageConfigurer configurer;
static BlobServiceClientBuilder storage;

{
Describe("EnableAzureStorage", () -> {
Expand Down Expand Up @@ -171,16 +169,10 @@ public interface TestEntityStore extends AssociativeStore<TestEntity, BlobId> {

@Configuration
public static class InfrastructureConfig {

@Bean
public BlobServiceClientBuilder builder() {
return builder;
}

@Bean
public BlobContainerClient blobContainerClient() {
return client;
}
}

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@
@Ginkgo4jConfiguration(threads=1)
public class AzureStorageIT {

private static final BlobServiceClientBuilder builder = Azurite.getBlobServiceClientBuilder();
private static final BlobContainerClient client = builder.buildClient().getBlobContainerClient("test");

static {
if (!client.exists()) {
client.create();
}

System.setProperty("spring.content.azure.bucket", "azure-test-bucket");
}

Expand All @@ -79,7 +86,6 @@ public class AzureStorageIT {

private TestEntityRepository repo;
private TestEntityStore store;
private BlobContainerClient client;

private String resourceLocation;

Expand All @@ -93,7 +99,6 @@ public class AzureStorageIT {

repo = context.getBean(TestEntityRepository.class);
store = context.getBean(TestEntityStore.class);
client = context.getBean(BlobContainerClient.class);

RandomString random = new RandomString(5);
resourceLocation = random.nextString();
Expand Down Expand Up @@ -362,17 +367,7 @@ public void test() {
public static class TestConfig {
@Bean
public BlobServiceClientBuilder blobServiceClientBuilder() {
return Azurite.getBlobServiceClientBuilder();
}

@Bean
public BlobContainerClient blobContainerClient(BlobServiceClientBuilder builder) {
BlobContainerClient client = builder.buildClient().getBlobContainerClient("test");
// No pre-defined containers at start-up, create it on first bean generation
if (!client.exists()) {
client.create();
}
return client;
return builder;
}
}

Expand Down
20 changes: 19 additions & 1 deletion spring-content-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,25 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>oracle-xe</artifactId>
<version>1.15.3</version>
<version>${test-containers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<version>${test-containers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>${test-containers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mssqlserver</artifactId>
<version>${test-containers.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Loading