Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,36 @@ jobs:
path: ./nvm-node.tar.gz
retention-days: 1


test-nodejs-scanner-test-helpers:
name: "Unit Test | Node.js Scanner Test Helpers"
needs:
- nvm-setup
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Download nvm and Node.js
uses: actions/download-artifact@v4
with:
name: nvm-node
path: nvm-node

- name: Extract nvm and Node.js
run: |
tar xzf nvm-node/nvm-node.tar.gz -C $HOME
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use

- name: Install dependencies
working-directory: ./scanners
run: |
npm ci
- name: Test Node.js Scanner Test Helpers
working-directory: ./scanners
run: |
npm run test:helpers
k8s-setup:
name: "Setup Kind & Kubectl & Helm"
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion scanners/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ helm-unit-tests:
for directory in ./*; do \
if [ -d "$$directory" ]; then \
dir_name=$$(basename "$$directory"); \
if [ "$$dir_name" != "coverage" ] && [ "$$dir_name" != "node_modules" ]; then \
if [ "$$dir_name" != "coverage" ] && [ "$$dir_name" != "node_modules" ] && [ "$$dir_name" != "__snapshots__" ] && [ "$$dir_name" != "__testFiles__" ]; then \
helm unittest "$$directory"; \
fi; \
fi; \
Expand Down
89 changes: 89 additions & 0 deletions scanners/__snapshots__/helpers.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Kubernetes interaction tests cascading scan function should create a cascading scan and return findings on successful completion 1`] = `
{
"categories": {
"Discovered Credentials": 1,
},
"count": 1,
"severities": {
"high": 1,
},
}
`;

exports[`Kubernetes interaction tests scan function should create a scan and return findings on successful completion 1`] = `
{
"categories": {
"Vulnerability": 24,
},
"count": 24,
"severities": {
"high": 24,
},
}
`;

exports[`Kubernetes interaction tests scan function should create a scan and return findings on successful completion 2`] = `
[MockFunction] {
"calls": [
[
"execution.securecodebox.io",
"v1",
"integration-tests",
"scans",
{
"apiVersion": "execution.securecodebox.io/v1",
"kind": "Scan",
"metadata": {
"generateName": "typo3scan-old-typo3-",
},
"spec": {
"initContainers": [],
"parameters": [],
"scanType": "typo3scan",
"volumeMounts": [],
"volumes": [],
},
},
],
],
"results": [
{
"type": "return",
"value": Promise {},
},
],
}
`;

exports[`Kubernetes interaction tests scan function should create a scan and return findings on successful completion 3`] = `
[MockFunction] {
"calls": [
[
"execution.securecodebox.io",
"v1",
"integration-tests",
"scans",
"typo3scan-old-typo3-pw8vt",
],
[
"execution.securecodebox.io",
"v1",
"integration-tests",
"scans",
"typo3scan-old-typo3-pw8vt",
],
],
"results": [
{
"type": "return",
"value": Promise {},
},
{
"type": "return",
"value": Promise {},
},
],
}
`;
3 changes: 3 additions & 0 deletions scanners/__snapshots__/helpers.test.js.snap.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: the secureCodeBox authors

SPDX-License-Identifier: Apache-2.0
Loading