Skip to content

Commit

Permalink
move assert to only look at created pvcs
Browse files Browse the repository at this point in the history
Signed-off-by: schristoff <[email protected]>
  • Loading branch information
schristoff committed Aug 17, 2023
1 parent 87223bb commit 05f0df6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/crd/bases/getporter.org_agentconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ spec:
determine what the storage class will be for the volume requested
type: string
ttlSecondsAfterFinished:
default: 600
description: TTLSecondsAfterFinished set the time limit of the lifetime
of a Job that has finished execution.
format: int32
Expand Down
3 changes: 2 additions & 1 deletion controllers/agentaction_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,20 @@ func TestAgentActionReconciler_createAgentVolume(t *testing.T) {
}
spec := porterv1.NewAgentConfigSpecAdapter(agentCfg)
pvc, err := controller.createAgentVolume(context.Background(), logr.Discard(), action, spec)

require.NoError(t, err)

// Verify the pvc properties
if test.created {
assert.Equal(t, "porter-hello-", pvc.GenerateName, "incorrect pvc name")
assert.Equal(t, []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, pvc.Spec.AccessModes, "incorrect pvc access modes")
assert.Equal(t, pvc.Spec.Resources.Requests[corev1.ResourceStorage], resource.MustParse("128Mi"))
assert.Equal(t, pvc.OwnerReferences[0].Name, action.Name)
} else {
assert.Equal(t, "existing-", pvc.GenerateName, "incorrect pvc name")
assert.Equal(t, []corev1.PersistentVolumeAccessMode{corev1.ReadWriteMany}, pvc.Spec.AccessModes, "incorrect pvc access modes")
assert.Equal(t, pvc.Spec.Resources.Requests[corev1.ResourceStorage], resource.MustParse("64Mi"))
}
assert.Equal(t, pvc.OwnerReferences[0].Name, action.Name)
assert.Equal(t, action.Namespace, pvc.Namespace, "incorrect pvc namespace")
assertSharedAgentLabels(t, pvc.Labels)
assertContains(t, pvc.Labels, "testLabel", "abc123", "incorrect label")
Expand Down

0 comments on commit 05f0df6

Please sign in to comment.