Skip to content

Commit 87d287c

Browse files
committed
chore: split session test suite and increase token ttl
1 parent dd69fe2 commit 87d287c

File tree

4 files changed

+42
-7
lines changed

4 files changed

+42
-7
lines changed

.github/workflows/e2e-home-server.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ jobs:
6767
sed -i "s/ENCRYPTION_SERVER_KEY=/ENCRYPTION_SERVER_KEY=$(openssl rand -hex 32)/g" packages/home-server/.env
6868
sed -i "s/PSEUDO_KEY_PARAMS_KEY=/PSEUDO_KEY_PARAMS_KEY=$(openssl rand -hex 32)/g" packages/home-server/.env
6969
sed -i "s/VALET_TOKEN_SECRET=/VALET_TOKEN_SECRET=$(openssl rand -hex 32)/g" packages/home-server/.env
70-
echo "ACCESS_TOKEN_AGE=4" >> packages/home-server/.env
71-
echo "REFRESH_TOKEN_AGE=10" >> packages/home-server/.env
70+
if [[ "${{ inputs.suite }}" == "session" || "${{ inputs.suite }}" == "all" ]]; then
71+
echo "ACCESS_TOKEN_AGE=4" >> packages/home-server/.env
72+
echo "REFRESH_TOKEN_AGE=10" >> packages/home-server/.env
73+
else
74+
echo "ACCESS_TOKEN_AGE=120" >> packages/home-server/.env
75+
echo "REFRESH_TOKEN_AGE=600" >> packages/home-server/.env
76+
fi
7277
echo "REVISIONS_FREQUENCY=2" >> packages/home-server/.env
7378
echo "CONTENT_SIZE_TRANSFER_LIMIT=100000" >> packages/home-server/.env
7479
echo "HTTP_REQUEST_PAYLOAD_LIMIT_MEGABYTES=1" >> packages/home-server/.env
@@ -93,10 +98,10 @@ jobs:
9398
PORT: 3123
9499

95100
- name: Wait for server to start
96-
run: for i in {1..30}; do curl -s http://localhost:3123/healthcheck && break || sleep 1; done
101+
run: for i in {1..30}; do if curl -fsS http://localhost:3123/healthcheck; then exit 0; fi; sleep 1; done; echo "Server did not become healthy in time"; exit 1
97102

98103
- name: Run E2E Test Suite
99-
run: yarn dlx mocha-headless-chrome --timeout 3600000 --polling 1000 -a no-sandbox -a disable-setuid-sandbox -f http://localhost:9001/mocha/test.html?suite=${{ inputs.suite }}
104+
run: yarn dlx mocha-headless-chrome --timeout 3600000 --polling 1000 -a no-sandbox -a disable-setuid-sandbox -f "http://localhost:9001/mocha/test.html?suite=${{ inputs.suite }}&trace=1"
100105

101106
- name: Archive failed run logs
102107
if: ${{ failure() }}

.github/workflows/e2e-self-hosted.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,39 @@ jobs:
3939
- name: Install
4040
run: yarn install --immutable
4141

42+
- name: Resolve token ages for suite
43+
run: |
44+
if [[ "${{ inputs.suite }}" == "session" || "${{ inputs.suite }}" == "all" ]]; then
45+
echo "AUTH_SERVER_ACCESS_TOKEN_AGE=4" >> $GITHUB_ENV
46+
echo "AUTH_SERVER_REFRESH_TOKEN_AGE=10" >> $GITHUB_ENV
47+
else
48+
echo "AUTH_SERVER_ACCESS_TOKEN_AGE=120" >> $GITHUB_ENV
49+
echo "AUTH_SERVER_REFRESH_TOKEN_AGE=600" >> $GITHUB_ENV
50+
fi
51+
4252
- name: Run Server
4353
run: docker compose -f docker-compose.ci.yml up -d
4454
env:
4555
DB_TYPE: mysql
4656
CACHE_TYPE: redis
4757
SERVICE_PROXY_TYPE: ${{ matrix.service_proxy_type }}
58+
AUTH_SERVER_ACCESS_TOKEN_AGE: ${{ env.AUTH_SERVER_ACCESS_TOKEN_AGE }}
59+
AUTH_SERVER_REFRESH_TOKEN_AGE: ${{ env.AUTH_SERVER_REFRESH_TOKEN_AGE }}
4860

4961
- name: Output Server Logs to File
5062
run: docker compose -f docker-compose.ci.yml logs -f > logs/docker-compose.log 2>&1 &
5163
env:
5264
DB_TYPE: mysql
5365
CACHE_TYPE: redis
5466
SERVICE_PROXY_TYPE: ${{ matrix.service_proxy_type }}
67+
AUTH_SERVER_ACCESS_TOKEN_AGE: ${{ env.AUTH_SERVER_ACCESS_TOKEN_AGE }}
68+
AUTH_SERVER_REFRESH_TOKEN_AGE: ${{ env.AUTH_SERVER_REFRESH_TOKEN_AGE }}
5569

5670
- name: Wait for server to start
5771
run: docker/is-available.sh http://localhost:3123 $(pwd)/logs
5872

5973
- name: Run E2E Test Suite
60-
run: yarn dlx mocha-headless-chrome --timeout 3600000 --polling 1000 -a no-sandbox -a disable-setuid-sandbox -f http://localhost:9001/mocha/test.html?suite=${{ inputs.suite }}
74+
run: yarn dlx mocha-headless-chrome --timeout 3600000 --polling 1000 -a no-sandbox -a disable-setuid-sandbox -f "http://localhost:9001/mocha/test.html?suite=${{ inputs.suite }}&trace=1"
6175

6276
- name: Archive failed run logs
6377
if: ${{ failure() }}

.github/workflows/pr.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ jobs:
103103
snjs_image_tag: 'latest'
104104
suite: 'base'
105105

106+
e2e-session:
107+
needs: build
108+
name: E2E Session Suite
109+
uses: standardnotes/server/.github/workflows/common-e2e.yml@main
110+
with:
111+
snjs_image_tag: 'latest'
112+
suite: 'session'
113+
106114
e2e-vaults:
107115
needs: build
108116
name: E2E Vaults Suite

.github/workflows/publish.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ jobs:
106106
snjs_image_tag: 'latest'
107107
suite: 'base'
108108

109+
e2e-session:
110+
needs: build
111+
name: E2E Session Suite
112+
uses: standardnotes/server/.github/workflows/common-e2e.yml@main
113+
with:
114+
snjs_image_tag: 'latest'
115+
suite: 'session'
116+
109117
e2e-vaults:
110118
needs: build
111119
name: E2E Vaults Suite
@@ -115,13 +123,13 @@ jobs:
115123
suite: 'vaults'
116124

117125
publish-self-hosting:
118-
needs: [ test, lint, e2e-base, e2e-vaults ]
126+
needs: [ test, lint, e2e-base, e2e-session, e2e-vaults ]
119127
name: Publish Self Hosting Docker Image
120128
uses: standardnotes/server/.github/workflows/common-self-hosting.yml@main
121129
secrets: inherit
122130

123131
publish-services:
124-
needs: [ test, lint, e2e-base, e2e-vaults ]
132+
needs: [ test, lint, e2e-base, e2e-session, e2e-vaults ]
125133

126134
runs-on: ubuntu-latest
127135

0 commit comments

Comments
 (0)