Skip to content

Commit 2f203a9

Browse files
feat(csit): add SPIRE test environment
Signed-off-by: Bendegúz Csirmaz <csirmazbendeguz@gmail.com>
1 parent 4030575 commit 2f203a9

19 files changed

Lines changed: 1183 additions & 14 deletions

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# IDEs
2+
.vscode/
3+
.idea/
4+
.continue/
5+
16
# Byte-compiled / optimized / DLL files
27
__pycache__/
38
*.py[cod]
@@ -126,6 +131,7 @@ integrations/**/charts/*
126131
integrations/kubeconfig.yaml
127132

128133
# Binaries for testing
134+
.bin
129135
integrations/**/.bin
130136

131137
# Agentic tools

integrations/agntcy-dir/Taskfile.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version: "3"
77
silent: true
88

99
includes:
10-
tests:client-server:
10+
tests:client-server:
1111
taskfile: ./tests/conformance/Taskfile.yml
1212

1313
vars:
@@ -317,5 +317,13 @@ tasks:
317317
# NOTE: The attribute may removed already, silent errors
318318
xattr -d com.apple.quarantine "{{.DIRCTL_BIN_PATH}}/dirctl" &> /dev/null || true
319319
320+
download:gomplate:
321+
desc: "Install gomplate"
322+
vars:
323+
GOMPLATE_VERSION: "5.1.0"
324+
cmd: go install github.com/hairyhenderson/gomplate/v5/cmd/gomplate@v{{ .GOMPLATE_VERSION }}
325+
status:
326+
- "! command -v gomplate"
327+
320328
default:
321329
cmd: task -l

integrations/agntcy-dir/tests/conformance/Taskfile.yml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ includes:
1313
taskfile: "./server/v1.2.0/Taskfile.yml"
1414
server:v1.3.0:
1515
taskfile: "./server/v1.3.0/Taskfile.yml"
16+
server:v1.3.0-spire:
17+
taskfile: "./server/v1.3.0-spire/Taskfile.yml"
1618

1719
tasks:
1820
up:
1921
vars:
2022
SERVER_VERSION: '{{.SERVER_VERSION}}'
21-
CLIENT_VERSION: '{{.CLIENT_VERSION}}'
23+
# e.g. if CLIENT_ENV=v1.3.0-spire then CLIENT_VERSION=v1.3.0
24+
CLIENT_VERSION: '{{ splitList "-" .CLIENT_VERSION | first }}'
25+
CLIENT_VERSION_FULL: '{{.CLIENT_VERSION}}'
2226
TMP_PATH: '{{ .TMP_PATH | default "/tmp/tests/client-server" }}'
27+
PATCH_FILE: '{{.TASKFILE_DIR}}/patches/e2e-shared-utils-common.go'
2328
cmds:
2429
# Prepare suite
2530
- |
@@ -30,6 +35,19 @@ tasks:
3035
go mod tidy
3136
go get -t {{.CONFORMANCE_CLIENT_TEST_PKG}}@{{.CLIENT_VERSION}}
3237
38+
if echo "{{.SERVER_VERSION}}" | grep -q spire; then
39+
OVERLAY="{{.TMP_PATH}}/dir-tests-overlay"
40+
TESTS_MOD="$(go env GOMODCACHE)/github.com/agntcy/dir/tests@{{.CLIENT_VERSION}}"
41+
rm -rf "$OVERLAY"
42+
mkdir -p "$OVERLAY"
43+
cp -R "$TESTS_MOD/." "$OVERLAY/"
44+
chmod -R u+w "$OVERLAY"
45+
cp "{{.PATCH_FILE}}" "$OVERLAY/e2e/shared/utils/common.go"
46+
go mod edit -require=github.com/agntcy/dir/tests@{{.CLIENT_VERSION}}
47+
go mod edit -replace github.com/agntcy/dir/tests="$OVERLAY"
48+
go get -t {{.CONFORMANCE_CLIENT_TEST_PKG}}@{{.CLIENT_VERSION}}
49+
fi
50+
3351
# Start dependencies
3452
- task: server:{{.SERVER_VERSION}}:up
3553

@@ -50,8 +68,8 @@ tasks:
5068
SERVER_VERSION: '{{.SERVER_VERSION | default "v1.3.0" }}'
5169
CLIENT_VERSION: '{{.CLIENT_VERSION | default "v1.3.0" }}'
5270

53-
CLIENT_CONFIG: '{{.ROOT_DIR}}/integrations/agntcy-dir/tests/conformance/client/{{.CLIENT_VERSION}}/test-config.yaml'
54-
REPORTS_PATH: '{{.ROOT_DIR}}/integrations/agntcy-dir/tests/conformance/reports'
71+
CLIENT_CONFIG: '{{.TASKFILE_DIR}}/client/{{.CLIENT_VERSION}}/test-config.yaml'
72+
REPORTS_PATH: '{{.TASKFILE_DIR}}/reports'
5573

5674
REPORTS_NAME: 'Server-{{.SERVER_VERSION}}-Client-{{.CLIENT_VERSION}}'
5775
TMP_PATH: '/tmp/tests/{{.REPORTS_NAME}}'
@@ -71,11 +89,24 @@ tasks:
7189

7290
# Run test package
7391
- |
92+
echo "Testing {{.REPORTS_NAME}}..."
7493
mkdir -p {{.REPORTS_PATH}}
7594
cd {{.TMP_PATH}}
95+
96+
# If there's an .env file, use it
97+
ENV_FILE="{{ .TASKFILE_DIR }}/server/{{ .SERVER_VERSION }}/.env"
98+
if [ -f "$ENV_FILE" ]; then
99+
echo "Using $ENV_FILE"
100+
. "$ENV_FILE"
101+
fi
102+
103+
if echo "{{.SERVER_VERSION}}" | grep -q spire; then
104+
export SPIFFE_SOCKET_PATH="${SPIFFE_SOCKET_PATH:-unix:///tmp/spire-agent-host/public/api.sock}"
105+
fi
106+
76107
go test {{.CONFORMANCE_CLIENT_TEST_PKG}} \
77-
-v -test.v -test.paniconexit0 -timeout 2h \
78-
-ginkgo.timeout 2h -ginkgo.v \
108+
-v -test.v -test.paniconexit0 -timeout 45m \
109+
-ginkgo.timeout 45m -ginkgo.v \
79110
-ginkgo.json-report={{.REPORTS_PATH}}/{{.REPORTS_NAME}}.json \
80111
-ginkgo.junit-report={{.REPORTS_PATH}}/{{.REPORTS_NAME}}.xml \
81112
-test-config {{.CLIENT_CONFIG}}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
client:
2+
run_rate_limit_tests: false
3+
client_options:
4+
server_address: "localhost:8888"
5+
auth_mode: "x509"
6+
spiffe_socket_path: "unix:///tmp/spire-agent-host/public/api.sock"

0 commit comments

Comments
 (0)