@@ -12,6 +12,7 @@ import (
1212 . "github.com/onsi/gomega"
1313 "k8s.io/apimachinery/pkg/util/sets"
1414 "k8s.io/client-go/util/workqueue"
15+ "k8s.io/utils/ptr"
1516)
1617
1718var _ = Describe ("Controllerworkqueue" , func () {
@@ -106,8 +107,8 @@ var _ = Describe("Controllerworkqueue", func() {
106107 q , metrics := newQueue ()
107108 defer q .ShutDown ()
108109
109- q .AddWithOpts (AddOpts {Priority : 1 }, "foo" )
110- q .AddWithOpts (AddOpts {Priority : 2 }, "foo" )
110+ q .AddWithOpts (AddOpts {Priority : ptr . To ( 1 ) }, "foo" )
111+ q .AddWithOpts (AddOpts {Priority : ptr . To ( 2 ) }, "foo" )
111112
112113 item , priority , _ := q .GetWithPriority ()
113114 Expect (item ).To (Equal ("foo" ))
@@ -126,7 +127,7 @@ var _ = Describe("Controllerworkqueue", func() {
126127 q .AddWithOpts (AddOpts {}, "foo" )
127128 q .AddWithOpts (AddOpts {}, "bar" )
128129 q .AddWithOpts (AddOpts {}, "baz" )
129- q .AddWithOpts (AddOpts {Priority : 1 }, "baz" )
130+ q .AddWithOpts (AddOpts {Priority : ptr . To ( 1 ) }, "baz" )
130131
131132 item , priority , _ := q .GetWithPriority ()
132133 Expect (item ).To (Equal ("baz" ))
@@ -381,7 +382,7 @@ var _ = Describe("Controllerworkqueue", func() {
381382 if rn < 10 {
382383 q .AddWithOpts (AddOpts {After : time .Duration (rn ) * time .Millisecond }, fmt .Sprintf ("foo%d" , i ))
383384 } else {
384- q .AddWithOpts (AddOpts {Priority : rn }, fmt .Sprintf ("foo%d" , i ))
385+ q .AddWithOpts (AddOpts {Priority : & rn }, fmt .Sprintf ("foo%d" , i ))
385386 }
386387 }
387388
@@ -623,8 +624,8 @@ func TestFuzzPriorityQueue(t *testing.T) {
623624 defer inQueueLock .Unlock ()
624625
625626 q .AddWithOpts (opts , item )
626- if existingPriority , exists := inQueue [item ]; ! exists || existingPriority < opts .Priority {
627- inQueue [item ] = opts .Priority
627+ if existingPriority , exists := inQueue [item ]; ! exists || existingPriority < ptr . Deref ( opts .Priority , 0 ) {
628+ inQueue [item ] = ptr . Deref ( opts .Priority , 0 )
628629 }
629630 }()
630631 }
0 commit comments