Skip to content

Commit

Permalink
Merge branch 'postgresql-dialect' into fix-split-statement
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite authored May 23, 2022
2 parents bfc7818 + 7d0aef6 commit 2e5bdbc
Show file tree
Hide file tree
Showing 21 changed files with 739 additions and 151 deletions.
17 changes: 2 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ jobs:
go-version: '^1.17.7'
- run: go version
- run: .ci/run-with-credentials.sh units
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- uses: actions/setup-go@v2
with:
go-version: '^1.17.7'
- run: go version
- run: .ci/run-with-credentials.sh integration
lint:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -160,7 +147,7 @@ jobs:
runs-on: ubuntu-latest
# Only releases on the postgresql-dialect branch
if: github.head_ref == 'postgresql-dialect'
needs: [ units, lint, clirr, integration, e2e-psql-v11, e2e-psql-v12, e2e-psql-v13 ]
needs: [ units, lint, clirr, e2e-psql-v11, e2e-psql-v12, e2e-psql-v13 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
Expand All @@ -180,7 +167,7 @@ jobs:
runs-on: ubuntu-latest
# Only releases on the postgresql-dialect branch
if: github.head_ref == 'postgresql-dialect'
needs: [ units, lint, clirr, integration, e2e-psql-v11, e2e-psql-v12, e2e-psql-v13 ]
needs: [ units, lint, clirr, e2e-psql-v11, e2e-psql-v12, e2e-psql-v13 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
on:
pull_request:
name: integration
env:
GOOGLE_CLOUD_PROJECT: "span-cloud-testing"
GOOGLE_CLOUD_INSTANCE: "pgadapter-testing"
GOOGLE_CLOUD_DATABASE: "testdb_integration"
GOOGLE_CLOUD_ENDPOINT: "spanner.googleapis.com"
jobs:
check-env:
outputs:
has-key: ${{ steps.project-id.outputs.defined }}
runs-on: ubuntu-latest
steps:
- id: project-id
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
if: "${{ env.GCP_PROJECT_ID != '' }}"
run: echo "::set-output name=defined::true"

test:
needs: [check-env]
if: needs.check-env.outputs.has-key == 'true'
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 8
- run: java -version
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.17.7'
- run: go version
- name: Run unit tests
run: mvn test -B -Ptest-all
- name: Setup GCloud
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.JSON_SERVICE_ACCOUNT_CREDENTIALS }}
export_default_credentials: true
- name: Run integration tests
run: mvn verify -B -Dclirr.skip=true -DskipITs=false -DPG_ADAPTER_HOST="https://$GOOGLE_CLOUD_ENDPOINT" -DPG_ADAPTER_INSTANCE="$GOOGLE_CLOUD_INSTANCE" -DPG_ADAPTER_DATABASE="$GOOGLE_CLOUD_DATABASE"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
directory: ./target/site/jacoco-merged-test-coverage-report
fail_ci_if_error: true
flags: all_tests
name: codecov-umbrella
path_to_write_report: ./coverage/codecov_report.txt
verbose: true
9 changes: 0 additions & 9 deletions .github/workflows/units.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ jobs:
go-version: '^1.17.7'
- run: go version
- run: mvn -B test -Ptest-all
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
directory: ./target/site/jacoco
fail_ci_if_error: true
flags: unittests
name: codecov-umbrella
path_to_write_report: ./coverage/codecov_report.txt
verbose: true
windows:
runs-on: windows-latest
strategy:
Expand Down
79 changes: 76 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<excludedTests>com.google.cloud.spanner.pgadapter.IntegrationTest,com.google.cloud.spanner.pgadapter.golang.GolangTest</excludedTests>

<spanner.version>6.24.0</spanner.version>
<spanner.version>6.25.0</spanner.version>
</properties>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -71,6 +71,17 @@
<artifactId>postgresql</artifactId>
<version>42.3.4</version>
</dependency>
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
<artifactId>junixsocket-core</artifactId>
<version>2.4.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
<artifactId>junixsocket-common</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
Expand Down Expand Up @@ -103,7 +114,7 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<version>2.16.0</version>
<version>2.18.1</version>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -286,6 +297,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<argLine>${surefire.jacoco.args}</argLine>
<excludedGroups>${excludedTests}</excludedGroups>
<reportNameSuffix>sponge_log</reportNameSuffix>
<systemProperties>
Expand All @@ -305,13 +317,73 @@
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-output/jacoco-unit-tests.exec</destFile>
<propertyName>surefire.jacoco.args</propertyName>
</configuration>
</execution>
<execution>
<id>report</id>
<id>after-unit-test-execution</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-output/jacoco-unit-tests.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-unit-test-coverage-report</outputDirectory>
</configuration>
</execution>

<execution>
<id>before-integration-test-execution</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-output/jacoco-integration-tests.exec</destFile>
<propertyName>failsafe.jacoco.args</propertyName>
</configuration>
</execution>
<execution>
<id>after-integration-test-execution</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-output/jacoco-integration-tests.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-integration-test-coverage-report</outputDirectory>
</configuration>
</execution>
<execution>
<id>merge-unit-and-integration</id>
<phase>post-integration-test</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<directory>${project.build.directory}/jacoco-output/</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
</fileSets>
<destFile>${project.build.directory}/jacoco-output/merged.exec</destFile>
</configuration>
</execution>
<execution>
<id>create-merged-report</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-output/merged.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-merged-test-coverage-report</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
Expand All @@ -333,6 +405,7 @@
</execution>
</executions>
<configuration>
<argLine>${failsafe.jacoco.args}</argLine>
<skipITs>${skipITs}</skipITs>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,21 @@ public void handleTerminate() {
* Terminates this connection at the request of the server. This is called if the server is
* shutting down while the connection is still active.
*/
void terminate() throws IOException {
void terminate() {
if (this.status != ConnectionStatus.TERMINATED) {
handleTerminate();
}
if (!socket.isClosed()) {
socket.close();
try {
if (!socket.isClosed()) {
socket.close();
}
} catch (IOException exception) {
logger.log(
Level.WARNING,
exception,
() ->
String.format(
"Failed to close connection handler with ID %s: %s", getName(), exception));
}
}
}

Expand Down
Loading

0 comments on commit 2e5bdbc

Please sign in to comment.