Skip to content

Commit aa6df75

Browse files
authored
Merge pull request #250 from TykTechnologies/release-5.3.0
Release 5.3.0
2 parents 95b95f5 + e28ad0e commit aa6df75

File tree

21 files changed

+346
-146
lines changed

21 files changed

+346
-146
lines changed

.github/workflows/tyk-demo-tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
1212
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
1313
- name: Check Out Repository Code
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
1616
- name: Create Environment File
1717
run: |
@@ -22,15 +22,15 @@ jobs:
2222
- name: Bootstrap and Test All Eligible Deployments
2323
run: sudo ./scripts/test-all.sh
2424
- name: Store Logs
25-
if: success() || failure()
26-
uses: actions/upload-artifact@v3
25+
if: always()
26+
uses: actions/upload-artifact@v4
2727
with:
2828
name: logs
2929
path: logs/
3030
- name: Show Bootstrap Log
31-
if: success() || failure()
31+
if: always()
3232
run: cat logs/bootstrap.log
3333
- name: Show Test Log
34-
if: success() || failure()
34+
if: always()
3535
run: cat logs/test.log
3636
- run: echo "🍏 This job's status is ${{ job.status }}."

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ These utility scripts are available in the `scripts` directory:
137137
* `add-gateway.sh`: Creates a new Tyk Gateway container, using the same configuration as the base Tyk deployment Gateway
138138
* `common.sh`: Contains functions useful for bootstrap scripts
139139
* `export.sh`: Uses the Dashboard API to export API and Policy definitions, overwriting data used to bootstrap the base Tyk deployment
140-
* `test.sh`: Uses a Newman container to run the Postman collection tests for only the **Tyk** deployment
140+
* `test.sh`: Uses a Newman container to run the Postman collection tests for all deployment that are currently bootstrapped
141141
* `test-all.sh`: As `test.sh`, but runs for all deployments
142142
* `update-hosts.sh`: Adds the necessary hosts to the `/etc/hosts` file
143143

@@ -299,6 +299,14 @@ Once the tests are finished, the `delete` function can be called to remove the k
299299
tyk.dashboardApi.tools.apiKey.delete(pm);
300300
```
301301

302+
## Test Automation
303+
304+
Deployments are included in test scripts (`scripts/test.sh` and `scripts/test-all.sh`) if all of the following criteria are met:
305+
306+
- A Postman collection is found in the deployment
307+
- The collection does *not* contain a variable `test-runner-ignore` with the value `true`
308+
- The collection contains tests
309+
302310
## Testing Responses
303311

304312
The Tyk Demo Postman collection contains many requests, each of which demonstrate a particular piece of functionality. Testing the responses generated by these requests provides validation that the desired result was achieved.

deployments/analytics-kibana/bootstrap.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ log_start_deployment
66
bootstrap_progress
77

88
kibana_base_url="http://localhost:5601"
9+
gateway_base_url="http://$(jq -r '.host_config.override_hostname' deployments/tyk/volumes/tyk-dashboard/tyk_analytics.conf)"
10+
gateway_api_credentials=$(cat deployments/tyk/volumes/tyk-gateway/tyk.conf | jq -r .secret)
911

1012
log_message "Waiting for kibana to return desired response"
1113
wait_for_response "$kibana_base_url/app/kibana" "200"
@@ -45,6 +47,12 @@ fi
4547
log_ok
4648
bootstrap_progress
4749

50+
log_message "Waiting for API availability"
51+
# this api id is for the 'basic open api' called by the next section
52+
wait_for_api_loaded "727dad853a8a45f64ab981154d1ffdad" "$gateway_base_url" "$gateway_api_credentials"
53+
log_ok
54+
bootstrap_progress
55+
4856
log_message "Sending a test request to provide Kibana with data, as Tyk bootstrap requests will not have been picked up by the Pump from this deployment"
4957
log_http_result "$(curl -s localhost:8080/basic-open-api/get -o /dev/null -w "%{http_code}" 2>> logs/bootstrap.log)"
5058
bootstrap_progress

deployments/analytics-splunk/bootstrap.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ bootstrap_progress
77

88
splunk_base_url="http://localhost:8000"
99
splunk_base_mgmt_url="https://localhost:8089"
10+
gateway_base_url="http://$(jq -r '.host_config.override_hostname' deployments/tyk/volumes/tyk-dashboard/tyk_analytics.conf)"
11+
gateway_api_credentials=$(cat deployments/tyk/volumes/tyk-gateway/tyk.conf | jq -r .secret)
1012

1113
log_message "Waiting for splunk to return desired response"
1214
wait_for_response "$splunk_base_url/en-GB/account/login" "200"
@@ -52,6 +54,14 @@ fi
5254
log_ok
5355
bootstrap_progress
5456

57+
log_message "Waiting for API availability"
58+
# this api id is for the 'basic open api' called by the next section
59+
wait_for_api_loaded "727dad853a8a45f64ab981154d1ffdad" "$gateway_base_url" "$gateway_api_credentials"
60+
# this api id is for the 'httpbin acme' API called by the deployment tests
61+
wait_for_api_loaded "93fd5c15961041115974216e7a3e7175" "$gateway_base_url" "$gateway_api_credentials"
62+
log_ok
63+
bootstrap_progress
64+
5565
log_message "Sending a test request to provide Splunk with data"
5666
# since request sent in base bootstrap process will not have been picked up by elasticsearch-enabled pump
5767
log_http_result "$(curl -s localhost:8080/basic-open-api/get -o /dev/null -w "%{http_code}" 2>> logs/bootstrap.log)"

deployments/federation/bootstrap.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/bin/bash
22

33
source scripts/common.sh
4-
deployment="GraphQL Federations"
4+
deployment="GraphQL Federation"
55
log_start_deployment
66

77
# Setup variables
88
dashboard_base_url="http://tyk-dashboard.localhost:$(jq -r '.listen_port' deployments/tyk/volumes/tyk-dashboard/tyk_analytics.conf)"
99
gateway_base_url="http://$(jq -r '.host_config.override_hostname' deployments/tyk/volumes/tyk-dashboard/tyk_analytics.conf)"
10+
gateway_api_credentials=$(cat deployments/tyk/volumes/tyk-gateway/tyk.conf | jq -r .secret)
1011
dashboard_admin_api_credentials=$(cat deployments/tyk/volumes/tyk-dashboard/tyk_analytics.conf | jq -r .admin_secret)
1112
dashboard_user_api_key=$(get_context_data "1" "dashboard-user" "1" "api-key")
1213

@@ -23,6 +24,17 @@ bootstrap_progress
2324
create_api "deployments/federation/data/apis-supergraph.json" "$dashboard_admin_api_credentials" "$dashboard_user_api_key"
2425
bootstrap_progress
2526

27+
log_message "Waiting for API availability"
28+
for file in deployments/federation/data/*; do
29+
if [[ -f $file ]]; then
30+
target_api_id=$(cat $file | jq '.api_definition.api_id' --raw-output)
31+
wait_for_api_loaded "$target_api_id" "$gateway_base_url" "$gateway_api_credentials"
32+
bootstrap_progress
33+
fi
34+
done
35+
bootstrap_progress
36+
log_ok
37+
2638
log_end_deployment
2739

2840
echo -e "\033[2K

deployments/keycloak-dcr/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run `keycloak-dcr` as one of your deployment configs, ie
1313
./up.sh keycloak-dcr
1414
```
1515

16-
Visit `http://localhost:8180/auth/admin/` to access the keycloak admin console, and login with the credentials `admin/admin`
16+
Visit `http://keycloak:8180/` to access the keycloak admin console, and login with the credentials `admin/admin`
1717

1818
Under the Client Registration tab you should find that an `initial access` token has been automagically created during the deployment bootstrap.
1919

deployments/keycloak-dcr/bootstrap.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ dashboard_admin_api_credentials=$(cat deployments/tyk/volumes/tyk-dashboard/tyk_
1010
dashboard_user_api_key=$(get_context_data "1" "dashboard-user" "1" "api-key")
1111
gateway_base_url="http://tyk-gateway.localhost:8080"
1212
gateway_api_credentials=$(cat deployments/tyk/volumes/tyk-gateway/tyk.conf | jq -r .secret)
13-
keycloak_base_url="http://keycloak:8180/auth"
14-
keycloak_admin_url="http://keycloak:8180/auth/admin"
13+
keycloak_base_url="http://keycloak:8180"
1514

1615
log_message "Waiting for Dashboard API to be ready"
1716
wait_for_response "$dashboard_base_url/admin/organisations" "200" "admin-auth: $dashboard_admin_api_credentials"
1817

1918
log_message "Waiting for Keycloak to respond ok"
20-
wait_for_response "$keycloak_base_url/" "200"
19+
wait_for_response "$keycloak_base_url/health/ready" "200"
2120

2221

2322
log_message "Obtaining keycloak user access token"
@@ -34,7 +33,7 @@ bootstrap_progress
3433

3534

3635
log_message "Creating a new initial access token"
37-
api_response="$(curl $keycloak_admin_url/realms/master/clients-initial-access -s \
36+
api_response="$(curl $keycloak_base_url/admin/realms/master/clients-initial-access -s \
3837
-H "Content-Type: application/json" \
3938
-H "Authorization: Bearer $access_token" \
4039
-d '{"count": 5}')"
@@ -107,7 +106,7 @@ bootstrap_progress
107106
log_end_deployment
108107

109108
echo -e "\033[2K
110-
IdP
109+
Dynamic Client Registration
111110
▽ Keycloak
112-
Browser URL : $keycloak_admin_url
113-
Login : admin/admin"
111+
Browser URL : $keycloak_base_url
112+
Username/Password : admin/admin"

deployments/keycloak-dcr/data/tyk-dashboard/apis.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
"use_go_plugin_auth": false,
178178
"enable_coprocess_auth": false,
179179
"jwt_signing_method": "rsa",
180-
"jwt_source": "aHR0cDovL2tleWNsb2FrOjgxODAvYXV0aC9yZWFsbXMvbWFzdGVyL3Byb3RvY29sL29wZW5pZC1jb25uZWN0L2NlcnRz",
180+
"jwt_source": "aHR0cDovL2tleWNsb2FrOjgxODAvcmVhbG1zL21hc3Rlci9wcm90b2NvbC9vcGVuaWQtY29ubmVjdC9jZXJ0cw==",
181181
"jwt_identity_base_field": "sub",
182182
"jwt_client_base_field": "",
183183
"jwt_policy_field_name": "pol",
@@ -258,7 +258,7 @@
258258
"proxy": {
259259
"preserve_host_header": false,
260260
"listen_path": "/keycloak-dcr-api/",
261-
"target_url": "http://httpbin.org",
261+
"target_url": "http://httpbin",
262262
"disable_strip_slash": true,
263263
"strip_listen_path": true,
264264
"enable_load_balancing": false,

deployments/keycloak-dcr/data/tyk-dashboard/catalog.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"dcr_options": {
5555
"idp_host": "http://keycloak:8180/",
5656
"access_token": "ACCESS_TOKEN",
57-
"registration_endpoint": "http://keycloak:8180/auth/realms/master/clients-registrations/openid-connect",
57+
"registration_endpoint": "http://keycloak:8180/realms/master/clients-registrations/openid-connect",
5858
"provider": "keycloak",
5959
"grant_types": [
6060
"client_credentials"
Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
version: '3.3'
2+
version: "3.3"
33
services:
44
keycloak-db:
55
image: postgres:9.6
@@ -10,11 +10,15 @@ services:
1010
networks:
1111
- tyk
1212
ports:
13-
- "25432:5432"
13+
- 25432:5432
1414
volumes:
1515
- keycloak-data:/var/lib/postresql/data
1616
healthcheck:
17-
test: [ "CMD", "pg_isready", "-U", "keycloak" ]
17+
test:
18+
- CMD
19+
- pg_isready
20+
- -U
21+
- keycloak
1822
interval: 30s
1923
timeout: 30s
2024
retries: 3
@@ -23,23 +27,25 @@ services:
2327
restart_policy:
2428
condition: on-failure
2529
keycloak:
26-
image: jboss/keycloak:11.0.2
30+
image: keycloak/keycloak:24.0.1
2731
depends_on:
2832
- keycloak-db
29-
command: [ "-Djboss.http.port=8180" ]
3033
networks:
3134
- tyk
3235
ports:
33-
- "8180:8180"
36+
- 8180:8180
37+
command:
38+
- start-dev
3439
environment:
35-
DB_VENDOR: POSTGRES
36-
DB_ADDR: keycloak-db
37-
DB_PORT: 5432
38-
DB_DATABASE: keycloak
39-
DB_USER: keycloak
40-
DB_PASSWORD: keycloak
41-
KEYCLOAK_USER: admin
42-
KEYCLOAK_PASSWORD: admin
43-
40+
KC_DB: postgres
41+
KC_DB_URL_HOST: keycloak-db
42+
KC_DB_URL_PORT: 5432
43+
KC_DB_URL_DATABASE: keycloak
44+
KC_DB_USERNAME: keycloak
45+
KC_DB_PASSWORD: keycloak
46+
KEYCLOAK_ADMIN: admin
47+
KEYCLOAK_ADMIN_PASSWORD: admin
48+
KC_HEALTH_ENABLED: true
49+
KC_HTTP_PORT: 8180
4450
volumes:
45-
keycloak-data:
51+
keycloak-data: null

0 commit comments

Comments
 (0)