@@ -1234,17 +1234,14 @@ var _ = SIGDescribe(framework.WithSerial(), "Containers Lifecycle", func() {
1234
1234
podSandboxID := sandboxes [0 ].Id
1235
1235
1236
1236
ginkgo .By ("Stopping the kubelet" )
1237
- restartKubelet := stopKubelet ()
1238
- gomega .Eventually (ctx , func () bool {
1239
- return kubeletHealthCheck (kubeletHealthCheckURL )
1240
- }, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeFalseBecause ("kubelet was expected to be stopped but it is still running" ))
1237
+ restartKubelet := mustStopKubelet (ctx , f )
1241
1238
1242
1239
ginkgo .By ("Stopping the pod sandbox to simulate the node reboot" )
1243
1240
err = rs .StopPodSandbox (ctx , podSandboxID )
1244
1241
framework .ExpectNoError (err )
1245
1242
1246
1243
ginkgo .By ("Restarting the kubelet" )
1247
- restartKubelet ()
1244
+ restartKubelet (ctx )
1248
1245
gomega .Eventually (ctx , func () bool {
1249
1246
return kubeletHealthCheck (kubeletHealthCheckURL )
1250
1247
}, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeTrueBecause ("kubelet was expected to be healthy" ))
@@ -1361,14 +1358,10 @@ var _ = SIGDescribe(framework.WithSerial(), "Containers Lifecycle", func() {
1361
1358
1362
1359
ginkgo .It ("should not restart any completed init container after the kubelet restart" , func (ctx context.Context ) {
1363
1360
ginkgo .By ("stopping the kubelet" )
1364
- startKubelet := stopKubelet ()
1365
- // wait until the kubelet health check will fail
1366
- gomega .Eventually (ctx , func () bool {
1367
- return kubeletHealthCheck (kubeletHealthCheckURL )
1368
- }, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeFalseBecause ("kubelet should be stopped" ))
1361
+ restartKubelet := mustStopKubelet (ctx , f )
1369
1362
1370
1363
ginkgo .By ("restarting the kubelet" )
1371
- startKubelet ( )
1364
+ restartKubelet ( ctx )
1372
1365
// wait until the kubelet health check will succeed
1373
1366
gomega .Eventually (ctx , func () bool {
1374
1367
return kubeletHealthCheck (kubeletHealthCheckURL )
@@ -1409,11 +1402,7 @@ var _ = SIGDescribe(framework.WithSerial(), "Containers Lifecycle", func() {
1409
1402
1410
1403
ginkgo .It ("should not restart any completed init container, even after the completed init container statuses have been removed and the kubelet restarted" , func (ctx context.Context ) {
1411
1404
ginkgo .By ("stopping the kubelet" )
1412
- startKubelet := stopKubelet ()
1413
- // wait until the kubelet health check will fail
1414
- gomega .Eventually (ctx , func () bool {
1415
- return kubeletHealthCheck (kubeletHealthCheckURL )
1416
- }, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeFalseBecause ("kubelet should be stopped" ))
1405
+ restartKubelet := mustStopKubelet (ctx , f )
1417
1406
1418
1407
ginkgo .By ("removing the completed init container statuses from the container runtime" )
1419
1408
rs , _ , err := getCRIClient ()
@@ -1437,7 +1426,7 @@ var _ = SIGDescribe(framework.WithSerial(), "Containers Lifecycle", func() {
1437
1426
}
1438
1427
1439
1428
ginkgo .By ("restarting the kubelet" )
1440
- startKubelet ( )
1429
+ restartKubelet ( ctx )
1441
1430
// wait until the kubelet health check will succeed
1442
1431
gomega .Eventually (ctx , func () bool {
1443
1432
return kubeletHealthCheck (kubeletHealthCheckURL )
@@ -1544,18 +1533,10 @@ var _ = SIGDescribe(framework.WithSerial(), "Containers Lifecycle", func() {
1544
1533
1545
1534
ginkgo .It ("should not restart any completed init container after the kubelet restart" , func (ctx context.Context ) {
1546
1535
ginkgo .By ("stopping the kubelet" )
1547
- startKubelet := stopKubelet ()
1548
- // wait until the kubelet health check will fail
1549
- gomega .Eventually (ctx , func () bool {
1550
- return kubeletHealthCheck (kubeletHealthCheckURL )
1551
- }, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeFalseBecause ("kubelet should be stopped" ))
1536
+ restartKubelet := mustStopKubelet (ctx , f )
1552
1537
1553
1538
ginkgo .By ("restarting the kubelet" )
1554
- startKubelet ()
1555
- // wait until the kubelet health check will succeed
1556
- gomega .Eventually (ctx , func () bool {
1557
- return kubeletHealthCheck (kubeletHealthCheckURL )
1558
- }, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeTrueBecause ("kubelet should be restarted" ))
1539
+ restartKubelet (ctx )
1559
1540
1560
1541
ginkgo .By ("ensuring that no completed init container is restarted" )
1561
1542
gomega .Consistently (ctx , func () bool {
@@ -1588,11 +1569,7 @@ var _ = SIGDescribe(framework.WithSerial(), "Containers Lifecycle", func() {
1588
1569
1589
1570
ginkgo .It ("should not restart any completed init container, even after the completed init container statuses have been removed and the kubelet restarted" , func (ctx context.Context ) {
1590
1571
ginkgo .By ("stopping the kubelet" )
1591
- startKubelet := stopKubelet ()
1592
- // wait until the kubelet health check will fail
1593
- gomega .Eventually (ctx , func () bool {
1594
- return kubeletHealthCheck (kubeletHealthCheckURL )
1595
- }, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeFalseBecause ("kubelet should be stopped" ))
1572
+ restartKubelet := mustStopKubelet (ctx , f )
1596
1573
1597
1574
ginkgo .By ("removing the completed init container statuses from the container runtime" )
1598
1575
rs , _ , err := getCRIClient ()
@@ -1616,11 +1593,7 @@ var _ = SIGDescribe(framework.WithSerial(), "Containers Lifecycle", func() {
1616
1593
}
1617
1594
1618
1595
ginkgo .By ("restarting the kubelet" )
1619
- startKubelet ()
1620
- // wait until the kubelet health check will succeed
1621
- gomega .Eventually (ctx , func () bool {
1622
- return kubeletHealthCheck (kubeletHealthCheckURL )
1623
- }, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeTrueBecause ("kubelet should be restarted" ))
1596
+ restartKubelet (ctx )
1624
1597
1625
1598
ginkgo .By ("ensuring that no completed init container is restarted" )
1626
1599
gomega .Consistently (ctx , func () bool {
@@ -5517,17 +5490,14 @@ var _ = SIGDescribe(nodefeature.SidecarContainers, framework.WithSerial(), "Cont
5517
5490
podSandboxID := sandboxes [0 ].Id
5518
5491
5519
5492
ginkgo .By ("Stopping the kubelet" )
5520
- restartKubelet := stopKubelet ()
5521
- gomega .Eventually (ctx , func () bool {
5522
- return kubeletHealthCheck (kubeletHealthCheckURL )
5523
- }, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeFalseBecause ("expected kubelet would have been stopped but it is still running" ))
5493
+ restartKubelet := mustStopKubelet (ctx , f )
5524
5494
5525
5495
ginkgo .By ("Stopping the pod sandbox to simulate the node reboot" )
5526
5496
err = rs .StopPodSandbox (ctx , podSandboxID )
5527
5497
framework .ExpectNoError (err )
5528
5498
5529
5499
ginkgo .By ("Restarting the kubelet" )
5530
- restartKubelet ()
5500
+ restartKubelet (ctx )
5531
5501
gomega .Eventually (ctx , func () bool {
5532
5502
return kubeletHealthCheck (kubeletHealthCheckURL )
5533
5503
}, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeTrueBecause ("kubelet was expected to be healthy" ))
@@ -5662,10 +5632,7 @@ var _ = SIGDescribe(nodefeature.SidecarContainers, framework.WithSerial(), "Cont
5662
5632
podSandboxID := sandboxes [0 ].Id
5663
5633
5664
5634
ginkgo .By ("Stopping the kubelet" )
5665
- restartKubelet := stopKubelet ()
5666
- gomega .Eventually (ctx , func () bool {
5667
- return kubeletHealthCheck (kubeletHealthCheckURL )
5668
- }, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeFalseBecause ("expected kubelet would have been stopped but it is still running" ))
5635
+ restartKubelet := mustStopKubelet (ctx , f )
5669
5636
5670
5637
if nodeReboot {
5671
5638
ginkgo .By ("Stopping the pod sandbox to simulate the node reboot" )
@@ -5674,7 +5641,7 @@ var _ = SIGDescribe(nodefeature.SidecarContainers, framework.WithSerial(), "Cont
5674
5641
}
5675
5642
5676
5643
ginkgo .By ("Restarting the kubelet" )
5677
- restartKubelet ()
5644
+ restartKubelet (ctx )
5678
5645
gomega .Eventually (ctx , func () bool {
5679
5646
return kubeletHealthCheck (kubeletHealthCheckURL )
5680
5647
}, f .Timeouts .PodStart , f .Timeouts .Poll ).Should (gomega .BeTrueBecause ("kubelet was expected to be healthy" ))
0 commit comments