Skip to content

Commit

Permalink
Add unit tests for task volume
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart133 committed Apr 15, 2024
1 parent ecac8a6 commit e80195b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
25 changes: 25 additions & 0 deletions tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,31 @@ tests:
name: O11Y_LEVEL
value: "error"

- it: should have the expected volumes mounted if task volume is enabled
set:
agent.taskVolume.enabled: true
asserts:
- contains:
path: spec.template.spec.volumes
content:
name: shared-task-agent
persistentVolumeClaim:
claimName: RELEASE-NAME-container-agent
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: shared-task-agent
mountPath: /task-agent
- contains:
path: spec.template.spec.containers[0].env
content:
name: KUBE_SHARED_TASK_AGENT_VOLUME
value: RELEASE-NAME-container-agent
- equal:
path: spec.template.spec.securityContext
value:
fsGroup: 1500

- it: should have proxy configured if given
set:
proxy.enabled: true
Expand Down
14 changes: 14 additions & 0 deletions tests/pvc_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
suite: test persistent volume claim
templates:
- pvc.yaml
tests:
- it: should be created if the volume is enabled
set:
agent.taskVolume.enabled: true
agent.taskVolume.storageClassName: "storage-class"
asserts:
- isNotNull:
path: spec
- equal:
path: spec.storageClassName
value: storage-class
14 changes: 7 additions & 7 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,17 @@ agent:
taskVolume:

# Enable the shared volume
enabled: true
enabled: false

# -- Storage class name assigned to the PVC (Optional)
storageClassName: "name"
storageClassName: ""

# -- Volume selector assigned to the PVC (Optional)
selector:
matchLabels:
release: "stable"
matchExpressions:
- {key: environment, operator: In, values: [dev]}
selector: {}
# matchLabels:
# release: "stable"
# matchExpressions:
# - {key: environment, operator: In, values: [dev]}

# -- Kubernetes service account settings
serviceAccount:
Expand Down

0 comments on commit e80195b

Please sign in to comment.