mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-09 03:48:05 +00:00
tests: k8s-policy-pod: safer host path volume source
Test using the host path /tmp/k8s-policy-pod-test instead of /var/lib/kubelet/pods. /var/lib/kubelet/pods might happen to contain files that CopyFileRequest would try to send to the Guest before CreateContainerRequest. Such CopyFileRequest was an unintended side effect of this test. Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
parent
1c406e9c1d
commit
0e26dd4ce8
@ -155,11 +155,11 @@ test_pod_policy_error() {
|
|||||||
@test "Policy failure: unexpected hostPath volume mount" {
|
@test "Policy failure: unexpected hostPath volume mount" {
|
||||||
# Changing the pod spec after generating its policy will cause CreateContainer to be denied.
|
# Changing the pod spec after generating its policy will cause CreateContainer to be denied.
|
||||||
yq -i \
|
yq -i \
|
||||||
'.spec.containers[0].volumeMounts += [{"name": "mountpoint-dir", "mountPath": "/var/lib/kubelet/pods"}]' \
|
'.spec.containers[0].volumeMounts += [{"name": "mountpoint-dir", "mountPath": "/hostpath-volume"}]' \
|
||||||
"${incorrect_pod_yaml}"
|
"${incorrect_pod_yaml}"
|
||||||
|
|
||||||
yq -i \
|
yq -i \
|
||||||
'.spec.volumes += [{"hostPath": {"path": "/var/lib/kubelet/pods", "type": "DirectoryOrCreate"}, "name": "mountpoint-dir"}]' \
|
'.spec.volumes += [{"hostPath": {"path": "/tmp/k8s-policy-pod-test", "type": "DirectoryOrCreate"}, "name": "mountpoint-dir"}]' \
|
||||||
"${incorrect_pod_yaml}"
|
"${incorrect_pod_yaml}"
|
||||||
|
|
||||||
test_pod_policy_error
|
test_pod_policy_error
|
||||||
|
Loading…
Reference in New Issue
Block a user