Skip to content

Commit

Permalink
test: fix for reconcile timeout test on autopilot (#684)
Browse files Browse the repository at this point in the history
Explicitly set the namespace for the pause-deployment object. When
running this in a Pod the applied object defaults to the namespace of
the Pod.

Also move the cleanup instantiation to before the apply, so the cleanup
runs in the case that the apply errors.
  • Loading branch information
sdowell committed Jun 15, 2023
1 parent 1466724 commit 98a5161
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion e2e/testcases/override_reconcile_timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ func TestOverrideReconcileTimeout(t *testing.T) {
// (common on Autopilot clusters, which are optimized for utilization),
// this low priority workload will be evicted to make room for the new normal priority workload.
if nt.IsGKEAutopilot {
nt.MustKubectl("apply", "-f", "../testdata/low-priority-pause-deployment.yaml")
nt.T.Cleanup(func() {
nt.MustKubectl("delete", "-f", "../testdata/low-priority-pause-deployment.yaml", "--ignore-not-found")
})
nt.MustKubectl("apply", "-f", "../testdata/low-priority-pause-deployment.yaml")
require.NoError(nt.T,
nt.Watcher.WatchObject(kinds.Deployment(), "pause-deployment", "default", []testpredicates.Predicate{
testpredicates.StatusEquals(nt.Scheme, kstatus.CurrentStatus),
Expand Down
4 changes: 4 additions & 0 deletions e2e/testdata/low-priority-pause-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: low-priority
labels:
nomos-test: enabled
value: -1
globalDefault: false
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pause-deployment
namespace: default
labels:
app: pause
nomos-test: enabled
spec:
replicas: 1
selector:
Expand Down

0 comments on commit 98a5161

Please sign in to comment.