Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 4f674aa

Browse files
jorgestiganigthknightJ12934
committed
Add integration test for ReadWrite hook
Co-authored-by: Yannik Fuhrmeister <12710254+fuhrmeistery@users.noreply.github.com> Co-authored-by: Jannik Hollenbach <jannik@hollenbach.de>
1 parent 1f19210 commit 4f674aa

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,18 @@ jobs:
321321
cd tests/integration/
322322
npm ci
323323
# This steps should include Integration tests which are not related to a Specific Scanner
324-
- name: "Generic Integration Tests"
324+
- name: "Throws NoScanDefiniton Error Integration Tests"
325325
run: |
326326
cd tests/integration/
327327
npx jest --ci --color no-scan-definition-error
328+
- name: "Hooks Integration Tests"
329+
run: |
330+
helm -n integration-tests install update-category ./hooks/update-field --set="attribute.name=category" --set="attribute.value=fancy-category"
331+
helm -n integration-tests install update-severity ./hooks/update-field --set="attribute.name=severity" --set="attribute.value=high"
332+
helm -n integration-tests install test-scan ./integrations/test-scan
333+
cd tests/integration/
334+
npx jest --ci --color read-write-hook
335+
helm -n integration-tests uninstall test-scan update-category update-severity
328336
- name: "nmap Integration Tests"
329337
run: |
330338
helm -n integration-tests install nmap ./integrations/nmap/ --set="parserImage.tag=sha-$(git rev-parse --short HEAD)"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const { scan } = require("../helpers");
2+
3+
test(
4+
"localhost port scan should only find a host finding",
5+
async () => {
6+
const { categories, severities, count } = await scan(
7+
"test-scan-read-write-hook",
8+
"test-scan",
9+
[],
10+
90
11+
);
12+
13+
expect(count).toBe(2);
14+
expect(categories).toMatchInlineSnapshot(`
15+
Object {
16+
"Host": 1,
17+
"Open Port": 1,
18+
"fancy-category": 2,
19+
}
20+
`);
21+
expect(severities).toMatchInlineSnapshot(`
22+
Object {
23+
"high": 2,
24+
}
25+
`);
26+
},
27+
3 * 60 * 1000
28+
);

0 commit comments

Comments
 (0)