2
2
3
3
import java .util .HashMap ;
4
4
import java .util .List ;
5
+ import java .util .Map ;
5
6
import java .util .concurrent .TimeUnit ;
6
7
7
8
import org .junit .jupiter .api .Test ;
@@ -30,10 +31,13 @@ public class KubernetesResourceStatusUpdateIT {
30
31
@ Test
31
32
public void testReconciliationOfNonCustomResourceAndStatusUpdate () {
32
33
var deployment = operator .create (Deployment .class , testDeployment ());
33
- await ().atMost (10 , TimeUnit .SECONDS ).untilAsserted (() -> {
34
+ await ().atMost (120 , TimeUnit .SECONDS ).untilAsserted (() -> {
34
35
var d = operator .get (Deployment .class , deployment .getMetadata ().getName ());
35
36
assertThat (d .getStatus ()).isNotNull ();
36
37
assertThat (d .getStatus ().getConditions ()).isNotNull ();
38
+ // wait until the pod is ready, if not this is causing some test stability issues with
39
+ // namespace cleanup in k8s version 1.22
40
+ assertThat (d .getStatus ().getReadyReplicas ()).isGreaterThanOrEqualTo (1 );
37
41
assertThat (
38
42
d .getStatus ().getConditions ().stream ().filter (c -> c .getMessage ().equals (STATUS_MESSAGE ))
39
43
.count ()).isEqualTo (1 );
@@ -42,9 +46,12 @@ public void testReconciliationOfNonCustomResourceAndStatusUpdate() {
42
46
43
47
private Deployment testDeployment () {
44
48
Deployment resource = new Deployment ();
49
+ Map <String , String > labels = new HashMap <>();
50
+ labels .put ("test" , "KubernetesResourceStatusUpdateIT" );
45
51
resource .setMetadata (
46
52
new ObjectMetaBuilder ()
47
53
.withName ("test-deployment" )
54
+ .withLabels (labels )
48
55
.build ());
49
56
DeploymentSpec spec = new DeploymentSpec ();
50
57
resource .setSpec (spec );
@@ -61,7 +68,7 @@ private Deployment testDeployment() {
61
68
62
69
Container container = new Container ();
63
70
container .setName ("nginx" );
64
- container .setImage ("nginx:1.14.2 " );
71
+ container .setImage ("nginx:1.21.4 " );
65
72
ContainerPort port = new ContainerPort ();
66
73
port .setContainerPort (80 );
67
74
container .setPorts (List .of (port ));
0 commit comments