This is an automated email from the ASF dual-hosted git repository. xiazcy pushed a commit to branch 3.5-dev in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/3.5-dev by this push: new 33b60d9e34 Dev Environments: Dockerize Testing for JavaScript and .NET & Updates for Go (#1788) 33b60d9e34 is described below commit 33b60d9e34493bc04b7df45d0bd2c35080146238 Author: Yang Xia <55853655+xia...@users.noreply.github.com> AuthorDate: Mon Sep 12 15:29:48 2022 -0700 Dev Environments: Dockerize Testing for JavaScript and .NET & Updates for Go (#1788) Dockerize test environment for js and .net drivers. Docker compose is now used to set up server and running all tests for js, .net and go. Co-authored-by: Simon Zhao <42222408+simonz...@users.noreply.github.com> Co-authored-by: Simon Zhao <sim...@bitquilltech.com> Co-authored-by: Valentyn Kahamlyk <vkagam...@users.noreply.github.com> --- .github/workflows/build-test.yml | 98 ++++- docker/gremlin-server/docker-entrypoint.sh | 9 +- .../gremlin-server-integration-secure.yaml | 7 + .../gremlin-server/gremlin-server-integration.yaml | 14 +- .../gremlin-test-server}/Dockerfile | 15 +- .../gremlin-test-server}/wait-for-server.sh | 0 {gremlin-go => gremlin-dotnet}/docker-compose.yml | 47 ++- .../Gremlin.Net.IntegrationTest/ConfigProvider.cs | 11 +- .../Gremlin.Net.IntegrationTest/appsettings.json | 3 +- .../Gremlin.Net.Template.IntegrationTest.csproj | 9 +- .../ServiceTests.cs | 6 +- .../appsettings.json | 3 +- gremlin-dotnet/test/pom.xml | 315 ++++---------- gremlin-go/docker-compose.yml | 31 +- gremlin-go/docker/docker-entrypoint.sh | 43 -- gremlin-go/docker/generate-all.groovy | 79 ---- .../docker/gremlin-server-integration-secure.yaml | 76 ---- gremlin-go/docker/gremlin-server-integration.yaml | 68 ---- gremlin-go/pom.xml | 24 +- gremlin-go/run.sh | 8 +- gremlin-javascript/pom.xml | 451 +++++---------------- .../gremlin-javascript}/docker-compose.yml | 50 +-- .../javascript/gremlin-javascript/package.json | 3 + .../javascript/gremlin-javascript/test/helper.js | 11 +- .../test/integration/sasl-authentication-tests.js | 7 +- gremlin-server/conf/tinkergraph-service.properties | 20 + gremlin-server/pom.xml | 18 + .../src/test/scripts/generate-all.groovy | 5 + 28 files changed, 489 insertions(+), 942 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index a7df2c999e..c05d9e9eab 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -78,6 +78,39 @@ jobs: run: | mvn clean install -pl -:gremlin-javascript,-:gremlin-python,-gremlin-dotnet,-:gremlin-dotnet-source,-:gremlin-dotnet-tests,-:gremlint -q -DskipTests -Dci mvn verify -pl :gremlin-server -DskipTests -DskipIntegrationTests=false -DincludeNeo4j -DtestUnified=true + cache-gremlin-server-docker-image: + name: cache gremlin-server docker image + timeout-minutes: 10 + needs: smoke + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + - name: Generate Gremlin Server Base + working-directory: . + run: | + mvn clean install -pl gremlin-server -DskipTests -DskipIntegrationTests=true -Dci -am + - name: Save Docker image + working-directory: ./gremlin-server + run: docker save --output gremlin-server.tar tinkerpop/gremlin-server + - uses: actions/cache@v3 + id: gremlin-server-test-docker-image + with: + path: | + ./gremlin-server/* + ~/.m2/repository/org/apache/tinkerpop/* + key: ${{ github.sha }} + # Disabled until Linux containers are supported on Windows runners: https://github.com/actions/virtual-environments/issues/252 +# - name: Upload Docker image for Windows +# uses: actions/upload-artifact@v3 +# with: +# name: ${{ github.sha }} +# path: ./gremlin-server/gremlin-server.tar +# retention-days: 1 spark-core: name: spark core timeout-minutes: 45 @@ -145,11 +178,13 @@ jobs: javascript: name: javascript timeout-minutes: 15 - needs: smoke + needs: cache-gremlin-server-docker-image runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest] + # Windows Disabled until Linux containers are supported on Windows runners: https://github.com/actions/virtual-environments/issues/252 + # os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest] steps: - uses: actions/checkout@v3 - name: Set up JDK 11 @@ -157,10 +192,29 @@ jobs: with: java-version: '11' distribution: 'temurin' + - name: Get Cached Server Base Image + if: matrix.os == 'ubuntu-latest' + uses: actions/cache@v3 + id: gremlin-server-test-docker-image + with: + path: | + ./gremlin-server/* + ~/.m2/repository/org/apache/tinkerpop/* + key: ${{ github.sha }} +# - name: Download Server Base Image +# if: matrix.os == 'windows-latest' +# uses: actions/download-artifact@v3 +# with: +# name: ${{ github.sha }} +# path: ./gremlin-server + - name: Load Docker Image + working-directory: ./gremlin-server + run: docker load --input gremlin-server.tar - name: Build with Maven run: | + touch gremlin-javascript/.glv mvn clean install -pl -:gremlin-python,-gremlin-dotnet,-:gremlin-dotnet-source,-:gremlin-dotnet-tests -q -DskipTests -Dci - mvn verify -pl :gremlin-javascript,:gremlint -DincludeNeo4j + mvn verify -pl :gremlin-javascript,:gremlint python: name: python timeout-minutes: 20 @@ -190,11 +244,8 @@ jobs: dotnet: name: .NET timeout-minutes: 20 - needs: smoke - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest] + needs: cache-gremlin-server-docker-image + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up JDK11 @@ -206,12 +257,23 @@ jobs: uses: actions/setup-dotnet@v2 with: dotnet-version: '6.0.x' + - name: Get Cached Server Base Image + uses: actions/cache@v3 + id: gremlin-server-test-docker-image + with: + path: | + ./gremlin-server/* + ~/.m2/repository/org/apache/tinkerpop/* + key: ${{ github.sha }} + - name: Load Docker Image + working-directory: ./gremlin-server + run: docker load --input gremlin-server.tar - name: Build with Maven run: | touch gremlin-dotnet/src/.glv touch gremlin-dotnet/test/.glv mvn clean install -pl -:gremlin-javascript,-:gremlin-python,-:gremlint -q -DskipTests -Dci - mvn verify -pl :gremlin-dotnet,:gremlin-dotnet-tests -P gremlin-dotnet -DincludeNeo4j + mvn verify -pl :gremlin-dotnet,:gremlin-dotnet-tests -P gremlin-dotnet neo4j-gremlin: name: neo4j-gremlin timeout-minutes: 20 @@ -231,7 +293,7 @@ jobs: go: name: go timeout-minutes: 20 - needs: smoke + needs: cache-gremlin-server-docker-image runs-on: ubuntu-latest steps: - name: Checkout @@ -240,14 +302,22 @@ jobs: uses: actions/setup-go@v3 with: go-version: '1.17' - - name: Generate Gremlin Server Base Image - working-directory: . - run: | - mvn clean install -pl gremlin-server -DskipTests -DskipIntegrationTests=true -Dci -am + - name: Get Cached Server Base Image + uses: actions/cache@v3 + id: gremlin-server-test-docker-image + with: + path: | + ./gremlin-server/* + ~/.m2/repository/org/apache/tinkerpop/* + key: ${{ github.sha }} + - name: Load Docker Image + working-directory: ./gremlin-server + run: docker load --input gremlin-server.tar - name: Build with Maven working-directory: . run: | touch gremlin-go/.glv + mvn clean install -pl -:gremlin-python,-:gremlin-javascript,-:gremlin-dotnet,-:gremlin-dotnet-source,-:gremlin-dotnet-tests -q -DskipTests -Dci mvn verify -pl :gremlin-go - name: Upload to Codecov uses: codecov/codecov-action@v3 diff --git a/docker/gremlin-server/docker-entrypoint.sh b/docker/gremlin-server/docker-entrypoint.sh index 775daa5c17..51290265ca 100644 --- a/docker/gremlin-server/docker-entrypoint.sh +++ b/docker/gremlin-server/docker-entrypoint.sh @@ -62,6 +62,9 @@ cp *.yaml ${TINKERPOP_HOME}/conf/ java -version +dos2unix /opt/gremlin-server/bin/gremlin-server.sh +dos2unix /opt/gremlin-server/bin/gremlin-server.conf + # dynamically installs Neo4j libraries so that we can test variants with transactions, # but only only port 45940 is configured with the neo4j graph as the neo4j-empty.properties # is statically pointing at a temp directory and that space can only be accessed by one @@ -71,16 +74,16 @@ if [ ! -z "${INCLUDE_NEO4J}" ]; then /opt/gremlin-server/bin/gremlin-server.sh install org.apache.tinkerpop neo4j-gremlin ${GREMLIN_SERVER_VERSION} fi -/opt/gremlin-server/bin/gremlin-server.sh conf/gremlin-server-integration.yaml & +/opt/gremlin-server/bin/gremlin-server.sh ${TINKERPOP_HOME}/conf/gremlin-server-integration.yaml & -/opt/gremlin-server/bin/gremlin-server.sh conf/gremlin-server-integration-secure.yaml & +/opt/gremlin-server/bin/gremlin-server.sh ${TINKERPOP_HOME}/conf/gremlin-server-integration-secure.yaml & java -cp /opt/gremlin-test/gremlin-test-${GREMLIN_SERVER_VERSION}-jar-with-dependencies.jar \ -Dlog4j.configuration="file:/opt/gremlin-server/conf/log4j-server.properties" \ org.apache.tinkerpop.gremlin.server.KdcFixture /opt/gremlin-server & export JAVA_OPTIONS="-Xms512m -Xmx4096m -Djava.security.krb5.conf=/opt/gremlin-server/target/kdc/krb5.conf" -exec /opt/gremlin-server/bin/gremlin-server.sh conf/gremlin-server-integration-krb5.yaml +/opt/gremlin-server/bin/gremlin-server.sh ${TINKERPOP_HOME}/conf/gremlin-server-integration-krb5.yaml ####################################################################### diff --git a/docker/gremlin-server/gremlin-server-integration-secure.yaml b/docker/gremlin-server/gremlin-server-integration-secure.yaml index 4d808411f5..15b1b3e647 100644 --- a/docker/gremlin-server/gremlin-server-integration-secure.yaml +++ b/docker/gremlin-server/gremlin-server-integration-secure.yaml @@ -65,3 +65,10 @@ authentication: { authenticator: org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator, config: { credentialsDb: conf/tinkergraph-credentials.properties}} +ssl: { + enabled: true, + sslEnabledProtocols: [TLSv1.2], + # You must configure a keyStore! + keyStore: /opt/test/resources/server-key.jks, + keyStorePassword: changeit +} diff --git a/docker/gremlin-server/gremlin-server-integration.yaml b/docker/gremlin-server/gremlin-server-integration.yaml index 35c515969f..be33ee90d3 100644 --- a/docker/gremlin-server/gremlin-server-integration.yaml +++ b/docker/gremlin-server/gremlin-server-integration.yaml @@ -18,13 +18,15 @@ host: 0.0.0.0 port: 45940 evaluationTimeout: 30000 +channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer graphs: { - graph: conf/tinkergraph-empty.properties, - classic: conf/tinkergraph-empty.properties, - modern: conf/tinkergraph-empty.properties, - crew: conf/tinkergraph-empty.properties, - grateful: conf/tinkergraph-empty.properties, - sink: conf/tinkergraph-empty.properties + graph: conf/tinkergraph-service.properties, + immutable: conf/tinkergraph-service.properties, + classic: conf/tinkergraph-service.properties, + modern: conf/tinkergraph-service.properties, + crew: conf/tinkergraph-service.properties, + grateful: conf/tinkergraph-service.properties, + sink: conf/tinkergraph-service.properties } scriptEngines: { gremlin-lang : {}, diff --git a/gremlin-go/Dockerfile b/docker/gremlin-test-server/Dockerfile similarity index 74% rename from gremlin-go/Dockerfile rename to docker/gremlin-test-server/Dockerfile index 17911a5b2d..85956cbead 100644 --- a/gremlin-go/Dockerfile +++ b/docker/gremlin-test-server/Dockerfile @@ -18,25 +18,24 @@ ARG GREMLIN_SERVER FROM tinkerpop/gremlin-server:$GREMLIN_SERVER +LABEL maintainer="d...@tinkerpop.apache.org" + USER root RUN mkdir -p /opt WORKDIR /opt COPY gremlin-server/src/test /opt/test/ -COPY gremlin-go/docker/generate-all.groovy /opt/test/scripts/ -COPY gremlin-go/docker/docker-entrypoint.sh gremlin-go/docker/*.yaml /opt/ +COPY docker/gremlin-server/docker-entrypoint.sh docker/gremlin-server/*.yaml /opt/ RUN chmod 755 /opt/docker-entrypoint.sh # Installing dos2unix to avoid errors in running the entrypoint script on Windows machines where their # carriage return is \r\n instead of the \n needed for linux/unix containers RUN apk update && apk add dos2unix -RUN dos2unix /opt/docker-entrypoint.sh -RUN dos2unix /opt/gremlin-server/bin/gremlin-server.conf -RUN dos2unix /opt/gremlin-server/bin/gremlin-server.sh && apk del dos2unix +RUN dos2unix /opt/docker-entrypoint.sh /opt/gremlin-server/bin/gremlin-server.sh && apk del dos2unix ARG GREMLIN_SERVER -ENV GREMLIN_SERVER_VER=$GREMLIN_SERVER +ENV GREMLIN_SERVER_VERSION=$GREMLIN_SERVER -EXPOSE 45940 45941 +EXPOSE 45940-45942 4588 -ENTRYPOINT ["bash", "/opt/docker-entrypoint.sh"] +ENTRYPOINT ["/opt/docker-entrypoint.sh", "-n"] CMD [] diff --git a/gremlin-go/wait-for-server.sh b/docker/gremlin-test-server/wait-for-server.sh similarity index 100% rename from gremlin-go/wait-for-server.sh rename to docker/gremlin-test-server/wait-for-server.sh diff --git a/gremlin-go/docker-compose.yml b/gremlin-dotnet/docker-compose.yml similarity index 51% copy from gremlin-go/docker-compose.yml copy to gremlin-dotnet/docker-compose.yml index a02236950f..9da192dad5 100644 --- a/gremlin-go/docker-compose.yml +++ b/gremlin-dotnet/docker-compose.yml @@ -15,44 +15,47 @@ # specific language governing permissions and limitations # under the License. -version: "3.7" +version: "3.8" services: - gremlin-test-server: - container_name: gremlin-test-server - image: tinkerpop:gremlin-test-server-${GREMLIN_SERVER} + gremlin-server-test-dotnet: + container_name: gremlin-server-test-dotnet + image: tinkerpop/gremlin-server-test:${GREMLIN_SERVER} build: context: ../ - dockerfile: gremlin-go/Dockerfile + dockerfile: docker/gremlin-test-server/Dockerfile args: - GREMLIN_SERVER=${GREMLIN_SERVER} ports: - "45940:45940" - "45941:45941" + - "45942:45942" + - "4588:4588" volumes: - ${HOME}/.groovy:/root/.groovy - ${HOME}/.m2:/root/.m2 + - ${ABS_PROJECT_HOME}/gremlin-test/target:/opt/gremlin-test + healthcheck: + test: [ "CMD-SHELL", "apk add curl && curl -f http://localhost:45940?gremlin=100-1" ] + interval: 30s + timeout: 10s + retries: 30 + start_period: 30s - gremlin-go-integration-tests: - container_name: gremlin-go-integration-tests - image: golang:1.17 + gremlin-dotnet-integration-tests: + container_name: gremlin-dotnet-integration-tests + image: mcr.microsoft.com/dotnet/sdk:6.0 volumes: - - .:/go_app - - ../gremlin-test/features:/gremlin-test + - .:/gremlin-dotnet + - ../gremlin-test/features:/gremlin-test/features + - ../docker/gremlin-test-server:/gremlin-dotnet/gremlin-test-server environment: - - CUCUMBER_FEATURE_FOLDER=/gremlin-test - - GREMLIN_SERVER_URL=ws://gremlin-test-server:45940/gremlin - - GREMLIN_SERVER_BASIC_AUTH_URL=wss://gremlin-test-server:45941/gremlin - - RUN_INTEGRATION_TESTS=true - - RUN_INTEGRATION_WITH_ALIAS_TESTS=true - - RUN_BASIC_AUTH_INTEGRATION_TESTS=true + - DOCKER_ENVIRONMENT=true - TEST_TRANSACTIONS=true - working_dir: /go_app + working_dir: /gremlin-dotnet command: > - bash -c "apt-get update && apt-get install dos2unix && dos2unix ./wait-for-server.sh - && ./wait-for-server.sh gremlin-test-server 45940 300 - && go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest - && go test -v -json ./... -race -covermode=atomic -coverprofile=\"coverage.out\" -coverpkg=./... | gotestfmt" + bash -c "dotnet test ./Gremlin.Net.sln -c Release" depends_on: - - gremlin-test-server + gremlin-server-test-dotnet: + condition: service_healthy diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/ConfigProvider.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/ConfigProvider.cs index b7afe74e93..6b84584f12 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/ConfigProvider.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/ConfigProvider.cs @@ -21,6 +21,7 @@ #endregion +using System; using System.IO; using Microsoft.Extensions.Configuration; @@ -41,7 +42,13 @@ namespace Gremlin.Net.IntegrationTest var builder = new ConfigurationBuilder() .AddJsonFile(configFile, false, false); - return builder.Build(); + IConfiguration config = builder.Build(); + if (Convert.ToBoolean(Environment.GetEnvironmentVariable("DOCKER_ENVIRONMENT"))) + { + config["TestServerIpAddress"] = config["TestServerIpAddressDocker"]; + } + + return config; } } -} \ No newline at end of file +} diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json index 1adda9ac9b..5d095ff188 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json @@ -1,5 +1,6 @@ { "TestServerIpAddress": "localhost", + "TestServerIpAddressDocker": "gremlin-server-test-dotnet", "TestServerPort": 45940, "TestSecureServerPort": 45941 -} \ No newline at end of file +} diff --git a/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/Gremlin.Net.Template.IntegrationTest.csproj b/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/Gremlin.Net.Template.IntegrationTest.csproj index c3552d732b..81e4e02204 100644 --- a/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/Gremlin.Net.Template.IntegrationTest.csproj +++ b/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/Gremlin.Net.Template.IntegrationTest.csproj @@ -1,4 +1,4 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> @@ -12,6 +12,13 @@ <ItemGroup> <ProjectReference Include="..\..\src\Gremlin.Net.Template\Gremlin.Net.Template.csproj" /> + <ProjectReference Include="..\Gremlin.Net.IntegrationTest\Gremlin.Net.IntegrationTest.csproj" /> + </ItemGroup> + + <ItemGroup> + <None Update="appsettings.json"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> </ItemGroup> </Project> diff --git a/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/ServiceTests.cs b/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/ServiceTests.cs index 696b51d4c5..1faa0b8cc7 100644 --- a/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/ServiceTests.cs +++ b/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/ServiceTests.cs @@ -21,9 +21,11 @@ #endregion +using System; using System.Collections.Generic; using Gremlin.Net.Driver; using Gremlin.Net.Driver.Remote; +using Gremlin.Net.IntegrationTest; using Xunit; using static Gremlin.Net.Process.Traversal.AnonymousTraversalSource; @@ -32,8 +34,8 @@ namespace Gremlin.Net.Template.IntegrationTest { public class ServiceTests { - private const string TestHost = "localhost"; - private const int TestPort = 45940; + private static readonly string TestHost = ConfigProvider.Configuration["TestServerIpAddress"]; + private static readonly int TestPort = Convert.ToInt32(ConfigProvider.Configuration["TestServerPort"]); private const string TestTraversalSource = "gmodern"; [Fact] diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json b/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/appsettings.json similarity index 61% copy from gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json copy to gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/appsettings.json index 1adda9ac9b..5d095ff188 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/appsettings.json +++ b/gremlin-dotnet/test/Gremlin.Net.Template.IntegrationTest/appsettings.json @@ -1,5 +1,6 @@ { "TestServerIpAddress": "localhost", + "TestServerIpAddressDocker": "gremlin-server-test-dotnet", "TestServerPort": 45940, "TestSecureServerPort": 45941 -} \ No newline at end of file +} diff --git a/gremlin-dotnet/test/pom.xml b/gremlin-dotnet/test/pom.xml index da60446e46..9009d9784c 100644 --- a/gremlin-dotnet/test/pom.xml +++ b/gremlin-dotnet/test/pom.xml @@ -25,28 +25,37 @@ limitations under the License. </parent> <artifactId>gremlin-dotnet-tests</artifactId> <name>Apache TinkerPop :: Gremlin.Net - Tests</name> - <packaging>${packaging.type}</packaging> <properties> <!-- provides a way to convert maven.test.skip value to skipTests for use in skipping dotnet tests --> <maven.test.skip>false</maven.test.skip> <skipTests>${maven.test.skip}</skipTests> - <!-- this path only works when maven is started from the direct parent directory, this should be fixed --> - <gremlin.server.dir>${project.parent.parent.basedir}/gremlin-server</gremlin.server.dir> - <tinkerpop.root.dir>${project.parent.parent.basedir}</tinkerpop.root.dir> </properties> <build> <plugins> - <!-- Override the execution from gremlin-dotnet to disable code generation from happening a second time --> + <!-- + there is no point to building/deploying the jvm stuff - there is no java source really - just poms + --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <configuration> + <skipSource>true</skipSource> + </configuration> + </plugin> <plugin> - <groupId>org.codehaus.gmavenplus</groupId> - <artifactId>gmavenplus-plugin</artifactId> - <executions> - <execution> - <id>generate-dsl</id> - <phase/> - </execution> - </executions> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-install-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> </plugin> <!-- there is no point to building/deploying the jvm stuff - there is no java source really - just poms @@ -62,16 +71,7 @@ limitations under the License. </build> <profiles> - <profile> - <id>gremlin-dotnet-standard</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <properties> - <packaging.type>pom</packaging.type> - </properties> - </profile> - <!-- activates the building of .NET components and requires that the .NET SDK be installed on the system --> + <!-- Test gremlin-dotnet in Docker --> <profile> <id>gremlin-dotnet</id> <activation> @@ -80,34 +80,71 @@ limitations under the License. <exists>.glv</exists> </file> </activation> - <properties> - <packaging.type>dotnet-integration-test</packaging.type> - </properties> <build> - <directory>${basedir}/target</directory> <finalName>${project.artifactId}-${project.version}</finalName> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.eobjects.build</groupId> - <artifactId>dotnet-maven-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <skip>${skipTests}</skip> - <!-- - transaction testing is disabled unless the -DincludeNeo4j flag enables the include-neo4j - maven profile which is a standard profile we use to add neo4j to testing explicitly - for - dotnet we set this TEST_TRANSACTIONS environment variable that can be accessed in tests to - determine if we skip transaction oriented tests or not. without neo4j we can't test Tx() - so this is disabled by default and enabled in the include-neo4j profile below - --> - <environment> - <TEST_TRANSACTIONS>false</TEST_TRANSACTIONS> - </environment> - </configuration> + <artifactId>exec-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <version>1.2.1</version> + <executions> + <execution> + <id>run-tests</id> + <phase>integration-test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <skip>${skipTests}</skip> + <environmentVariables> + <GREMLIN_SERVER>${project.version}</GREMLIN_SERVER> + <ABS_PROJECT_HOME>${project.basedir}/../</ABS_PROJECT_HOME> + <!-- setting this env variable is needed to be cross-platform compatible --> + <HOME>${user.home}</HOME> + </environmentVariables> + <executable>docker-compose</executable> + <arguments> + <argument>up</argument> + <argument>--build</argument> + <argument>--exit-code-from</argument> + <argument>gremlin-dotnet-integration-tests</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>shutdown-container</id> + <phase>integration-test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <skip>${skipTests}</skip> + <!-- don't need to set env variables for container tear down --> + <executable>docker-compose</executable> + <arguments> + <argument>down</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>remove-dangling-images</id> + <phase>integration-test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <skip>${skipTests}</skip> + <executable>docker</executable> + <arguments> + <argument>image</argument> + <argument>prune</argument> + <argument>--filter</argument> + <argument>label=maintainer=d...@tinkerpop.apache.org</argument> + <argument>-f</argument> + </arguments> + </configuration> + </execution> + </executions> </plugin> <plugin> <groupId>org.codehaus.gmavenplus</groupId> @@ -161,192 +198,10 @@ limitations under the License. </scripts> </configuration> </execution> - <execution> - <id>gremlin-server-start</id> - <phase>pre-integration-test</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <properties> - <property> - <name>skipTests</name> - <value>${skipTests}</value> - </property> - <property> - <name>gremlinServerDir</name> - <value>${gremlin.server.dir}</value> - </property> - <property> - <name>settingsFile</name> - <value>${gremlin.server.dir}/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml</value> - </property> - <property> - <name>executionName</name> - <value>${project.name}</value> - </property> - <property> - <name>projectBaseDir</name> - <value>${project.basedir}</value> - </property> - <property> - <name>tinkerpopRootDir</name> - <value>${tinkerpop.root.dir}</value> - </property> - </properties> - <scripts> - <script>${gremlin.server.dir}/src/test/scripts/test-server-start.groovy</script> - </scripts> - </configuration> - </execution> - <execution> - <id>gremlin-server-stop</id> - <phase>post-integration-test</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <properties> - <property> - <name>skipTests</name> - <value>${skipTests}</value> - </property> - <property> - <name>executionName</name> - <value>${project.name}</value> - </property> - </properties> - <scripts> - <script>${gremlin.server.dir}/src/test/scripts/test-server-stop.groovy</script> - </scripts> - </configuration> - </execution> </executions> </plugin> </plugins> </build> </profile> - <!-- - This profile will include neo4j for purposes of transactional testing within Gremlin Server. - Tests that require neo4j specifically will be "ignored" if this profile is not turned on. - --> - <profile> - <id>include-neo4j</id> - <activation> - <activeByDefault>false</activeByDefault> - <property> - <name>includeNeo4j</name> - </property> - </activation> - <properties> - <packaging.type>dotnet-integration-test</packaging.type> - </properties> - <build> - <plugins> - <!-- with neo4j present we can enable transaction testing --> - <plugin> - <groupId>org.eobjects.build</groupId> - <artifactId>dotnet-maven-plugin</artifactId> - <configuration> - <environment> - <TEST_TRANSACTIONS>true</TEST_TRANSACTIONS> - </environment> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.gmavenplus</groupId> - <artifactId>gmavenplus-plugin</artifactId> - <dependencies> - <dependency> - <groupId>org.neo4j</groupId> - <artifactId>neo4j-tinkerpop-api-impl</artifactId> - <version>0.9-3.4.0</version> - <exclusions> - <exclusion> - <groupId>org.neo4j</groupId> - <artifactId>neo4j-kernel</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.commons</groupId> - <artifactId>commons-text</artifactId> - </exclusion> - <exclusion> - <groupId>com.github.ben-manes.caffeine</groupId> - <artifactId>caffeine</artifactId> - </exclusion> - <exclusion> - <groupId>org.scala-lang</groupId> - <artifactId>scala-library</artifactId> - </exclusion> - <exclusion> - <groupId>org.scala-lang</groupId> - <artifactId>scala-reflect</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-nop</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - </exclusion> - <exclusion> - <groupId>io.dropwizard.metrics</groupId> - <artifactId>metrics-core</artifactId> - </exclusion> - <exclusion> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - </exclusion> - <exclusion> - <groupId>org.ow2.asm</groupId> - <artifactId>asm</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.scala-lang</groupId> - <artifactId>scala-library</artifactId> - <version>2.11.8</version> - </dependency> - <dependency> - <groupId>org.scala-lang</groupId> - <artifactId>scala-reflect</artifactId> - <version>2.11.8</version> - </dependency> - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - <version>5.5.0</version> - </dependency> - <dependency> - <groupId>io.dropwizard.metrics</groupId> - <artifactId>metrics-core</artifactId> - <version>4.2.11</version> - </dependency> - <dependency> - <groupId>org.neo4j</groupId> - <artifactId>neo4j-kernel</artifactId> - <version>3.4.11</version> - <exclusions> - <exclusion> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - </profile> </profiles> -</project> \ No newline at end of file +</project> diff --git a/gremlin-go/docker-compose.yml b/gremlin-go/docker-compose.yml index a02236950f..83048a9904 100644 --- a/gremlin-go/docker-compose.yml +++ b/gremlin-go/docker-compose.yml @@ -15,24 +15,33 @@ # specific language governing permissions and limitations # under the License. -version: "3.7" +version: "3.8" services: - gremlin-test-server: - container_name: gremlin-test-server - image: tinkerpop:gremlin-test-server-${GREMLIN_SERVER} + gremlin-server-test: + container_name: gremlin-server-test + image: tinkerpop/gremlin-server-test:${GREMLIN_SERVER} build: context: ../ - dockerfile: gremlin-go/Dockerfile + dockerfile: docker/gremlin-test-server/Dockerfile args: - GREMLIN_SERVER=${GREMLIN_SERVER} ports: - "45940:45940" - "45941:45941" + - "45942:45942" + - "4588:4588" volumes: - ${HOME}/.groovy:/root/.groovy - ${HOME}/.m2:/root/.m2 + - ${ABS_PROJECT_HOME}/gremlin-test/target:/opt/gremlin-test + healthcheck: + test: [ "CMD-SHELL", "apk add curl && curl -f http://localhost:45940?gremlin=100-1" ] + interval: 30s + timeout: 10s + retries: 30 + start_period: 30s gremlin-go-integration-tests: container_name: gremlin-go-integration-tests @@ -40,19 +49,19 @@ services: volumes: - .:/go_app - ../gremlin-test/features:/gremlin-test + - ../docker/gremlin-test-server:/go_app/gremlin-test-server environment: - CUCUMBER_FEATURE_FOLDER=/gremlin-test - - GREMLIN_SERVER_URL=ws://gremlin-test-server:45940/gremlin - - GREMLIN_SERVER_BASIC_AUTH_URL=wss://gremlin-test-server:45941/gremlin + - GREMLIN_SERVER_URL=ws://gremlin-server-test:45940/gremlin + - GREMLIN_SERVER_BASIC_AUTH_URL=wss://gremlin-server-test:45941/gremlin - RUN_INTEGRATION_TESTS=true - RUN_INTEGRATION_WITH_ALIAS_TESTS=true - RUN_BASIC_AUTH_INTEGRATION_TESTS=true - TEST_TRANSACTIONS=true working_dir: /go_app command: > - bash -c "apt-get update && apt-get install dos2unix && dos2unix ./wait-for-server.sh - && ./wait-for-server.sh gremlin-test-server 45940 300 - && go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest + bash -c "go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest && go test -v -json ./... -race -covermode=atomic -coverprofile=\"coverage.out\" -coverpkg=./... | gotestfmt" depends_on: - - gremlin-test-server + gremlin-server-test: + condition: service_healthy diff --git a/gremlin-go/docker/docker-entrypoint.sh b/gremlin-go/docker/docker-entrypoint.sh deleted file mode 100644 index 87b3d16d62..0000000000 --- a/gremlin-go/docker/docker-entrypoint.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# 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. -# - -TINKERPOP_HOME=/opt/gremlin-server -cp /opt/test/scripts/* ${TINKERPOP_HOME}/scripts - -IP=$(hostname -i) - -echo "#############################################################################" -echo IP is $IP -echo -echo Available Gremlin Server instances: -echo "ws://${IP}:45940/gremlin with anonymous access" -echo "wss://${IP}:45941/gremlin with basic authentication (stephen/password)" -echo Installing Neo4j to the environment: transactions are testable on port 45940 -echo "#############################################################################" - -cp *.yaml ${TINKERPOP_HOME}/conf/ - -java -version - -/opt/gremlin-server/bin/gremlin-server.sh install org.apache.tinkerpop neo4j-gremlin "$GREMLIN_SERVER_VER" - -/opt/gremlin-server/bin/gremlin-server.sh conf/gremlin-server-integration.yaml & - -/opt/gremlin-server/bin/gremlin-server.sh conf/gremlin-server-integration-secure.yaml diff --git a/gremlin-go/docker/generate-all.groovy b/gremlin-go/docker/generate-all.groovy deleted file mode 100644 index c4c31d64ca..0000000000 --- a/gremlin-go/docker/generate-all.groovy +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -// An example of an initialization script that can be configured to run in Gremlin Server. -// Functions defined here will go into global cache and will not be removed from there -// unless there is a reset of the ScriptEngine. -def addItUp(x, y) { x + y } - -// an init script that returns a Map allows explicit setting of global bindings. -def globals = [:] - -// Generates the modern graph into an "empty" TinkerGraph via LifeCycleHook. -// Note that the name of the key in the "global" map is unimportant. -globals << [hook : [ - onStartUp: { ctx -> - // a wild bit of trickery here. the process tests use an INTEGER id manager when LoadGraphWith is used. this - // closure provides a way to to manually override the various id managers for TinkerGraph - the graph on which - // all of these remote tests are executed - so that the tests will pass nicely. an alternative might have been - // to have a special test TinkerGraph config for setting up the id manager properly, but based on how we do - // things now, that test config would have been mixed in with release artifacts and there would have been ugly - // exclusions to make packaging work properly. - allowSetOfIdManager = { graph, idManagerFieldName -> - java.lang.reflect.Field idManagerField = graph.class.getDeclaredField(idManagerFieldName) - idManagerField.setAccessible(true) - java.lang.reflect.Field modifiersField = java.lang.reflect.Field.class.getDeclaredField("modifiers") - modifiersField.setAccessible(true) - modifiersField.setInt(idManagerField, modifiersField.getModifiers() & ~java.lang.reflect.Modifier.FINAL) - - idManagerField.set(graph, TinkerGraph.DefaultIdManager.INTEGER) - } - - [classic, modern, crew, sink, grateful, immutable].each{ - allowSetOfIdManager(it, "vertexIdManager") - allowSetOfIdManager(it, "edgeIdManager") - allowSetOfIdManager(it, "vertexPropertyIdManager") - } - TinkerFactory.generateClassic(classic) - TinkerFactory.generateModern(modern) - TinkerFactory.generateTheCrew(crew) - TinkerFactory.generateGratefulDead(grateful) - TinkerFactory.generateKitchenSink(sink) - TinkerFactory.generateModern(immutable) - } -] as LifeCycleHook] - -// add default TraversalSource instances for each graph instance -globals << [gclassic : traversal().withEmbedded(classic).withStrategies(ReferenceElementStrategy)] -globals << [gmodern : traversal().withEmbedded(modern).withStrategies(ReferenceElementStrategy)] -globals << [gimmutable : traversal().withEmbedded(immutable).withStrategies(ReferenceElementStrategy)] -globals << [g : traversal().withEmbedded(graph).withStrategies(ReferenceElementStrategy)] -globals << [gcrew : traversal().withEmbedded(crew).withStrategies(ReferenceElementStrategy)] -globals << [ggraph : traversal().withEmbedded(graph).withStrategies(ReferenceElementStrategy)] -globals << [ggrateful : traversal().withEmbedded(grateful).withStrategies(ReferenceElementStrategy)] -globals << [gsink : traversal().withEmbedded(sink).withStrategies(ReferenceElementStrategy)] - -// dynamically detect existence of gtx as it may or may not be present depending on the -DincludeNeo4j -// and the configuration of the particular server instance. with docker/gremlin-server.sh the neo4j -// "tx" configuration is already present and will therefore be enabled. -def dynamicGtx = context.getBindings(javax.script.ScriptContext.GLOBAL_SCOPE)["tx"] -if (dynamicGtx != null) - globals << [gtx : traversal().withEmbedded(dynamicGtx).withStrategies(ReferenceElementStrategy)] - -globals diff --git a/gremlin-go/docker/gremlin-server-integration-secure.yaml b/gremlin-go/docker/gremlin-server-integration-secure.yaml deleted file mode 100644 index c7b997c1a3..0000000000 --- a/gremlin-go/docker/gremlin-server-integration-secure.yaml +++ /dev/null @@ -1,76 +0,0 @@ -# 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. - -host: 0.0.0.0 -port: 45941 -evaluationTimeout: 30000 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer -graphs: { - graph: scripts/tinkergraph-empty.properties, - immutable: scripts/tinkergraph-empty.properties, - classic: scripts/tinkergraph-empty.properties, - modern: scripts/tinkergraph-empty.properties, - crew: scripts/tinkergraph-empty.properties, - grateful: scripts/tinkergraph-empty.properties, - sink: scripts/tinkergraph-empty.properties} -scriptEngines: { - gremlin-lang : {}, - gremlin-groovy: { - plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin: {expectedCompilationTime: 30000}, - org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]}, - org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/generate-all.groovy]}}}} -serializers: - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1d0], custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0], custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1d0], custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2d0] }} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1d0] }} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1 } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, config: { serializeResultToString: true }} -processors: - - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }} - - { className: org.apache.tinkerpop.gremlin.server.op.standard.StandardOpProcessor, config: {}} -metrics: { - slf4jReporter: {enabled: true, interval: 180000}} -gremlinPool: 8 -strictTransactionManagement: false -idleConnectionTimeout: 0 -keepAliveInterval: 0 -maxInitialLineLength: 4096 -maxHeaderSize: 8192 -maxChunkSize: 8192 -maxContentLength: 1000000 -maxAccumulationBufferComponents: 1024 -resultIterationBatchSize: 64 -writeBufferLowWaterMark: 32768 -writeBufferHighWaterMark: 65536 -authentication: { - authenticator: org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator, - config: { - credentialsDb: conf/tinkergraph-credentials.properties}} -ssl: { - enabled: true, - sslEnabledProtocols: [TLSv1.2], - # You must configure a keyStore! - keyStore: /opt/test/resources/server-key.jks, - keyStorePassword: changeit -} diff --git a/gremlin-go/docker/gremlin-server-integration.yaml b/gremlin-go/docker/gremlin-server-integration.yaml deleted file mode 100644 index da9f5374af..0000000000 --- a/gremlin-go/docker/gremlin-server-integration.yaml +++ /dev/null @@ -1,68 +0,0 @@ -# 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. - -host: 0.0.0.0 -port: 45940 -evaluationTimeout: 30000 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer -graphs: { - graph: scripts/tinkergraph-empty.properties, - immutable: scripts/tinkergraph-empty.properties, - classic: scripts/tinkergraph-empty.properties, - modern: scripts/tinkergraph-empty.properties, - crew: scripts/tinkergraph-empty.properties, - grateful: scripts/tinkergraph-empty.properties, - sink: scripts/tinkergraph-empty.properties, - tx: scripts/neo4j-empty.properties -} -scriptEngines: { - gremlin-lang : {}, - gremlin-groovy: { - plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.neo4j.jsr223.Neo4jGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin: {expectedCompilationTime: 30000}, - org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]}, - org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/generate-all.groovy]}}}} -serializers: - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1d0], custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0], custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1d0], custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true}} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2d0] }} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1d0] }} - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1 } - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, config: { serializeResultToString: true }} -processors: - - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }} - - { className: org.apache.tinkerpop.gremlin.server.op.standard.StandardOpProcessor, config: {}} -metrics: { - slf4jReporter: {enabled: true, interval: 180000}} -gremlinPool: 8 -strictTransactionManagement: false -idleConnectionTimeout: 0 -keepAliveInterval: 0 -maxInitialLineLength: 4096 -maxHeaderSize: 8192 -maxChunkSize: 8192 -maxContentLength: 1000000 -maxAccumulationBufferComponents: 1024 -resultIterationBatchSize: 64 -writeBufferLowWaterMark: 32768 -writeBufferHighWaterMark: 65536 diff --git a/gremlin-go/pom.xml b/gremlin-go/pom.xml index 026f5be282..35010f5688 100644 --- a/gremlin-go/pom.xml +++ b/gremlin-go/pom.xml @@ -97,6 +97,7 @@ limitations under the License. <skip>${skipTests}</skip> <environmentVariables> <GREMLIN_SERVER>${project.version}</GREMLIN_SERVER> + <ABS_PROJECT_HOME>${project.basedir}</ABS_PROJECT_HOME> <!-- setting this env variable is needed to be cross-platform compatible --> <HOME>${user.home}</HOME> </environmentVariables> @@ -117,16 +118,31 @@ limitations under the License. </goals> <configuration> <skip>${skipTests}</skip> - <environmentVariables> - <GREMLIN_SERVER>${project.version}</GREMLIN_SERVER> - <HOME>${user.home}</HOME> - </environmentVariables> + <!-- don't need to set env variables for container tear down --> <executable>docker-compose</executable> <arguments> <argument>down</argument> </arguments> </configuration> </execution> + <execution> + <id>remove-dangling-images</id> + <phase>integration-test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <skip>${skipTests}</skip> + <executable>docker</executable> + <arguments> + <argument>image</argument> + <argument>prune</argument> + <argument>--filter</argument> + <argument>label=maintainer=d...@tinkerpop.apache.org</argument> + <argument>-f</argument> + </arguments> + </configuration> + </execution> </executions> </plugin> <plugin> diff --git a/gremlin-go/run.sh b/gremlin-go/run.sh index 8d2315b48f..e37b768711 100755 --- a/gremlin-go/run.sh +++ b/gremlin-go/run.sh @@ -42,10 +42,14 @@ fi # Parses current gremlin server version from project pom.xml file using perl regex GREMLIN_SERVER_VERSION=$(grep tinkerpop -A2 pom.xml | grep -Po '(?<=<version>)([0-9]+\.?){3}(-SNAPSHOT)?(?=<)') export GREMLIN_SERVER="${1:-$GREMLIN_SERVER_VERSION}" -echo "$GREMLIN_SERVER" +echo "Running server version: $GREMLIN_SERVER" -# Passes current gremlin server version into docker compose as environment variable & removes all service containers +ABS_PROJECT_HOME=$(dirname $(realpath "$0"))/.. +export ABS_PROJECT_HOME + +# Passes current gremlin server version into docker compose as environment variable docker-compose up --build --exit-code-from gremlin-go-integration-tests EXIT_CODE=$? +# Removes all service containers docker-compose down exit $EXIT_CODE diff --git a/gremlin-javascript/pom.xml b/gremlin-javascript/pom.xml index bbf9466db6..8b2e05e383 100644 --- a/gremlin-javascript/pom.xml +++ b/gremlin-javascript/pom.xml @@ -28,262 +28,11 @@ limitations under the License. <properties> <maven.test.skip>false</maven.test.skip> <skipTests>${maven.test.skip}</skipTests> - <gremlin.server.dir>${project.parent.basedir}/gremlin-server</gremlin.server.dir> - <tinkerpop.root.dir>${project.parent.basedir}</tinkerpop.root.dir> <npm.version>6.14.6</npm.version> <node.version>v10.22.0</node.version> </properties> <build> - <directory>${basedir}/target</directory> - <finalName>${project.artifactId}-${project.version}</finalName> - <pluginManagement> - <plugins> - <plugin> - <groupId>com.github.eirslett</groupId> - <artifactId>frontend-maven-plugin</artifactId> - <version>1.12.1</version> - </plugin> - </plugins> - </pluginManagement> <plugins> - <plugin> - <!-- - Use gmavenplus-plugin to: - - Generate js sources - - Start and stop gremlin server for integration tests - --> - <groupId>org.codehaus.gmavenplus</groupId> - <artifactId>gmavenplus-plugin</artifactId> - <dependencies> - <dependency> - <groupId>org.apache.tinkerpop</groupId> - <artifactId>gremlin-server</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.tinkerpop</groupId> - <artifactId>gremlin-test</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.tinkerpop</groupId> - <artifactId>neo4j-gremlin</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons.io.version}</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>${log4j.version}</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy-all</artifactId> - <version>${groovy.version}</version> - <type>pom</type> - <scope>runtime</scope> - </dependency> - </dependencies> - <executions> - <execution> - <id>generate-radish-support</id> - <phase>generate-sources</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <properties> - <property> - <name>projectBaseDir</name> - <value>${project.basedir}/../</value> - </property> - </properties> - <scripts> - <script>${project.basedir}/build/generate.groovy</script> - </scripts> - </configuration> - </execution> - <execution> - <id>update-version</id> - <phase>generate-sources</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <scripts> - <script> - def mavenVersion = "${project.version}" - def versionForJs = mavenVersion.replace("-SNAPSHOT", "-alpha1") - def platformAgnosticBaseDirPath = project.basedir.getAbsolutePath().replace("\\", "/") - def file = new File(platformAgnosticBaseDirPath + "/src/main/javascript/gremlin-javascript/package.json") - file.write(file.getText("UTF-8").replaceFirst(/"version": "(.*)",/, "\"version\": \"" + versionForJs + "\",")) - </script> - </scripts> - </configuration> - </execution> - <execution> - <id>gremlin-server-start</id> - <phase>pre-integration-test</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <properties> - <property> - <name>skipTests</name> - <value>${skipTests}</value> - </property> - <property> - <name>gremlinServerDir</name> - <value>${gremlin.server.dir}</value> - </property> - <property> - <name>settingsFile</name> - <value>${gremlin.server.dir}/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml</value> - </property> - <property> - <name>executionName</name> - <value>${project.name}</value> - </property> - <property> - <name>projectBaseDir</name> - <value>${project.basedir}</value> - </property> - <property> - <name>tinkerpopRootDir</name> - <value>${tinkerpop.root.dir}</value> - </property> - </properties> - <scripts> - <script>${gremlin.server.dir}/src/test/scripts/test-server-start.groovy</script> - </scripts> - </configuration> - </execution> - <execution> - <id>gremlin-server-stop</id> - <phase>post-integration-test</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <properties> - <property> - <name>skipTests</name> - <value>${skipTests}</value> - </property> - <property> - <name>executionName</name> - <value>${project.name}</value> - </property> - </properties> - <scripts> - <script>${gremlin.server.dir}/src/test/scripts/test-server-stop.groovy</script> - </scripts> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-clean-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>clean</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>com.github.eirslett</groupId> - <artifactId>frontend-maven-plugin</artifactId> - <executions> - <execution> - <id>install node and npm</id> - <phase>validate</phase> - <goals> - <goal>install-node-and-npm</goal> - </goals> - </execution> - <execution> - <id>npm install</id> - <phase>validate</phase> - <goals> - <goal>npm</goal> - </goals> - <configuration> - <arguments>install</arguments> - </configuration> - </execution> - <execution> - <id>npm lint</id> - <phase>validate</phase> - <goals> - <goal>npm</goal> - </goals> - <configuration> - <skip>${skipTests}</skip> - <arguments>run lint</arguments> - <failOnError>true</failOnError> - </configuration> - </execution> - <execution> - <id>grunt jsdoc</id> - <goals> - <goal>grunt</goal> - </goals> - <phase>generate-resources</phase> - <configuration> - <arguments>jsdoc</arguments> - </configuration> - </execution> - <execution> - <id>npm test</id> - <phase>integration-test</phase> - <goals> - <goal>npm</goal> - </goals> - <configuration> - <skip>${skipTests}</skip> - <arguments>test --exit</arguments> - <failOnError>true</failOnError> - </configuration> - </execution> - <execution> - <id>npm test gherkin features</id> - <phase>integration-test</phase> - <goals> - <goal>npm</goal> - </goals> - <configuration> - <skip>${skipTests}</skip> - <arguments>run-script features</arguments> - <failOnError>true</failOnError> - </configuration> - </execution> - </executions> - <configuration> - <workingDirectory>src/main/javascript/gremlin-javascript</workingDirectory> - <nodeVersion>${node.version}</nodeVersion> - <npmVersion>${npm.version}</npmVersion> - - <!-- - transaction testing is disabled unless the -DincludeNeo4j flag enables the include-neo4j - maven profile which is a standard profile we use to add neo4j to testing explicitly - for - npm we set this TEST_TRANSACTIONS environment variable that can be accessed in tests to - determine if we skip transaction oriented tests or not. without neo4j we can't test tx() - so this is disabled by default and enabled in the include-neo4j profile below - --> - <environmentVariables> - <TEST_TRANSACTIONS>false</TEST_TRANSACTIONS> - </environmentVariables> - </configuration> - </plugin> <!-- there is no point to building/deploying the jvm stuff - there is no java source really - just poms --> @@ -318,126 +67,142 @@ limitations under the License. </plugins> </build> <profiles> - <!-- - This profile will include neo4j for purposes of transactional testing within Gremlin Server. - Tests that require neo4j specifically will be "ignored" if this profile is not turned on. - --> + <!-- Test gremlin-javascript in Docker --> <profile> - <id>include-neo4j</id> + <id>glv-js</id> <activation> - <activeByDefault>false</activeByDefault> - <property> - <name>includeNeo4j</name> - </property> + <activeByDefault>true</activeByDefault> </activation> <build> + <finalName>${project.artifactId}-${project.version}</finalName> <plugins> - <!-- with neo4j present we can enable transaction testing --> <plugin> - <groupId>com.github.eirslett</groupId> - <artifactId>frontend-maven-plugin</artifactId> - <configuration> - <environmentVariables combine.children="override"> - <TEST_TRANSACTIONS>true</TEST_TRANSACTIONS> - </environmentVariables> - </configuration> + <artifactId>exec-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <version>1.2.1</version> + <executions> + <execution> + <id>run-tests</id> + <phase>integration-test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <skip>${skipTests}</skip> + <environmentVariables> + <GREMLIN_SERVER>${project.version}</GREMLIN_SERVER> + <ABS_PROJECT_HOME>${project.basedir}/../</ABS_PROJECT_HOME> + <!-- setting this env variable is needed to be cross-platform compatible --> + <HOME>${user.home}</HOME> + </environmentVariables> + <executable>docker-compose</executable> + <arguments> + <argument>up</argument> + <argument>--build</argument> + <argument>--exit-code-from</argument> + <argument>gremlin-js-integration-tests</argument> + </arguments> + <workingDirectory>./src/main/javascript/gremlin-javascript</workingDirectory> + </configuration> + </execution> + <execution> + <id>shutdown-container</id> + <phase>integration-test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <skip>${skipTests}</skip> + <!-- don't need to set env variables for container tear down --> + <executable>docker-compose</executable> + <arguments> + <argument>down</argument> + </arguments> + <workingDirectory>./src/main/javascript/gremlin-javascript</workingDirectory> + </configuration> + </execution> + <execution> + <id>remove-dangling-images</id> + <phase>integration-test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <skip>${skipTests}</skip> + <executable>docker</executable> + <arguments> + <argument>image</argument> + <argument>prune</argument> + <argument>--filter</argument> + <argument>label=maintainer=d...@tinkerpop.apache.org</argument> + <argument>-f</argument> + </arguments> + </configuration> + </execution> + </executions> </plugin> <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> <dependencies> <dependency> - <groupId>org.neo4j</groupId> - <artifactId>neo4j-tinkerpop-api-impl</artifactId> - <version>0.9-3.4.0</version> - <exclusions> - <exclusion> - <groupId>org.neo4j</groupId> - <artifactId>neo4j-kernel</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.commons</groupId> - <artifactId>commons-text</artifactId> - </exclusion> - <exclusion> - <groupId>com.github.ben-manes.caffeine</groupId> - <artifactId>caffeine</artifactId> - </exclusion> - <exclusion> - <groupId>org.scala-lang</groupId> - <artifactId>scala-library</artifactId> - </exclusion> - <exclusion> - <groupId>org.scala-lang</groupId> - <artifactId>scala-reflect</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-nop</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - </exclusion> - <exclusion> - <groupId>io.dropwizard.metrics</groupId> - <artifactId>metrics-core</artifactId> - </exclusion> - <exclusion> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - </exclusion> - <exclusion> - <groupId>org.ow2.asm</groupId> - <artifactId>asm</artifactId> - </exclusion> - </exclusions> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-server</artifactId> + <version>${project.version}</version> </dependency> <dependency> - <groupId>org.scala-lang</groupId> - <artifactId>scala-library</artifactId> - <version>2.11.8</version> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-test</artifactId> + <version>${project.version}</version> </dependency> <dependency> - <groupId>org.scala-lang</groupId> - <artifactId>scala-reflect</artifactId> - <version>2.11.8</version> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>neo4j-gremlin</artifactId> + <version>${project.version}</version> </dependency> <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - <version>5.5.0</version> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commons.io.version}</version> </dependency> <dependency> - <groupId>io.dropwizard.metrics</groupId> - <artifactId>metrics-core</artifactId> - <version>4.2.11</version> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>${log4j.version}</version> + <scope>runtime</scope> </dependency> <dependency> - <groupId>org.neo4j</groupId> - <artifactId>neo4j-kernel</artifactId> - <version>3.4.11</version> - <exclusions> - <exclusion> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - </exclusion> - </exclusions> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-all</artifactId> + <version>${groovy.version}</version> + <type>pom</type> + <scope>runtime</scope> </dependency> </dependencies> + <executions> + <execution> + <id>generate-radish-support</id> + <phase>generate-sources</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <properties> + <property> + <name>projectBaseDir</name> + <value>${project.basedir}/../</value> + </property> + </properties> + <scripts> + <script>${project.basedir}/build/generate.groovy</script> + </scripts> + </configuration> + </execution> + </executions> </plugin> </plugins> </build> </profile> - <!-- Provides a way to deploy the gremlin-javascript GLV to npm. This cannot be part of the standard maven execution because npm does not have a staging environment like sonatype for releases. As soon as the release is diff --git a/gremlin-go/docker-compose.yml b/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml similarity index 51% copy from gremlin-go/docker-compose.yml copy to gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml index a02236950f..24b7e17fc4 100644 --- a/gremlin-go/docker-compose.yml +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml @@ -15,44 +15,48 @@ # specific language governing permissions and limitations # under the License. -version: "3.7" +version: "3.8" services: - gremlin-test-server: - container_name: gremlin-test-server - image: tinkerpop:gremlin-test-server-${GREMLIN_SERVER} + gremlin-server-test-js: + container_name: gremlin-server-test-js + image: tinkerpop/gremlin-server-test:${GREMLIN_SERVER} build: - context: ../ - dockerfile: gremlin-go/Dockerfile + context: ../../../../../ + dockerfile: docker/gremlin-test-server/Dockerfile args: - GREMLIN_SERVER=${GREMLIN_SERVER} ports: - "45940:45940" - "45941:45941" + - "45942:45942" + - "4588:4588" volumes: - ${HOME}/.groovy:/root/.groovy - ${HOME}/.m2:/root/.m2 + - ${ABS_PROJECT_HOME}/gremlin-test/target:/opt/gremlin-test + healthcheck: + test: [ "CMD-SHELL", "apk add curl && curl -f http://localhost:45940?gremlin=100-1" ] + interval: 30s + timeout: 10s + retries: 30 + start_period: 30s - gremlin-go-integration-tests: - container_name: gremlin-go-integration-tests - image: golang:1.17 + gremlin-js-integration-tests: + container_name: gremlin-js-integration-tests + image: node:16 volumes: - - .:/go_app - - ../gremlin-test/features:/gremlin-test + - .:/js_app + - ../../../../../gremlin-test/features:/gremlin-test + - ../../../../../docker/gremlin-test-server:/js_app/gremlin-test-server environment: - - CUCUMBER_FEATURE_FOLDER=/gremlin-test - - GREMLIN_SERVER_URL=ws://gremlin-test-server:45940/gremlin - - GREMLIN_SERVER_BASIC_AUTH_URL=wss://gremlin-test-server:45941/gremlin - - RUN_INTEGRATION_TESTS=true - - RUN_INTEGRATION_WITH_ALIAS_TESTS=true - - RUN_BASIC_AUTH_INTEGRATION_TESTS=true + - DOCKER_ENVIRONMENT=true - TEST_TRANSACTIONS=true - working_dir: /go_app + working_dir: /js_app command: > - bash -c "apt-get update && apt-get install dos2unix && dos2unix ./wait-for-server.sh - && ./wait-for-server.sh gremlin-test-server 45940 300 - && go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest - && go test -v -json ./... -race -covermode=atomic -coverprofile=\"coverage.out\" -coverpkg=./... | gotestfmt" + bash -c "npm config set cache /tmp --global + && npm ci && npm run test && npm run features-docker" depends_on: - - gremlin-test-server + gremlin-server-test-js: + condition: service_healthy diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json index f349cb6073..793899f996 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json @@ -49,6 +49,9 @@ "features": "npm run features-graphson30 && npm run features-graphbinary", "features-graphson30": "cross-env CLIENT_MIMETYPE='application/vnd.gremlin-v3.0+json' cucumber-js --require test/cucumber ../../../../../gremlin-test/features/", "features-graphbinary": "cross-env CLIENT_MIMETYPE='application/vnd.graphbinary-v1.0' cucumber-js --require test/cucumber ../../../../../gremlin-test/features/", + "features-docker": "npm run features-graphson30-docker && npm run features-graphbinary-docker", + "features-graphson30-docker": "cross-env CLIENT_MIMETYPE='application/vnd.gremlin-v3.0+json' cucumber-js --require test/cucumber ../gremlin-test/", + "features-graphbinary-docker": "cross-env CLIENT_MIMETYPE='application/vnd.graphbinary-v1.0' cucumber-js --require test/cucumber ../gremlin-test/", "lint": "eslint --ext .js ." }, "engines": { diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js index 0350c9e63a..296f7c3c84 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js @@ -27,8 +27,15 @@ const DriverRemoteConnection = require('../lib/driver/driver-remote-connection') const Client = require('../lib/driver/client'); const PlainTextSaslAuthenticator = require('../lib/driver/auth/plain-text-sasl-authenticator'); -const serverUrl = 'ws://localhost:45940/gremlin'; -const serverAuthUrl = 'wss://localhost:45941/gremlin'; +let serverUrl; +let serverAuthUrl; +if (process.env.DOCKER_ENVIRONMENT === 'true') { + serverUrl = 'ws://gremlin-server-test-js:45940/gremlin'; + serverAuthUrl = 'wss://gremlin-server-test-js:45941/gremlin'; +} else { + serverUrl = 'ws://localhost:45940/gremlin'; + serverAuthUrl = 'wss://localhost:45941/gremlin'; +} /** @returns {DriverRemoteConnection} */ exports.getConnection = function getConnection(traversalSource) { diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js index b3ecf06a30..1fa5850cc2 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js @@ -28,7 +28,12 @@ const DriverRemoteConnection = require('../../lib/driver/driver-remote-connectio const PlainTextSaslAuthenticator = require('../../lib/driver/auth/plain-text-sasl-authenticator'); let connection; -const badServerAuthUrl = 'ws://localhost:45941/gremlin'; +let badServerAuthUrl; +if (process.env.DOCKER_ENVIRONMENT === 'true') { + badServerAuthUrl = 'ws://gremlin-server-test-js:45941/gremlin'; +} else { + badServerAuthUrl = 'ws://localhost:45941/gremlin'; +} describe('DriverRemoteConnection', function () { context('with PlainTextSaslAuthenticator', function () { diff --git a/gremlin-server/conf/tinkergraph-service.properties b/gremlin-server/conf/tinkergraph-service.properties new file mode 100644 index 0000000000..211b9e4f03 --- /dev/null +++ b/gremlin-server/conf/tinkergraph-service.properties @@ -0,0 +1,20 @@ +# 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. +gremlin.graph=org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph +gremlin.tinkergraph.vertexIdManager=INTEGER +gremlin.tinkergraph.edgeIdManager=INTEGER +gremlin.tinkergraph.vertexPropertyIdManager=INTEGER \ No newline at end of file diff --git a/gremlin-server/pom.xml b/gremlin-server/pom.xml index a1c9a7ef6d..d6ef175d01 100644 --- a/gremlin-server/pom.xml +++ b/gremlin-server/pom.xml @@ -186,6 +186,24 @@ limitations under the License. </arguments> </configuration> </execution> + <execution> + <id>remove-dangling-images</id> + <phase>install</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <skip>${skipImageBuild}</skip> + <executable>docker</executable> + <arguments> + <argument>image</argument> + <argument>prune</argument> + <argument>--filter</argument> + <argument>label=maintainer=d...@tinkerpop.apache.org</argument> + <argument>-f</argument> + </arguments> + </configuration> + </execution> </executions> </plugin> </plugins> diff --git a/gremlin-server/src/test/scripts/generate-all.groovy b/gremlin-server/src/test/scripts/generate-all.groovy index 464f673743..bbecf60023 100644 --- a/gremlin-server/src/test/scripts/generate-all.groovy +++ b/gremlin-server/src/test/scripts/generate-all.groovy @@ -75,4 +75,9 @@ def dynamicGtx = context.getBindings(javax.script.ScriptContext.GLOBAL_SCOPE)["t if (dynamicGtx != null) globals << [gtx : traversal().withEmbedded(dynamicGtx).withStrategies(ReferenceElementStrategy)] +// dynamically detect existence of gimmutable as it is only used in gremlin-go testing suite +def dynamicGimmutable = context.getBindings(javax.script.ScriptContext.GLOBAL_SCOPE)["immutable"] +if (dynamicGimmutable != null) + globals << [gimmutable : traversal().withEmbedded(dynamicGimmutable).withStrategies(ReferenceElementStrategy)] + globals