Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add smart remediation system tests #284

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 35 additions & 0 deletions configurations/k8s_workloads/smart-remediation/c0016-fixed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
securityContext:
allowPrivilegeEscalation: false
capabilities:
add: ["NET_ADMIN"]
privileged: false
volumeMounts:
- name: docker-socket
mountPath: /host-docker.sock
- name: host-volume
mountPath: /host-etc
volumes:
- name: docker-socket
hostPath:
path: /run/containerd/containerd.sock
type: Socket
- name: host-volume
hostPath:
path: /etc
type: Directory
43 changes: 43 additions & 0 deletions configurations/k8s_workloads/smart-remediation/c0017-fixed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
securityContext:
capabilities:
add: ["NET_ADMIN"]
privileged: true
readOnlyRootFilesystem: true
volumeMounts:
- name: cache
mountPath: /var/cache/nginx
- name: run
mountPath: /var/run
- name: docker-socket
mountPath: /host-docker.sock
- name: host-volume
mountPath: /host-etc
volumes:
- name: cache
emptyDir: {}
- name: run
emptyDir: {}
- name: docker-socket
hostPath:
path: /run/containerd/containerd.sock
type: Socket
- name: host-volume
hostPath:
path: /etc
type: Directory
35 changes: 35 additions & 0 deletions configurations/k8s_workloads/smart-remediation/c0034-fixed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
securityContext:
capabilities:
add: ["NET_ADMIN"]
privileged: true
volumeMounts:
- name: docker-socket
mountPath: /host-docker.sock
- name: host-volume
mountPath: /host-etc
automountServiceAccountToken: false
volumes:
- name: docker-socket
hostPath:
path: /run/containerd/containerd.sock
type: Socket
- name: host-volume
hostPath:
path: /etc
type: Directory
36 changes: 36 additions & 0 deletions configurations/k8s_workloads/smart-remediation/c0045-fixed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
securityContext:
capabilities:
add: ["NET_ADMIN"]
privileged: true
volumeMounts:
- name: docker-socket
mountPath: /host-docker.sock
readOnly: true
- name: host-volume
mountPath: /host-etc
readOnly: true
volumes:
- name: docker-socket
hostPath:
path: /run/containerd/containerd.sock
type: Socket
- name: host-volume
hostPath:
path: /etc
type: Directory
32 changes: 32 additions & 0 deletions configurations/k8s_workloads/smart-remediation/c0046-fixed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
securityContext:
privileged: true
volumeMounts:
- name: docker-socket
mountPath: /host-docker.sock
- name: host-volume
mountPath: /host-etc
volumes:
- name: docker-socket
hostPath:
path: /run/containerd/containerd.sock
type: Socket
- name: host-volume
hostPath:
path: /etc
type: Directory
20 changes: 20 additions & 0 deletions configurations/k8s_workloads/smart-remediation/c0048-fixed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
securityContext:
capabilities:
add: ["NET_ADMIN"]
privileged: true
34 changes: 34 additions & 0 deletions configurations/k8s_workloads/smart-remediation/c0057-fixed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
securityContext:
capabilities:
add: ["NET_ADMIN"]
privileged: false
volumeMounts:
- name: docker-socket
mountPath: /host-docker.sock
- name: host-volume
mountPath: /host-etc
volumes:
- name: docker-socket
hostPath:
path: /run/containerd/containerd.sock
type: Socket
- name: host-volume
hostPath:
path: /etc
type: Directory
28 changes: 28 additions & 0 deletions configurations/k8s_workloads/smart-remediation/c0074-fixed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
securityContext:
capabilities:
add: ["NET_ADMIN"]
privileged: true
volumeMounts:
- name: host-volume
mountPath: /host-etc
volumes:
- name: host-volume
hostPath:
path: /etc
type: Directory
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
securityContext:
capabilities:
add: ["NET_ADMIN"]
privileged: true
volumeMounts:
- name: docker-socket
mountPath: /host-docker.sock
- name: host-volume
mountPath: /host-etc
volumes:
- name: docker-socket
hostPath:
path: /run/containerd/containerd.sock
type: Socket
- name: host-volume
hostPath:
path: /etc
type: Directory
4 changes: 4 additions & 0 deletions configurations/system/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from configurations.system.tests_cases.network_policy_tests import NetworkPolicyTests
from configurations.system.tests_cases.smart_remediation_tests import SmartRemediationTests
from configurations.system.tests_cases.synchronizer_tests import SynchronizerTests
from systest_utils import TestUtil

Expand All @@ -22,6 +23,7 @@ def all_tests_names():
tests.extend(TestUtil.get_class_methods(RelevantVulnerabilityScanningTests))
tests.extend(TestUtil.get_class_methods(NetworkPolicyTests))
tests.extend(TestUtil.get_class_methods(NotificationSTests))
tests.extend(TestUtil.get_class_methods(SmartRemediationTests))
tests.extend(TestUtil.get_class_methods(SynchronizerTests))
return tests

Expand All @@ -44,6 +46,8 @@ def get_test(test_name):
return NetworkPolicyTests().__getattribute__(test_name)()
if test_name in TestUtil.get_class_methods(NotificationSTests):
return NotificationSTests().__getattribute__(test_name)()
if test_name in TestUtil.get_class_methods(SmartRemediationTests):
return SmartRemediationTests().__getattribute__(test_name)()
if test_name in TestUtil.get_class_methods(SynchronizerTests):
return SynchronizerTests().__getattribute__(test_name)()

Expand Down
Loading
Loading