Skip to content

Commit 3db165b

Browse files
committed
ca certs tests review comment fixes
1 parent 80f02ce commit 3db165b

70 files changed

Lines changed: 795 additions & 547 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Setup Node Dependencies'
2+
description: 'Install Node.js and npm dependencies'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Setup Node.js
7+
uses: actions/setup-node@v4
8+
with:
9+
node-version: v22.17.0
10+
cache: 'npm'
11+
cache-dependency-path: './package-lock.json'
12+
13+
- name: Install node dependencies
14+
shell: bash
15+
run: npm ci --legacy-peer-deps
16+
17+
- name: Build libraries
18+
shell: bash
19+
run: |
20+
npm run build:graphql-docs
21+
npm run build:bruno-query
22+
npm run build:bruno-common
23+
npm run sandbox:bundle-libraries --workspace=packages/bruno-js
24+
npm run build:bruno-converters
25+
npm run build:bruno-requests
26+
npm run build:bruno-filestore
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 'Run Basic SSL CLI Tests - Linux'
2+
description: 'Run basic SSL CLI tests on Linux'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Run CLI tests
7+
shell: bash
8+
run: |
9+
set -euo pipefail
10+
11+
# navigate to basic SSL test collection directory
12+
cd tests/ssl/basic-ssl/collections/badssl
13+
14+
echo "basic ssl success"
15+
# should pass
16+
node ../../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit1.xml --insecure --format junit
17+
xmllint --xpath 'count(//testsuite[@errors="0"])' junit1.xml | grep -q "^1$" || exit 1
18+
19+
echo "with default/system ca certs"
20+
# should pass
21+
node ../../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit2.xml --format junit
22+
xmllint --xpath 'count(//testsuite[@errors="0"])' junit2.xml | grep -q "^1$" || exit 1
23+
24+
# navigate to self-signed SSL test collection directory
25+
cd ../self-signed-badssl
26+
27+
echo "self-signed ssl with validation disabled"
28+
# should pass
29+
node ../../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit3.xml --insecure --format junit
30+
xmllint --xpath 'count(//testsuite[@errors="0"])' junit3.xml | grep -q "^1$" || exit 1
31+
32+
echo "self-signed ssl with default/system ca certs"
33+
echo "request will error"
34+
# should fail
35+
node ../../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit4.xml --format junit 2>/dev/null || true
36+
xmllint --xpath 'count(//testsuite[@errors="1"])' junit4.xml | grep -q "^1$" || exit 1
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: 'Setup Basic SSL Feature Dependencies - Linux'
2+
description: 'Setup feature-specific dependencies for basic SSL tests on Linux'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Install additional OS dependencies for basic SSL tests
7+
shell: bash
8+
run: |
9+
sudo apt-get --no-install-recommends install -y \
10+
libxml2-utils
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 'Run Basic SSL CLI Tests - macOS'
2+
description: 'Run basic SSL CLI tests on macOS'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Run CLI tests
7+
shell: bash
8+
run: |
9+
set -euo pipefail
10+
11+
# navigate to basic SSL test collection directory
12+
cd tests/ssl/basic-ssl/collections/badssl
13+
14+
echo "basic ssl success"
15+
# should pass
16+
node ../../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit1.xml --insecure --format junit
17+
xmllint --xpath 'count(//testsuite[@errors="0"])' junit1.xml | grep -q "^1$" || exit 1
18+
19+
echo "with default/system ca certs"
20+
# should pass
21+
node ../../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit2.xml --format junit
22+
xmllint --xpath 'count(//testsuite[@errors="0"])' junit2.xml | grep -q "^1$" || exit 1
23+
24+
# navigate to self-signed SSL test collection directory
25+
cd ../self-signed-badssl
26+
27+
echo "self-signed ssl with validation disabled"
28+
# should pass
29+
node ../../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit3.xml --insecure --format junit
30+
xmllint --xpath 'count(//testsuite[@errors="0"])' junit3.xml | grep -q "^1$" || exit 1
31+
32+
echo "self-signed ssl with default/system ca certs"
33+
echo "request will error"
34+
# should fail
35+
node ../../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit4.xml --format junit 2>/dev/null || true
36+
xmllint --xpath 'count(//testsuite[@errors="1"])' junit4.xml | grep -q "^1$" || exit 1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: 'Setup Basic SSL Feature Dependencies - macOS'
2+
description: 'Setup feature-specific dependencies for basic SSL tests on macOS'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Install additional OS dependencies for basic SSL tests
7+
shell: bash
8+
run: |
9+
brew install libxml2
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 'Run Basic SSL CLI Tests - Windows'
2+
description: 'Run basic SSL CLI tests on Windows'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Run CLI tests
7+
shell: pwsh
8+
run: |
9+
Set-StrictMode -Version Latest
10+
$ErrorActionPreference = "Stop"
11+
12+
# navigate to basic SSL test collection directory
13+
Set-Location tests\ssl\basic-ssl\collections\badssl
14+
15+
Write-Host "basic ssl success"
16+
# should pass
17+
$process = Start-Process -FilePath "node" -ArgumentList "..\..\..\..\..\packages\bruno-cli\bin\bru.js run .\request.bru --output junit1.xml --insecure --format junit" -NoNewWindow -Wait -PassThru -RedirectStandardError "nul"
18+
[xml]$xml1 = Get-Content junit1.xml
19+
$testsuites1 = if ($xml1.testsuites) { $xml1.testsuites.testsuite } else { $xml1.testsuite }
20+
$errorCount1 = ($testsuites1 | Where-Object { $_.errors -eq "0" } | Measure-Object).Count
21+
if ($errorCount1 -ne 1) { exit 1 }
22+
23+
Write-Host "with default/system ca certs"
24+
# should pass
25+
$process = Start-Process -FilePath "node" -ArgumentList "..\..\..\..\..\packages\bruno-cli\bin\bru.js run .\request.bru --output junit2.xml --format junit" -NoNewWindow -Wait -PassThru -RedirectStandardError "nul"
26+
[xml]$xml2 = Get-Content junit2.xml
27+
$testsuites2 = if ($xml2.testsuites) { $xml2.testsuites.testsuite } else { $xml2.testsuite }
28+
$errorCount2 = ($testsuites2 | Where-Object { $_.errors -eq "0" } | Measure-Object).Count
29+
if ($errorCount2 -ne 1) { exit 1 }
30+
31+
# navigate to self-signed SSL test collection directory
32+
Set-Location ..\self-signed-badssl
33+
34+
Write-Host "self-signed ssl with validation disabled"
35+
# should pass
36+
$process = Start-Process -FilePath "node" -ArgumentList "..\..\..\..\..\packages\bruno-cli\bin\bru.js run .\request.bru --output junit3.xml --insecure --format junit" -NoNewWindow -Wait -PassThru -RedirectStandardError "nul"
37+
[xml]$xml3 = Get-Content junit3.xml
38+
$testsuites3 = if ($xml3.testsuites) { $xml3.testsuites.testsuite } else { $xml3.testsuite }
39+
$errorCount3 = ($testsuites3 | Where-Object { $_.errors -eq "0" } | Measure-Object).Count
40+
if ($errorCount3 -ne 1) { exit 1 }
41+
42+
Write-Host "self-signed ssl with default/system ca certs"
43+
Write-Host "request will error"
44+
# should fail
45+
$process = Start-Process -FilePath "node" -ArgumentList "..\..\..\..\..\packages\bruno-cli\bin\bru.js run .\request.bru --output junit4.xml --format junit" -NoNewWindow -Wait -PassThru -RedirectStandardError "nul"
46+
# Ignore the exit code - we expect this to fail
47+
[xml]$xml4 = Get-Content junit4.xml
48+
$testsuites4 = if ($xml4.testsuites) { $xml4.testsuites.testsuite } else { $xml4.testsuite }
49+
$errorCount4 = ($testsuites4 | Where-Object { $_.errors -eq "1" } | Measure-Object).Count
50+
if ($errorCount4 -ne 1) { exit 1 }
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Run Custom CA Certs CLI Tests - Linux'
2+
description: 'Run custom CA certs CLI tests on Linux'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Run CLI tests
7+
shell: bash
8+
run: |
9+
set -euo pipefail
10+
11+
# navigate to CA certificates test collection directory
12+
cd tests/ssl/custom-ca-certs/collection
13+
14+
echo "custom valid ca cert"
15+
# should pass
16+
node ../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit1.xml --cacert ../server/certs/ca-cert.pem --ignore-truststore --format junit
17+
xmllint --xpath 'count(//testsuite[@errors="0"])' junit1.xml | grep -q "^1$" || exit 1
18+
19+
echo "custom valid ca cert with defaults"
20+
# should pass
21+
node ../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit2.xml --cacert ../server/certs/ca-cert.pem --format junit
22+
xmllint --xpath 'count(//testsuite[@errors="0"])' junit2.xml | grep -q "^1$" || exit 1
23+
24+
echo "custom invalid ca cert"
25+
echo "request will error"
26+
# should fail
27+
node ../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit3.xml --cacert ../server/certs/ca-key.pem --ignore-truststore --format junit 2>/dev/null || true
28+
xmllint --xpath 'count(//testsuite[@errors="1"])' junit3.xml | grep -q "^1$" || exit 1
29+
30+
echo "custom invalid ca cert with defaults"
31+
# should pass
32+
node ../../../../packages/bruno-cli/bin/bru.js run ./request.bru --output junit4.xml --cacert ../server/certs/ca-key.pem --format junit
33+
xmllint --xpath 'count(//testsuite[@errors="0"])' junit4.xml | grep -q "^1$" || exit 1
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Run Custom CA Certs E2E Tests - Linux'
2+
description: 'Run custom CA certs E2E tests on Linux'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Run E2E tests
7+
shell: bash
8+
run: |
9+
set -euo pipefail
10+
11+
xvfb-run npm run test:e2e:custom_ca_certs
12+
13+
- name: Upload Playwright Report
14+
if: ${{ !cancelled() }}
15+
uses: actions/upload-artifact@v4
16+
with:
17+
name: playwright-report-linux
18+
path: playwright-report/
19+
retention-days: 30
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Setup CA Certificates - Linux'
2+
description: 'Setup CA certificates and start test server for custom CA certs tests on Linux'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Setup CA certificates
7+
shell: bash
8+
run: |
9+
set -euo pipefail
10+
11+
cd tests/ssl/custom-ca-certs/server
12+
13+
echo "running certificate setup"
14+
node scripts/generate-certs.js
15+
16+
- name: Start test server
17+
shell: bash
18+
run: |
19+
set -euo pipefail
20+
21+
cd tests/ssl/custom-ca-certs/server
22+
23+
echo "starting server in background"
24+
node index.js &
25+
26+
echo "server started with PID: $!"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'Setup Custom CA Certs Feature Dependencies - Linux'
2+
description: 'Setup feature-specific dependencies for custom CA certs tests on Linux'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Install additional OS dependencies for custom CA certs
7+
shell: bash
8+
run: |
9+
sudo apt-get --no-install-recommends install -y \
10+
libglib2.0-0 libnss3 libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgtk-3-0 libasound2t64 \
11+
xvfb libxml2-utils
12+
13+
sudo chown root /home/runner/work/bruno/bruno/node_modules/electron/dist/chrome-sandbox
14+
sudo chmod 4755 /home/runner/work/bruno/bruno/node_modules/electron/dist/chrome-sandbox

0 commit comments

Comments
 (0)