Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/gateway-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- main
paths:
- 'gateway/**'
- 'common/**'
- '.github/workflows/gateway-integration-test.yml'

jobs:
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/sdk-integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: SDK Integration Test

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'sdk/**'
- '.github/workflows/sdk-integration-test.yml'

jobs:
integration-test:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Inject local SDK into gateway modules
run: |
cd gateway/gateway-runtime/policy-engine
go mod edit -replace github.com/wso2/api-platform/sdk=../../../sdk

cd ../../gateway-builder
go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk

cd ../gateway-controller
go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk
Comment on lines +27 to +36
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Missing go mod tidy after injecting replace directives.

After go mod edit -replace, the go.sum files won't reflect the local SDK's transitive dependencies. If the local SDK differs from v0.3.9 in its dependency graph, subsequent go build or go test may fail or fetch unexpected versions. Run go mod tidy in each module after editing.

Also, the chained cd navigation is fragile — consider using absolute paths from $GITHUB_WORKSPACE for clarity.

Proposed fix
       - name: Inject local SDK into gateway modules
         run: |
-          cd gateway/gateway-runtime/policy-engine
-          go mod edit -replace github.com/wso2/api-platform/sdk=../../../sdk
+          cd $GITHUB_WORKSPACE/gateway/gateway-runtime/policy-engine
+          go mod edit -replace github.com/wso2/api-platform/sdk=../../../sdk
+          go mod tidy
 
-          cd ../../gateway-builder
-          go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk
+          cd $GITHUB_WORKSPACE/gateway/gateway-builder
+          go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk
+          go mod tidy
 
-          cd ../gateway-controller
-          go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk
+          cd $GITHUB_WORKSPACE/gateway/gateway-controller
+          go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk
+          go mod tidy
🤖 Prompt for AI Agents
In @.github/workflows/sdk-integration-test.yml around lines 27 - 36, The
workflow step that injects the local SDK via go mod edit -replace into the
modules (gateway/gateway-runtime/policy-engine, gateway-builder,
gateway-controller) is missing go mod tidy, which can leave go.sum inconsistent;
after each go mod edit -replace invocation run go mod tidy in the same module to
update go.sum and pull correct transitive deps, and make the step more robust by
using absolute paths based on $GITHUB_WORKSPACE instead of chained cd commands
so each module (policy-engine, gateway-builder, gateway-controller) is edited
and tidied reliably.


- name: Build gateway images
run: |
cd gateway
make build-local VERSION=test

- name: Build mock server images
run: |
for mock in mock-jwks mock-azure-content-safety mock-aws-bedrock-guardrail mock-embedding-provider mock-analytics-collector; do
echo "Building $mock..."
docker build -t ghcr.io/wso2/api-platform/$mock:latest tests/mock-servers/$mock
done

- name: Run gateway integration tests
run: |
cd gateway
make test-integration

- name: Debug on failure - Dump logs
if: failure()
run: |
echo "=== Docker Containers ==="
docker ps -a

echo ""
echo "=== gateway/it/logs Directory Contents ==="
if [ -d gateway/it/logs ]; then
if [ "$(ls -A gateway/it/logs)" ]; then
for f in gateway/it/logs/*; do
echo ""
echo "--- Contents of $f ---"
cat "$f"
done
else
echo "No log files found in gateway/it/logs."
fi
else
echo "Directory gateway/it/logs does not exist."
fi
7 changes: 3 additions & 4 deletions gateway/gateway-builder/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ go 1.25.1

require (
github.com/stretchr/testify v1.11.1
github.com/wso2/api-platform/sdk v0.0.0
github.com/wso2/api-platform/sdk v0.3.9
golang.org/x/mod v0.32.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/sys v0.39.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)

// Local module replacements for Docker builds
replace github.com/wso2/api-platform/sdk => ../../sdk
6 changes: 6 additions & 0 deletions gateway/gateway-builder/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/wso2/api-platform/sdk v0.3.9 h1:zL2knXB7ZYrGvhCV6SnVwDEfK/YkcEx8gXw8I/Ty+u0=
github.com/wso2/api-platform/sdk v0.3.9/go.mod h1:pEUne6LknzYXF7htjYWNTTa3Lku3DfhI26dwFnEzK1A=
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
8 changes: 2 additions & 6 deletions gateway/gateway-controller/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/prometheus/client_model v0.6.2
github.com/stretchr/testify v1.11.1
github.com/wso2/api-platform/common v0.0.0
github.com/wso2/api-platform/sdk v0.0.0
github.com/wso2/api-platform/sdk v0.3.9
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/crypto v0.47.0
google.golang.org/grpc v1.78.0
Expand Down Expand Up @@ -104,8 +104,4 @@ require (
// combinedWatcher is using "github.com/envoyproxy/go-control-plane/pkg/server/stream/v3" StreamState which is not available in v0.14.0
replace github.com/envoyproxy/go-control-plane v0.13.5-0.20251024222203-75eaa193e329 => github.com/envoyproxy/go-control-plane v0.13.4

// Local module replacements for Docker builds
replace (
github.com/wso2/api-platform/common => ../../common
github.com/wso2/api-platform/sdk => ../../sdk
)
replace github.com/wso2/api-platform/common => ../../common
2 changes: 2 additions & 0 deletions gateway/gateway-controller/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY
github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/woodsbury/decimal128 v1.3.0 h1:8pffMNWIlC0O5vbyHWFZAt5yWvWcrHA+3ovIIjVWss0=
github.com/woodsbury/decimal128 v1.3.0/go.mod h1:C5UTmyTjW3JftjUFzOVhC20BEQa2a4ZKOB5I6Zjb+ds=
github.com/wso2/api-platform/sdk v0.3.9 h1:zL2knXB7ZYrGvhCV6SnVwDEfK/YkcEx8gXw8I/Ty+u0=
github.com/wso2/api-platform/sdk v0.3.9/go.mod h1:pEUne6LknzYXF7htjYWNTTa3Lku3DfhI26dwFnEzK1A=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
Expand Down
3 changes: 0 additions & 3 deletions gateway/gateway-runtime/policy-engine/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,4 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
)

// Local module replacements for Docker builds
replace github.com/wso2/api-platform/sdk => ../../../sdk

replace github.com/wso2/api-platform/common => ../../../common
2 changes: 2 additions & 0 deletions gateway/gateway-runtime/policy-engine/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/wso2/api-platform/sdk v0.3.9 h1:zL2knXB7ZYrGvhCV6SnVwDEfK/YkcEx8gXw8I/Ty+u0=
github.com/wso2/api-platform/sdk v0.3.9/go.mod h1:pEUne6LknzYXF7htjYWNTTa3Lku3DfhI26dwFnEzK1A=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
Expand Down
3 changes: 1 addition & 2 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1738,8 +1738,6 @@ github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRy
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/linkedin/goavro v2.1.0+incompatible h1:DV2aUlj2xZiuxQyvag8Dy7zjY69ENjS66bWkSfdpddY=
Expand Down Expand Up @@ -2085,6 +2083,7 @@ github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
github.com/wso2/api-platform/sdk v0.3.9/go.mod h1:pEUne6LknzYXF7htjYWNTTa3Lku3DfhI26dwFnEzK1A=
github.com/wso2/gateway-controllers/policies/advanced-ratelimit v0.1.1/go.mod h1:zjPJeiHlwgHVoPOcS3/F0NYEwqd+IIwXlE2gvjDcAIk=
github.com/wso2/gateway-controllers/policies/jwt-auth v0.1.1/go.mod h1:ja+VqRS5BT4nxvoCuSDHFpU+yTmxe8E0bZerfhEJoQ0=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
Expand Down
Loading