Skip to content

Commit

Permalink
Update to use /v2 Module (#99)
Browse files Browse the repository at this point in the history
* Update to use /v2
* Update readme
* Fixup coverage failure
* Add tests for v1.2.2
* Exclude queues examples on old versions
  • Loading branch information
tmiddlet2666 authored Dec 5, 2024
1 parent a1f7a65 commit a2705c6
Show file tree
Hide file tree
Showing 83 changed files with 389 additions and 239 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/examples-jakarta-v1.2.2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright 2023, 2024 Oracle Corporation and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at
# https://oss.oracle.com/licenses/upl.

# ---------------------------------------------------------------------------
# Coherence Go Client GitHub Actions test examples against v23.03+
# and v1.2.2 client
# ---------------------------------------------------------------------------
name: CI-Examples Jakarta - v1.2.2

on:
workflow_dispatch:
push:
branches:
- '*'

jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
coherenceVersion:
- 24.09
- 24.09.1-SNAPSHOT
go-version:
- 1.19.x
- 1.20.x
- 1.21.x
- 1.22.x
- 1.23.x

# Checkout the source, we need a depth of zero to fetch all of the history otherwise
# the copyright check cannot work out the date of the files from Git.
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get Docker Images
shell: bash
run: |
docker pull gcr.io/distroless/java17
uname -a
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'

- name: Cache Go Modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mods-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mods-
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '${{ matrix.go-version }}'

- name: Verify Examples
shell: bash
run: |
git checkout v1.2.2
# Change the jib-maven-plugin as this version fails
sed -i.bak 's/<version.plugin.jib>3\.3\.0<\/version.plugin.jib>/<version.plugin.jib>3.4.3<\/version.plugin.jib>/' java/pom.xml
go get google.golang.org/grpc/cmd/[email protected]
COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 COHERENCE_VERSION=${{ matrix.coherenceVersion }} PROFILES=,jakarta,-javax make clean generate-proto build-test-images test-cluster-startup test-examples
make test-cluster-shutdown || true
- uses: actions/upload-artifact@v4
if: failure()
with:
name: test-output-${{ matrix.go-version }}-${{ matrix.coherenceVersion }}
path: build/_output/test-logs
5 changes: 0 additions & 5 deletions .github/workflows/examples-jakarta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ jobs:
with:
go-version: '${{ matrix.go-version }}'

- name: Copyright Check
shell: bash
run: |
make copyright
- name: Verify Examples
shell: bash
run: |
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/examples-v1.2.2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright 2022, 2024 Oracle Corporation and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at
# https://oss.oracle.com/licenses/upl.

# ---------------------------------------------------------------------------
# Coherence Go Client GitHub Actions test examples against v22.06 versions
# and v1.2.2 client
# ---------------------------------------------------------------------------
name: CI-Examples v22.06 - v1.2.2

on:
workflow_dispatch:
push:
branches:
- '*'

jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
coherenceVersion:
- 22.06.11-SNAPSHOT
- 22.06.10
go-version:
- 1.19.x
- 1.20.x
- 1.21.x
- 1.22.x
- 1.23.x

# Checkout the source, we need a depth of zero to fetch all of the history otherwise
# the copyright check cannot work out the date of the files from Git.
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get Docker Images
shell: bash
run: |
docker pull gcr.io/distroless/java:11
uname -a
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'

- name: Cache Go Modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mods-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mods-
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '${{ matrix.go-version }}'

- name: Verify Examples
shell: bash
run: |
git checkout v1.2.2
# Change the jib-maven-plugin as this version fails
sed -i.bak 's/<version.plugin.jib>3\.3\.0<\/version.plugin.jib>/<version.plugin.jib>3.4.3<\/version.plugin.jib>/' java/pom.xml
go get google.golang.org/grpc/cmd/[email protected]
COHERENCE_VERSION=${{ matrix.coherenceVersion }} PROFILES=,-jakarta,javax make clean generate-proto build-test-images test-cluster-startup test-examples
make test-cluster-shutdown || true
- uses: actions/upload-artifact@v4
if: failure()
with:
name: test-output-${{ matrix.go-version }}-${{ matrix.coherenceVersion }}
path: build/_output/test-logs
7 changes: 1 addition & 6 deletions .github/workflows/examples.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022, 2023 Oracle Corporation and/or its affiliates.
# Copyright 2022, 2024 Oracle Corporation and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at
# https://oss.oracle.com/licenses/upl.

Expand Down Expand Up @@ -68,11 +68,6 @@ jobs:
with:
go-version: '${{ matrix.go-version }}'

- name: Copyright Check
shell: bash
run: |
make copyright
- name: Verify Examples
shell: bash
run: |
Expand Down
35 changes: 11 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# ----------------------------------------------------------------------------------------------------------------------

# This is the version of the coherence-go-client
VERSION ?=2.0.0
VERSION ?=2.0.0-rc1
CURRDIR := $(shell pwd)
USER_ID := $(shell echo "`id -u`:`id -g`")

Expand Down Expand Up @@ -271,7 +271,7 @@ trivy-scan: gettrivy ## Scan the CLI using trivy
test: test-clean gotestsum $(BUILD_PROPS) ## Run the unit tests
CGO_ENABLED=0 $(GOTESTSUM) --format testname --junitfile $(TEST_LOGS_DIR)/coherence-test.xml \
-- $(GO_TEST_FLAGS) -v -coverprofile=$(COVERAGE_DIR)/cover-unit.out ./coherence/...
go tool cover -html=$(COVERAGE_DIR)/cover-unit.out -o $(COVERAGE_DIR)/cover-unit.html
go tool cover -func=$(COVERAGE_DIR)/cover-unit.out | grep -v '0.0%'


# ----------------------------------------------------------------------------------------------------------------------
Expand All @@ -280,48 +280,35 @@ test: test-clean gotestsum $(BUILD_PROPS) ## Run the unit tests
.PHONY: test-e2e-standalone
test-e2e-standalone: test-clean test gotestsum $(BUILD_PROPS) ## Run e2e tests with Coherence
CGO_ENABLED=0 $(GOTESTSUM) --format testname --junitfile $(TEST_LOGS_DIR)/go-client-test.xml \
-- $(GO_TEST_FLAGS) -v -coverprofile=$(COVERAGE_DIR)/cover-functional.out -v ./test/e2e/standalone/... -coverpkg=./coherence/...
go tool cover -html=$(COVERAGE_DIR)/cover-functional.out -o $(COVERAGE_DIR)/cover-functional.html
@echo
@echo "**** CODE COVERAGE ****"
@cat $(COVERAGE_DIR)/cover-functional.html | grep 'github.com/oracle/coherence-go-client/coherence' | grep option | sed 's/^.*github/github/' | sed 's,</option.*,,'
-- $(GO_TEST_FLAGS) -v -coverprofile=$(COVERAGE_DIR)/cover-functional.out -v ./test/e2e/standalone/... -coverpkg=github.com/oracle/coherence-go-client/v2/coherence/...
go tool cover -func=$(COVERAGE_DIR)/cover-functional.out | grep -v '0.0%'

# ----------------------------------------------------------------------------------------------------------------------
# Executes the Go end to end tests for standalone Coherence with Scope set
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: test-e2e-standalone-scope
test-e2e-standalone-scope: test-clean test gotestsum $(BUILD_PROPS) ## Run e2e tests with Coherence with Scope set
CGO_ENABLED=0 $(GOTESTSUM) --format testname --junitfile $(TEST_LOGS_DIR)/go-client-test-scope.xml \
-- $(GO_TEST_FLAGS) -v -coverprofile=$(COVERAGE_DIR)/cover-functional-scope.out -v ./test/e2e/scope/... -coverpkg=./coherence/...
go tool cover -html=$(COVERAGE_DIR)/cover-functional-scope.out -o $(COVERAGE_DIR)/cover-functional-scope.html
@echo
@echo "**** CODE COVERAGE ****"
@cat $(COVERAGE_DIR)/cover-functional-scope.html | grep 'github.com/oracle/coherence-go-client/coherence' | grep option | sed 's/^.*github/github/' | sed 's,</option.*,,'
-- $(GO_TEST_FLAGS) -v -coverprofile=$(COVERAGE_DIR)/cover-functional-scope.out -v ./test/e2e/scope/... -coverpkg=github.com/oracle/coherence-go-client/v2/coherence/...
go tool cover -func=$(COVERAGE_DIR)/cover-functional-scope.out | grep -v '0.0%'

# ----------------------------------------------------------------------------------------------------------------------
# Executes the Go end to end tests for standalone Coherence with Queues
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: test-e2e-standalone-queues
test-e2e-standalone-queues: test-clean test gotestsum $(BUILD_PROPS) ## Run e2e tests with Coherence queues
CGO_ENABLED=0 $(GOTESTSUM) --format testname --junitfile $(TEST_LOGS_DIR)/go-client-test-queues.xml \
-- $(GO_TEST_FLAGS) -v -coverprofile=$(COVERAGE_DIR)/cover-functional-queues.out -v ./test/e2e/queues/... -coverpkg=./coherence/...
go tool cover -html=$(COVERAGE_DIR)/cover-functional-queues.out -o $(COVERAGE_DIR)/cover-functional-queues.html
@echo
@echo "**** CODE COVERAGE ****"
@cat $(COVERAGE_DIR)/cover-functional-queues.html | grep 'github.com/oracle/coherence-go-client/coherence' | grep option | sed 's/^.*github/github/' | sed 's,</option.*,,'
-- $(GO_TEST_FLAGS) -v -coverprofile=$(COVERAGE_DIR)/cover-functional-queues.out -v ./test/e2e/queues/... -coverpkg=github.com/oracle/coherence-go-client/v2/coherence/...
go tool cover -func=$(COVERAGE_DIR)/cover-functional-queues.out | grep -v '0.0%'

# ----------------------------------------------------------------------------------------------------------------------
# Executes the Go end to end tests for gRPC v1 tests
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: test-v1-base
test-v1-base: test-clean test gotestsum $(BUILD_PROPS) ## Run e2e tests with Coherence
CGO_ENABLED=0 $(GOTESTSUM) --format testname --junitfile $(TEST_LOGS_DIR)/go-client-test-v1.xml \
-- $(GO_TEST_FLAGS) -v -coverprofile=$(COVERAGE_DIR)/cover-functional-v1.out -v ./test/v1/base/... -coverpkg=./coherence/...
go tool cover -html=$(COVERAGE_DIR)/cover-functional-v1.out -o $(COVERAGE_DIR)/cover-functional-v1.html
@echo
@echo "**** CODE COVERAGE ****"
@cat $(COVERAGE_DIR)/cover-functional-v1.html | grep 'github.com/oracle/coherence-go-client/coherence' | grep option | sed 's/^.*github/github/' | sed 's,</option.*,,'

-- $(GO_TEST_FLAGS) -v -coverprofile=$(COVERAGE_DIR)/cover-functional-v1.out -v ./test/v1/base/... -coverpkg=github.com/oracle/coherence-go-client/v2/coherence/...
go tool cover -func=$(COVERAGE_DIR)/cover-functional-v1.out | grep -v '0.0%'

# ----------------------------------------------------------------------------------------------------------------------
# Executes the test of the examples
Expand Down Expand Up @@ -369,7 +356,7 @@ test-coherence-shutdown: ## shutdown standalone cluster
.PHONY: gotestsum
GOTESTSUM = $(TOOLS_BIN)/gotestsum
gotestsum: ## Download gotestsum locally if necessary.
GOBIN=`pwd`/build/tools/bin go install gotest.tools/gotestsum@v1.8.1
GOBIN=`pwd`/build/tools/bin go install gotest.tools/gotestsum@v1.12.0

# ----------------------------------------------------------------------------------------------------------------------
# Cleans the test cache
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ docker run -d -p 1408:1408 -p 30000:30000 ghcr.io/oracle/coherence-ce:24.09
```bash
go get github.com/oracle/coherence-go-client@latest
````
After executing this command coherence-go-client is ready to use, and it's source will be in:

> Note: If you wish to use the latest v2.0.0-rc1, please use the following:

```bash
$GOPATH/pkg/mod/github.com/oracle/coherence-go-client@version
```
go get github.com/oracle/coherence-go-client/[email protected]
````
## <a name="doc"></a>Documentation
Expand All @@ -72,6 +73,8 @@ issues `Put()`, `Get()` and `Size()` operations.
> Note: Keys and values can also be Go `structs`. See detailed examples [here](examples#basic).
> Note: for v2.0.0-rc1, please import `github.com/oracle/coherence-go-client/v2/coherence`
```go
package main

Expand Down
8 changes: 4 additions & 4 deletions coherence/aggregators/aggregators.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
* Copyright (c) 2022, 2024 Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at
* https://oss.oracle.com/licenses/upl.
*/

package aggregators

import (
"github.com/oracle/coherence-go-client/coherence/extractors"
"github.com/oracle/coherence-go-client/coherence/filters"
"github.com/oracle/coherence-go-client/coherence/processors"
"github.com/oracle/coherence-go-client/v2/coherence/extractors"
"github.com/oracle/coherence-go-client/v2/coherence/filters"
"github.com/oracle/coherence-go-client/v2/coherence/processors"
"math/big"
)

Expand Down
6 changes: 3 additions & 3 deletions coherence/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ package coherence

import (
"context"
"github.com/oracle/coherence-go-client/coherence/filters"
"github.com/oracle/coherence-go-client/coherence/processors"
pb1 "github.com/oracle/coherence-go-client/proto/v1"
"github.com/oracle/coherence-go-client/v2/coherence/filters"
"github.com/oracle/coherence-go-client/v2/coherence/processors"
pb1 "github.com/oracle/coherence-go-client/v2/proto/v1"
"time"
)

Expand Down
4 changes: 2 additions & 2 deletions coherence/coherence_test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ package coherence

import (
"context"
"github.com/oracle/coherence-go-client/coherence/filters"
pb1 "github.com/oracle/coherence-go-client/proto/v1"
"github.com/oracle/coherence-go-client/v2/coherence/filters"
pb1 "github.com/oracle/coherence-go-client/v2/proto/v1"
"time"
)

Expand Down
12 changes: 6 additions & 6 deletions coherence/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
"context"
"errors"
"fmt"
"github.com/oracle/coherence-go-client/coherence/aggregators"
"github.com/oracle/coherence-go-client/coherence/extractors"
"github.com/oracle/coherence-go-client/coherence/filters"
"github.com/oracle/coherence-go-client/coherence/processors"
pb "github.com/oracle/coherence-go-client/proto"
pb1 "github.com/oracle/coherence-go-client/proto/v1"
"github.com/oracle/coherence-go-client/v2/coherence/aggregators"
"github.com/oracle/coherence-go-client/v2/coherence/extractors"
"github.com/oracle/coherence-go-client/v2/coherence/filters"
"github.com/oracle/coherence-go-client/v2/coherence/processors"
pb "github.com/oracle/coherence-go-client/v2/proto"
pb1 "github.com/oracle/coherence-go-client/v2/proto/v1"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/wrapperspb"
Expand Down
2 changes: 1 addition & 1 deletion coherence/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This API fully supports Go Generics and is only supported for use with Go versio
Example:
import (
coherence "github.com/oracle/coherence-go-client/coherence"
coherence "github.com/oracle/coherence-go-client/v2/coherence"
)
...
Expand Down
4 changes: 2 additions & 2 deletions coherence/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"context"
"errors"
"fmt"
"github.com/oracle/coherence-go-client/coherence/filters"
"github.com/oracle/coherence-go-client/proto"
"github.com/oracle/coherence-go-client/v2/coherence/filters"
"github.com/oracle/coherence-go-client/v2/proto"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"io"
Expand Down
Loading

0 comments on commit a2705c6

Please sign in to comment.