diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dba48c9..227acc49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ name: CI on: pull_request: + paths-ignore: + - "docs/**" + - "samples/**" + - "**.md" push: branches: - trunk @@ -15,5 +19,5 @@ jobs: name: Tests (CI) uses: ./.github/workflows/tests.yml with: - image: ${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES).ci.fullname }} + runtime: ci secrets: inherit diff --git a/.github/workflows/load-configuration.yml b/.github/workflows/load-configuration.yml new file mode 100644 index 00000000..a2995585 --- /dev/null +++ b/.github/workflows/load-configuration.yml @@ -0,0 +1,46 @@ +name: Load KurrentDB Runtime Configuration +on: + workflow_call: + inputs: + runtime: + description: "The runtime's name. Current options are: `ci`, `previous-lts`, `latest`" + type: string + + outputs: + runtime: + description: The runtime's name + value: ${{ inputs.runtime }} + + registry: + description: The Docker registry + value: ${{ jobs.load.outputs.registry }} + + image: + description: The Docker image + value: ${{ jobs.load.outputs.image }} + + tag: + description: The Docker image tag + value: ${{ jobs.load.outputs.tag }} + + full_image_name: + description: The full Docker image name (including registry, image, and tag) + value: ${{ jobs.load.outputs.full_image_name }} + +jobs: + load: + runs-on: ubuntu-latest + outputs: + registry: ${{ steps.set.outputs.registry }} + image: ${{ steps.set.outputs.image }} + tag: ${{ steps.set.outputs.tag }} + full_image_name: ${{ steps.set.outputs.full_image_name }} + + steps: + - name: Set KurrentDB Runtime Configuration Properties + id: set + run: | + echo "registry=${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES)[inputs.runtime].registry }}" >> $GITHUB_OUTPUT + echo "tag=${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES)[inputs.runtime].tag }}" >> $GITHUB_OUTPUT + echo "image=${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES)[inputs.runtime].image }}" >> $GITHUB_OUTPUT + echo "full_image_name=${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES)[inputs.runtime].fullname }}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/lts.yml b/.github/workflows/lts.yml index c0936f87..3c8fb250 100644 --- a/.github/workflows/lts.yml +++ b/.github/workflows/lts.yml @@ -1,6 +1,10 @@ name: LTS on: pull_request: + paths-ignore: + - "docs/**" + - "samples/**" + - "**.md" push: branches: - trunk @@ -15,7 +19,7 @@ jobs: name: Tests (LTS) uses: ./.github/workflows/tests.yml with: - image: ${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES).lts.fullname }} + runtime: lts secrets: inherit # Will be removed in the future @@ -24,5 +28,7 @@ jobs: uses: ./.github/workflows/plugins-tests.yml with: - image: "docker.eventstore.com/eventstore-ee/eventstoredb-commercial:24.2.0-jammy" + registry: docker.eventstore.com/eventstore-ee + image: eventstoredb-commercial + tag: 24.2.0-jammy secrets: inherit diff --git a/.github/workflows/plugins-tests.yml b/.github/workflows/plugins-tests.yml index 08aed4c8..fed0338a 100644 --- a/.github/workflows/plugins-tests.yml +++ b/.github/workflows/plugins-tests.yml @@ -3,9 +3,15 @@ name: enterprise plugins tests workflow on: workflow_call: inputs: + registry: + required: true + type: string image: required: true type: string + tag: + required: true + type: string jobs: single_node: @@ -46,7 +52,7 @@ jobs: - name: Execute Gradle build run: ./gradlew ci --tests ${{ matrix.test }}Tests env: - KURRENTDB_IMAGE: ${{ inputs.image }} + KURRENTDB_IMAGE: ${{inputs.registry}}/${{ inputs.image }}:${{ inputs.tag }} SECURE: true - uses: actions/upload-artifact@v4 @@ -81,7 +87,9 @@ jobs: - name: Set up cluster with Docker Compose run: docker compose up -d env: - KURRENTDB_IMAGE: ${{ inputs.image }} + KURRENTDB_DOCKER_REGISTRY: ${{ inputs.registry }} + KURRENTDB_DOCKER_IMAGE: ${{ inputs.image }} + KURRENTDB_DOCKER_TAG: ${{ inputs.tag }} - name: Generate user certificates run: docker compose --file configure-user-certs-for-tests.yml up diff --git a/.github/workflows/previous-lts.yml b/.github/workflows/previous-lts.yml index 0fd060c2..df1d75e7 100644 --- a/.github/workflows/previous-lts.yml +++ b/.github/workflows/previous-lts.yml @@ -1,6 +1,10 @@ name: Previous LTS on: pull_request: + paths-ignore: + - "docs/**" + - "samples/**" + - "**.md" push: branches: - trunk @@ -15,5 +19,5 @@ jobs: name: Tests (Previous LTS) uses: ./.github/workflows/tests.yml with: - image: ${{ fromJSON(vars.KURRENTDB_DOCKER_IMAGES)['previous-lts'].fullname }} + runtime: previous-lts secrets: inherit diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 231c7784..b4a0daf2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,20 +1,20 @@ name: tests workflow on: - pull_request: - paths-ignore: - - "docs/**" - - "samples/**" - - "**.md" - workflow_call: inputs: - image: + runtime: required: true type: string jobs: + load_configuration: + uses: ./.github/workflows/load-configuration.yml + with: + runtime: ${{ inputs.runtime }} + single_node: + needs: load_configuration name: Single node strategy: @@ -47,16 +47,10 @@ jobs: - name: Execute Gradle build run: ./gradlew ci --tests ${{ matrix.test }}Tests env: - KURRENTDB_IMAGE: ${{ inputs.image }} - - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: esdb_logs.tar.gz - path: /tmp/esdb_logs.tar.gz - if-no-files-found: error + KURRENTDB_IMAGE: ${{ needs.load_configuration.outputs.full_image_name }} secure: + needs: load_configuration name: Secure strategy: @@ -92,7 +86,7 @@ jobs: - name: Execute Gradle build run: ./gradlew ci --tests ${{ matrix.test }}Tests env: - KURRENTDB_IMAGE: ${{ inputs.image }} + KURRENTDB_IMAGE: ${{ needs.load_configuration.outputs.full_image_name }} SECURE: true - uses: actions/upload-artifact@v4 @@ -102,6 +96,7 @@ jobs: path: /tmp/esdb_logs.tar.gz cluster: + needs: load_configuration name: Cluster strategy: @@ -123,7 +118,9 @@ jobs: - name: Set up cluster with Docker Compose run: docker compose up -d env: - KURRENTDB_IMAGE: ${{ inputs.image }} + KURRENTDB_DOCKER_REGISTRY: ${{ needs.load_configuration.outputs.registry }} + KURRENTDB_DOCKER_IMAGE: ${{ needs.load_configuration.outputs.image }} + KURRENTDB_DOCKER_TAG: ${{ needs.load_configuration.outputs.tag }} - name: Set up JDK 8 uses: actions/setup-java@v3 diff --git a/docker-compose.yml b/docker-compose.yml index e64e7e83..344f19f3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.5" - services: volumes-provisioner: image: hasnat/volumes-provisioner @@ -26,71 +24,57 @@ services: - volumes-provisioner esdb-node1: &template - image: ${KURRENTDB_IMAGE:-docker.kurrent.io/eventstore/eventstoredb-ee:lts} + image: ${KURRENTDB_DOCKER_REGISTRY:-docker.kurrent.io/eventstore}/${KURRENTDB_DOCKER_IMAGE:-eventstoredb-ee}:${KURRENTDB_DOCKER_TAG:-lts} env_file: - vars.env environment: - EVENTSTORE_GOSSIP_SEED=172.30.240.12:2113,172.30.240.13:2113 - - EVENTSTORE_INT_IP=172.30.240.11 - - EVENTSTORE_CERTIFICATE_FILE=/etc/eventstore/certs/node1/node.crt - - EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/eventstore/certs/node1/node.key - - EVENTSTORE_ADVERTISE_HTTP_PORT_TO_CLIENT_AS=2111 + - EVENTSTORE_REPLICATION_IP=172.30.240.11 + - EVENTSTORE_CERTIFICATE_FILE=/etc/kurrentdb/certs/node1/node.crt + - EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/kurrentdb/certs/node1/node.key + - EVENTSTORE_ADVERTISE_NODE_PORT_TO_CLIENT_AS=2111 ports: - 2111:2113 networks: clusternetwork: ipv4_address: 172.30.240.11 volumes: - - ./certs:/etc/eventstore/certs + - ./certs:/etc/kurrentdb/certs restart: unless-stopped depends_on: - cert-gen esdb-node2: <<: *template - env_file: - - vars.env environment: - EVENTSTORE_GOSSIP_SEED=172.30.240.11:2113,172.30.240.13:2113 - - EVENTSTORE_INT_IP=172.30.240.12 - - EVENTSTORE_CERTIFICATE_FILE=/etc/eventstore/certs/node2/node.crt - - EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/eventstore/certs/node2/node.key - - EVENTSTORE_ADVERTISE_HTTP_PORT_TO_CLIENT_AS=2112 + - EVENTSTORE_REPLICATION_IP=172.30.240.12 + - EVENTSTORE_CERTIFICATE_FILE=/etc/kurrentdb/certs/node2/node.crt + - EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/kurrentdb/certs/node2/node.key + - EVENTSTORE_ADVERTISE_NODE_PORT_TO_CLIENT_AS=2112 ports: - 2112:2113 networks: clusternetwork: ipv4_address: 172.30.240.12 - volumes: - - ./certs:/etc/eventstore/certs - restart: unless-stopped - depends_on: - - cert-gen esdb-node3: <<: *template - env_file: - - vars.env environment: - EVENTSTORE_GOSSIP_SEED=172.30.240.11:2113,172.30.240.12:2113 - - EVENTSTORE_INT_IP=172.30.240.13 - - EVENTSTORE_CERTIFICATE_FILE=/etc/eventstore/certs/node3/node.crt - - EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/eventstore/certs/node3/node.key - - EVENTSTORE_ADVERTISE_HTTP_PORT_TO_CLIENT_AS=2113 + - EVENTSTORE_REPLICATION_IP=172.30.240.13 + - EVENTSTORE_CERTIFICATE_FILE=/etc/kurrentdb/certs/node3/node.crt + - EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/kurrentdb/certs/node3/node.key + - EVENTSTORE_ADVERTISE_NODE_PORT_TO_CLIENT_AS=2113 ports: - 2113:2113 networks: clusternetwork: ipv4_address: 172.30.240.13 - volumes: - - ./certs:/etc/eventstore/certs - restart: unless-stopped - depends_on: - - cert-gen networks: clusternetwork: - name: eventstoredb.local + name: kurrentdb.local driver: bridge ipam: driver: default diff --git a/src/main/java/io/kurrent/dbclient/ReadAllOptions.java b/src/main/java/io/kurrent/dbclient/ReadAllOptions.java index 49aee11e..4d06a94c 100644 --- a/src/main/java/io/kurrent/dbclient/ReadAllOptions.java +++ b/src/main/java/io/kurrent/dbclient/ReadAllOptions.java @@ -8,7 +8,6 @@ public class ReadAllOptions extends OptionsWithPositionAndResolveLinkTosBase opts.defaultDeadline(1) .maxDiscoverAttempts(3)); @@ -21,11 +21,11 @@ default void testDefaultDeadline() throws Throwable { ExecutionException e = Assertions.assertThrows(ExecutionException.class, () -> client.appendToStream("toto", data).get()); StatusRuntimeException status = (StatusRuntimeException) e.getCause(); - Assertions.assertEquals(status.getStatus().getCode(), Status.Code.DEADLINE_EXCEEDED); + Assertions.assertEquals(Status.Code.DEADLINE_EXCEEDED, status.getStatus().getCode()); } @RetryingTest(3) - default void testOptionLevelDeadline() throws Throwable { + default void testOptionLevelDeadline() { KurrentDBClient client = getDatabase().defaultClient(); UUID id = UUID.randomUUID(); @@ -34,6 +34,59 @@ default void testOptionLevelDeadline() throws Throwable { ExecutionException e = Assertions.assertThrows(ExecutionException.class, () -> client.appendToStream("toto", options, data).get()); StatusRuntimeException status = (StatusRuntimeException) e.getCause(); - Assertions.assertEquals(status.getStatus().getCode(), Status.Code.DEADLINE_EXCEEDED); + Assertions.assertEquals(Status.Code.DEADLINE_EXCEEDED, status.getStatus().getCode()); + } + + @RetryingTest(3) + default void testReadStreamWithDefaultDeadline() { + KurrentDBClient client = getDatabase().connectWith(opts -> + opts.defaultDeadline(1) + .maxDiscoverAttempts(3)); + + ReadStreamOptions options = ReadStreamOptions.get(); + + ExecutionException e = Assertions.assertThrows(ExecutionException.class, () -> client.readStream("$users", options).get()); + StatusRuntimeException status = (StatusRuntimeException) e.getCause(); + + Assertions.assertEquals(Status.Code.DEADLINE_EXCEEDED, status.getStatus().getCode()); + } + + @RetryingTest(3) + default void testReadStreamWithLevelDeadline() { + KurrentDBClient client = getDefaultClient(); + + ExecutionException e = Assertions.assertThrows( + ExecutionException.class, + () -> client.readStream("$users", ReadStreamOptions.get().deadline(1)).get() + ); + StatusRuntimeException status = (StatusRuntimeException) e.getCause(); + + Assertions.assertEquals(Status.Code.DEADLINE_EXCEEDED, status.getStatus().getCode()); + } + + @RetryingTest(3) + default void testReadAllWithDefaultDeadline() { + KurrentDBClient client = getDatabase().connectWith(opts -> + opts.defaultDeadline(1) + .maxDiscoverAttempts(3)); + + ReadAllOptions options = ReadAllOptions.get(); + + ExecutionException e = Assertions.assertThrows(ExecutionException.class, () -> client.readAll(options).get()); + StatusRuntimeException status = (StatusRuntimeException) e.getCause(); + + Assertions.assertEquals(Status.Code.DEADLINE_EXCEEDED, status.getStatus().getCode()); + } + + @RetryingTest(3) + default void testReadAllWithLevelDeadline() { + KurrentDBClient client = getDefaultClient(); + + ReadAllOptions options = ReadAllOptions.get().deadline(1); + + ExecutionException e = Assertions.assertThrows(ExecutionException.class, () -> client.readAll(options).get()); + StatusRuntimeException status = (StatusRuntimeException) e.getCause(); + + Assertions.assertEquals(Status.Code.DEADLINE_EXCEEDED, status.getStatus().getCode()); } } diff --git a/vars.env b/vars.env index 7883b8c5..a3ecdad9 100644 --- a/vars.env +++ b/vars.env @@ -1,8 +1,8 @@ EVENTSTORE_CLUSTER_SIZE=3 EVENTSTORE_RUN_PROJECTIONS=All -EVENTSTORE_INT_TCP_PORT=1112 -EVENTSTORE_HTTP_PORT=2113 -EVENTSTORE_TRUSTED_ROOT_CERTIFICATES_PATH=/etc/eventstore/certs/ca +EVENTSTORE_REPLICATION_PORT=1112 +EVENTSTORE_NODE_PORT=2113 +EVENTSTORE_TRUSTED_ROOT_CERTIFICATES_PATH=/etc/kurrentdb/certs/ca EVENTSTORE_DISCOVER_VIA_DNS=false EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=true EVENTSTORE_ADVERTISE_HOST_TO_CLIENT_AS=localhost