Skip to content

Commit

Permalink
Add test function for supplemental groups on pod.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Feb 11, 2018
1 parent 282d545 commit 2c4343a
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,54 @@ def test_set_pod_uid_fs_gid():
"apiVersion": "v1"
}

def test_set_pod_supplemental_gids():
"""
Test specification of the simplest possible pod specification
"""
assert api_client.sanitize_for_serialization(make_pod(
name='test',
image_spec='jupyter/singleuser:latest',
cmd=['jupyterhub-singleuser'],
port=8888,
run_as_uid=1000,
supplemental_gids=[100],
image_pull_policy='IfNotPresent'
)) == {
"metadata": {
"name": "test",
"annotations": {},
"labels": {},
},
"spec": {
"securityContext": {
"runAsUser": 1000,
"supplementalGroups": [100]
},
'automountServiceAccountToken': False,
"containers": [
{
"env": [],
"name": "notebook",
"image": "jupyter/singleuser:latest",
"imagePullPolicy": "IfNotPresent",
"args": ["jupyterhub-singleuser"],
"ports": [{
"name": "notebook-port",
"containerPort": 8888
}],
'volumeMounts': [{'name': 'no-api-access-please', 'mountPath': '/var/run/secrets/kubernetes.io/serviceaccount', 'readOnly': True}],
"resources": {
"limits": {},
"requests": {}
}
}
],
'volumes': [{'name': 'no-api-access-please', 'emptyDir': {}}],
},
"kind": "Pod",
"apiVersion": "v1"
}

def test_run_privileged_container():
"""
Test specification of the container to run as privileged
Expand Down

0 comments on commit 2c4343a

Please sign in to comment.