diff --git a/.github/workflows/jdbc-driver.yaml b/.github/workflows/jdbc-driver.yaml new file mode 100644 index 000000000..72f9abf42 --- /dev/null +++ b/.github/workflows/jdbc-driver.yaml @@ -0,0 +1,32 @@ +name: JDBC Driver Tests + +on: + push: + branches: [ "PG12" ] + + pull_request: + branches: [ "PG12" ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + distributions: ['zulu', 'temurin', 'microsoft'] + + defaults: + run: + working-directory: drivers/jdbc + + steps: + - uses: actions/checkout@v3 + + - name: Set up Java + uses: actions/setup-java@v3 + with: + distribution: ${{ matrix.distributions }} + java-version: '17' + + - name: Build and Test + run: gradle build \ No newline at end of file diff --git a/.github/workflows/nodejs-driver.yaml b/.github/workflows/nodejs-driver.yaml new file mode 100644 index 000000000..94134facc --- /dev/null +++ b/.github/workflows/nodejs-driver.yaml @@ -0,0 +1,36 @@ +name: Nodejs Driver Tests + +on: + push: + branches: [ "PG12" ] + + pull_request: + branches: [ "PG12" ] + +jobs: + build: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: drivers/nodejs/ + + steps: + - uses: actions/checkout@v3 + + - name: Run apache/age docker image + run: docker-compose up -d + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: latest + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Test + run: npm test \ No newline at end of file diff --git a/drivers/docker-compose.yml b/drivers/docker-compose.yml index 668eb19d3..3bcbb3542 100644 --- a/drivers/docker-compose.yml +++ b/drivers/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.3" services: db: - image: apache/age + image: apache/age:PG12_latest environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=agens diff --git a/drivers/jdbc/lib/build.gradle.kts b/drivers/jdbc/lib/build.gradle.kts index 86af61ac8..f363cfe2c 100644 --- a/drivers/jdbc/lib/build.gradle.kts +++ b/drivers/jdbc/lib/build.gradle.kts @@ -17,6 +17,9 @@ * under the License. */ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.gradle.api.tasks.testing.logging.TestLogEvent + plugins { `java-library` antlr @@ -36,6 +39,9 @@ dependencies { testImplementation("org.testcontainers:testcontainers:1.15.3") testImplementation("org.postgresql:postgresql:42.2.20") + + testImplementation("org.slf4j:slf4j-api:1.7.5") + testImplementation("org.slf4j:slf4j-simple:1.7.5") } tasks.generateGrammarSource { @@ -50,5 +56,16 @@ tasks.generateGrammarSource { } tasks.test { - useJUnitPlatform() -} + useJUnitPlatform(); + testLogging { + // set options for log level LIFECYCLE + events(TestLogEvent.FAILED, + TestLogEvent.PASSED, + TestLogEvent.SKIPPED, + TestLogEvent.STANDARD_OUT) + exceptionFormat = TestExceptionFormat.FULL + showExceptions = true + showCauses = true + showStackTraces = true + } +} \ No newline at end of file diff --git a/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java b/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java index 8024f1a89..54f2b6491 100644 --- a/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java +++ b/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java @@ -51,7 +51,7 @@ public void afterAll() throws Exception { public void beforeAll() throws Exception { String CORRECT_DB_PASSWORDS = "postgres"; agensGraphContainer = new GenericContainer<>(DockerImageName - .parse("sorrell/agensgraph-extension-alpine:latest")) + .parse("apache/age:PG12_latest")) .withEnv("POSTGRES_PASSWORD", CORRECT_DB_PASSWORDS) .withExposedPorts(5432); agensGraphContainer.start(); diff --git a/drivers/nodejs/package.json b/drivers/nodejs/package.json index db385eefb..9f88bc2ba 100644 --- a/drivers/nodejs/package.json +++ b/drivers/nodejs/package.json @@ -1,23 +1,22 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - { + "//": [ + "Licensed to the Apache Software Foundation (ASF) under one", + "or more contributor license agreements. See the NOTICE file", + "distributed with this work for additional information", + "regarding copyright ownership. The ASF licenses this file", + "to you 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." + ], "name": "pg-age", "version": "1.0.0-alpha", "main": "dist/index.js", diff --git a/drivers/nodejs/test/index.test.ts b/drivers/nodejs/test/index.test.ts index 60f9e2fef..ea386ddaa 100644 --- a/drivers/nodejs/test/index.test.ts +++ b/drivers/nodejs/test/index.test.ts @@ -24,8 +24,8 @@ const config = { user: 'postgres', host: '127.0.0.1', database: 'postgres', - password: 'postgres', - port: 25432 + password: 'agens', + port: 5432 } const testGraphName = 'age-test' @@ -59,25 +59,44 @@ describe('Pre-connected Connection', () => { $$) as (a agtype); `)! expect(results.rows).toStrictEqual( - [{ - a: { - id: 844424930131969, - label: 'Part', - properties: { part_num: '123' } + [ + { + a : new Map(Object.entries({ + id: 844424930131969, + label: 'Part', + properties: new Map(Object.entries({ + part_num: '123' + })) + })), + }, + { + a : new Map(Object.entries({ + id: 844424930131970, + label: 'Part', + properties: new Map(Object.entries({ + part_num: '345' + })) + })), + }, + { + a : new Map(Object.entries({ + id: 844424930131971, + label: 'Part', + properties: new Map(Object.entries({ + part_num: '456' + })) + })), + }, + { + a : new Map(Object.entries({ + id: 844424930131972, + label: 'Part', + properties: new Map(Object.entries({ + part_num: '789' + })) + })), } - }, { - a: { - id: 844424930131970, - label: 'Part', - properties: { part_num: '345' } - } - }, { - a: { - id: 844424930131971, - label: 'Part', - properties: { part_num: '456' } - } - }, { a: { id: 844424930131972, label: 'Part', properties: { part_num: '789' } } }] + ] ) }) })