Skip to content

Commit 6f25d5e

Browse files
author
Tim Middleton
committed
Add tls tests for dapr
1 parent 1d7d0f6 commit 6f25d5e

File tree

4 files changed

+131
-2
lines changed

4 files changed

+131
-2
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Copyright 2024, 2025 Oracle Corporation and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at
3+
# https://oss.oracle.com/licenses/upl.
4+
5+
# ---------------------------------------------------------------------------
6+
# Coherence Go Client GitHub Actions CI build DAPR TLS
7+
# ---------------------------------------------------------------------------
8+
name: CI DAPR TLS
9+
10+
on:
11+
workflow_dispatch:
12+
push:
13+
branches:
14+
- '*'
15+
schedule:
16+
# Every day at midnight
17+
- cron: '0 0 * * *'
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-22.04
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
coherenceVersion:
28+
- 25.09-SNAPSHOT
29+
- 25.03.1
30+
go-version:
31+
- 1.24.x
32+
33+
# Checkout the source, we need a depth of zero to fetch all of the history otherwise
34+
# the copyright check cannot work out the date of the files from Git.
35+
steps:
36+
- uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
40+
- name: Get Docker Images
41+
shell: bash
42+
run: |
43+
docker pull gcr.io/distroless/java17-debian12
44+
45+
- name: Set up JDK 17 for Build
46+
uses: actions/setup-java@v4
47+
with:
48+
java-version: '17'
49+
distribution: 'zulu'
50+
51+
- name: Cache Go Modules
52+
uses: actions/cache@v4
53+
with:
54+
path: ~/go/pkg/mod
55+
key: ${{ runner.os }}-go-mods-${{ hashFiles('**/go.sum') }}
56+
restore-keys: |
57+
${{ runner.os }}-go-mods-
58+
59+
- name: Cache Maven packages
60+
uses: actions/cache@v4
61+
with:
62+
path: ~/.m2
63+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
64+
restore-keys: ${{ runner.os }}-m2
65+
66+
- name: Set up Go
67+
uses: actions/setup-go@v5
68+
with:
69+
go-version: '${{ matrix.go-version }}'
70+
71+
- name: Test DAPR
72+
env:
73+
COH_VERSION: ${{ matrix.coherenceVersion }}
74+
shell: bash
75+
run: |
76+
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
77+
COHERENCE_BASE_IMAGE=gcr.io/distroless/java17-debian12 PROFILES=,jakarta,-javax COHERENCE_VERSION=$COH_VERSION make certs clean generate-proto generate-proto-v1 build-test-images test-cluster-startup
78+
make test-dapr
79+
make test-cluster-shutdown
80+
81+
- uses: actions/upload-artifact@v4
82+
if: failure()
83+
with:
84+
name: test-output-${{ matrix.go-version }}-${{ matrix.coherenceVersion }}
85+
path: build/_output/test-logs

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,13 @@ test-examples: test-clean gotestsum $(BUILD_PROPS) ## Run examples tests with Co
476476
test-dapr: test-clean gotestsum $(BUILD_PROPS) ## Run dapr tests with Coherence
477477
./scripts/run-test-dapr.sh $(DAPR_TEST_DIR) $(DAPR_DIR)
478478

479+
# ----------------------------------------------------------------------------------------------------------------------
480+
# Executes the tests for DAPR TLS
481+
# ----------------------------------------------------------------------------------------------------------------------
482+
.PHONY: test-dapr-tls
483+
test-dapr-tls: test-clean gotestsum $(BUILD_PROPS) ## Run dapr tests with Coherence with TLS
484+
./scripts/run-test-dapr.sh $(DAPR_TEST_DIR) $(DAPR_DIR) true
485+
479486
# ----------------------------------------------------------------------------------------------------------------------
480487
# Startup cluster members via docker compose
481488
# ----------------------------------------------------------------------------------------------------------------------

scripts/run-test-dapr.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@
88

99
set -e
1010

11-
if [ $# -ne 2 ]; then
11+
if [ $# -lt 2 ]; then
1212
echo "You must specify the dapr test directory and dapr dir to install to"
1313
exit 1
1414
fi
1515

16+
TLS=false
17+
18+
if [ $# -eq 3 && "$3" == "tls" ]; then
19+
TLS=true
20+
fi
21+
1622
DAPR_TEST_DIR=$1
1723
DAPR_TEST_HOME=$2
1824

1925
mkdir -p $DAPR_TEST_HOME
2026

2127
echo "DAPR Test Dir: $DAPR_TEST_DIR"
2228
echo "DAPR Test Home: $DAPR_TEST_HOME"
29+
echo "TLS: $TLS"
2330

2431
echo "Install DAPR"
2532
OS=`uname`
@@ -108,7 +115,12 @@ cd $DAPR_TEST_DIR
108115
cd my-dapr-app
109116
go mod tidy
110117

111-
dapr run --app-id myapp --resources-path ./components/ --log-level debug -- go run main.go
118+
COMPONENTS=./components/
119+
if [ "$TLS" == "true" ]; then
120+
COMPONENTS=./components-tls/
121+
fi
122+
123+
dapr run --app-id myapp --resources-path $COMPONENTS --log-level debug -- go run main.go
112124

113125
# Verify the caches
114126
cohctl get cache -o wide
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Copyright (c) 2025 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at
4+
# https://oss.oracle.com/licenses/upl.
5+
#
6+
apiVersion: dapr.io/v1alpha1
7+
kind: Component
8+
metadata:
9+
name: statestore
10+
spec:
11+
type: state.coherence
12+
version: v1
13+
metadata:
14+
- name: serverAddress
15+
value: localhost:1408
16+
- name: tlsEnabled
17+
value: true
18+
- name: tlsClientCertPath
19+
value: ../../utils/certs/star-lord.crt
20+
- name: tlsClientKey
21+
value: ../../utils/certs/star-lord.key
22+
- name: tlsCertsPath
23+
value: ../../utils/certs/guardians-ca.crt
24+
- name: ignoreInvalidCerts
25+
value: true

0 commit comments

Comments
 (0)