22
33import java .util .HashMap ;
44import java .util .List ;
5+ import java .util .Map ;
56import java .util .concurrent .TimeUnit ;
67
78import org .junit .jupiter .api .Test ;
@@ -30,10 +31,13 @@ public class KubernetesResourceStatusUpdateIT {
3031 @ Test
3132 public void testReconciliationOfNonCustomResourceAndStatusUpdate () {
3233 var deployment = operator .create (Deployment .class , testDeployment ());
33- await ().atMost (10 , TimeUnit .SECONDS ).untilAsserted (() -> {
34+ await ().atMost (120 , TimeUnit .SECONDS ).untilAsserted (() -> {
3435 var d = operator .get (Deployment .class , deployment .getMetadata ().getName ());
3536 assertThat (d .getStatus ()).isNotNull ();
3637 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 );
3741 assertThat (
3842 d .getStatus ().getConditions ().stream ().filter (c -> c .getMessage ().equals (STATUS_MESSAGE ))
3943 .count ()).isEqualTo (1 );
@@ -42,9 +46,12 @@ public void testReconciliationOfNonCustomResourceAndStatusUpdate() {
4246
4347 private Deployment testDeployment () {
4448 Deployment resource = new Deployment ();
49+ Map <String , String > labels = new HashMap <>();
50+ labels .put ("test" , "KubernetesResourceStatusUpdateIT" );
4551 resource .setMetadata (
4652 new ObjectMetaBuilder ()
4753 .withName ("test-deployment" )
54+ .withLabels (labels )
4855 .build ());
4956 DeploymentSpec spec = new DeploymentSpec ();
5057 resource .setSpec (spec );
@@ -61,7 +68,7 @@ private Deployment testDeployment() {
6168
6269 Container container = new Container ();
6370 container .setName ("nginx" );
64- container .setImage ("nginx:1.14.2 " );
71+ container .setImage ("nginx:1.21.4 " );
6572 ContainerPort port = new ContainerPort ();
6673 port .setContainerPort (80 );
6774 container .setPorts (List .of (port ));
0 commit comments