Skip to content

Commit b0c00be

Browse files
committed
e2e tests for full scans
1 parent 9007613 commit b0c00be

File tree

5 files changed

+78
-2
lines changed

5 files changed

+78
-2
lines changed

.github/workflows/e2e-test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: E2E Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
e2e-scan:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
13+
with:
14+
fetch-depth: 0
15+
16+
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
17+
with:
18+
python-version: '3.12'
19+
20+
- name: Install CLI from local repo
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install .
24+
25+
- name: Run Socket CLI scan
26+
env:
27+
SOCKET_SECURITY_API_KEY: ${{ secrets.SOCKET_CLI_API_TOKEN }}
28+
run: |
29+
set -o pipefail
30+
socketcli \
31+
--target-path tests/e2e/fixtures/simple-npm \
32+
--disable-blocking \
33+
--enable-debug \
34+
2>&1 | tee /tmp/scan-output.log
35+
36+
- name: Verify scan produced a report
37+
run: |
38+
if grep -q "Full scan report URL: https://socket.dev/" /tmp/scan-output.log; then
39+
echo "PASS: Full scan report URL found"
40+
grep "Full scan report URL:" /tmp/scan-output.log
41+
elif grep -q "Diff Url: https://socket.dev/" /tmp/scan-output.log; then
42+
echo "PASS: Diff URL found"
43+
grep "Diff Url:" /tmp/scan-output.log
44+
else
45+
echo "FAIL: No report URL found in scan output"
46+
cat /tmp/scan-output.log
47+
exit 1
48+
fi

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "socketsecurity"
9-
version = "2.2.71"
9+
version = "2.2.72"
1010
requires-python = ">= 3.10"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.2.71'
2+
__version__ = '2.2.72'
33
USER_AGENT = f'SocketPythonCLI/{__version__}'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const express = require('express')
2+
const lodash = require('lodash')
3+
4+
const app = express()
5+
6+
app.get('/', (req, res) => {
7+
const data = lodash.pick(req.query, ['name', 'age'])
8+
res.json(data)
9+
})
10+
11+
app.listen(3000, () => {
12+
console.log(`Test fixture ${__filename} running on port 3000`)
13+
})
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "reach-test-fixture",
3+
"version": "1.0.0",
4+
"description": "Test fixture for reachability analysis",
5+
"main": "index.js",
6+
"dependencies": {
7+
"lodash": "4.17.21",
8+
"express": "4.18.2",
9+
"axios": "1.4.0"
10+
},
11+
"devDependencies": {
12+
"typescript": "5.0.4",
13+
"jest": "29.5.0"
14+
}
15+
}

0 commit comments

Comments
 (0)