@@ -20,7 +20,7 @@ import (
2020 "k8s.io/apimachinery/pkg/labels"
2121 "k8s.io/apimachinery/pkg/types"
2222 "k8s.io/apimachinery/pkg/util/wait"
23- "k8s.io/utils/pointer "
23+ "k8s.io/utils/ptr "
2424 "sigs.k8s.io/controller-runtime/pkg/client"
2525
2626 nmo "github.com/medik8s/node-maintenance-operator/api/v1beta1"
@@ -33,7 +33,8 @@ const (
3333 testWorkerMaintenance = "test-maintenance"
3434 retryInterval = time .Second * 5
3535 eventInterval = time .Second * 10
36- timeout = time .Second * 120
36+ deploymentTimeout = time .Second * 120
37+ eventsTimeout = time .Second * 180
3738 testDeployment = "test-deployment"
3839)
3940
@@ -223,7 +224,6 @@ var _ = Describe("Starting Maintenance", func() {
223224 waitForTestDeployment (1 )
224225
225226 })
226-
227227 })
228228})
229229
@@ -253,14 +253,14 @@ func getNodes() ([]string, []string) {
253253 return controlPlaneNodes , workers
254254}
255255
256- func getNodeMaintenance (objectname , nodeName string ) * nmo.NodeMaintenance {
256+ func getNodeMaintenance (name , nodeName string ) * nmo.NodeMaintenance {
257257 return & nmo.NodeMaintenance {
258258 TypeMeta : metav1.TypeMeta {
259259 Kind : maintenanceKind ,
260260 APIVersion : "nodemaintenance.medik8s.io/v1beta1" ,
261261 },
262262 ObjectMeta : metav1.ObjectMeta {
263- Name : objectname ,
263+ Name : name ,
264264 },
265265 Spec : nmo.NodeMaintenanceSpec {
266266 NodeName : nodeName ,
@@ -301,7 +301,7 @@ func createTestDeployment() {
301301 Namespace : testNsName ,
302302 },
303303 Spec : appsv1.DeploymentSpec {
304- Replicas : pointer . Int32Ptr (1 ),
304+ Replicas : ptr. To [ int32 ] (1 ),
305305 Selector : & metav1.LabelSelector {
306306 MatchLabels : podLabel ,
307307 },
@@ -342,7 +342,7 @@ func createTestDeployment() {
342342 Args : []string {"-c" , "while true; do echo hello; sleep 10;done" },
343343 }},
344344 // make sure we run into the drain timeout at least once
345- TerminationGracePeriodSeconds : pointer . Int64Ptr (int64 (nodemaintenance .DrainerTimeout .Seconds ()) + 50 ),
345+ TerminationGracePeriodSeconds : ptr. To [ int64 ] (int64 (nodemaintenance .DrainerTimeout .Seconds ()) + 50 ),
346346 },
347347 },
348348 },
@@ -374,7 +374,7 @@ func waitForTestDeployment(offset int) {
374374 logInfoln ("test deployment not available yet" )
375375 return fmt .Errorf ("test deploymemt not ready yet" )
376376
377- }, timeout , retryInterval ).ShouldNot (HaveOccurred (), "test deployment failed" )
377+ }, deploymentTimeout , retryInterval ).ShouldNot (HaveOccurred (), "test deployment failed" )
378378
379379}
380380
@@ -464,7 +464,7 @@ func isLeaseInvalidated(nodeName string) {
464464// by its name and reason
465465func waitForEvent (ctx context.Context , eventReason , eventIdentifier string ) error {
466466 // Wait for events with a timeout
467- return wait .PollUntilContextTimeout (ctx , retryInterval , timeout , true , func (ctx context.Context ) (bool , error ) {
467+ return wait .PollUntilContextTimeout (ctx , retryInterval , eventsTimeout , true , func (ctx context.Context ) (bool , error ) {
468468 events , err := KubeClient .CoreV1 ().Events ("" ).List (ctx , metav1.ListOptions {
469469 FieldSelector : fmt .Sprintf ("involvedObject.kind=%s" , maintenanceKind ),
470470 })
0 commit comments