11package io .javaoperatorsdk .operator ;
22
3- import static io .javaoperatorsdk .operator .TestUtils .TEST_CUSTOM_RESOURCE_NAME ;
4- import static io .javaoperatorsdk .operator .TestUtils .testCustomResource ;
5- import static org .assertj .core .api .Assertions .assertThat ;
6- import static org .awaitility .Awaitility .await ;
7-
83import io .fabric8 .kubernetes .api .model .ConfigMap ;
94import io .fabric8 .kubernetes .client .DefaultKubernetesClient ;
105import io .fabric8 .kubernetes .client .KubernetesClient ;
116import io .javaoperatorsdk .operator .sample .simple .TestCustomResource ;
127import io .javaoperatorsdk .operator .sample .simple .TestCustomResourceController ;
138import java .util .concurrent .TimeUnit ;
9+ import org .assertj .core .api .Assertions ;
10+ import org .awaitility .Awaitility ;
1411import org .junit .jupiter .api .Test ;
1512import org .junit .jupiter .api .TestInstance ;
1613
@@ -33,7 +30,7 @@ public void configMapGetsCreatedForTestCustomResource() {
3330 initAndCleanup (true );
3431 integrationTestSupport .teardownIfSuccess (
3532 () -> {
36- TestCustomResource resource = testCustomResource ();
33+ TestCustomResource resource = TestUtils . testCustomResource ();
3734
3835 integrationTestSupport
3936 .getCrOperations ()
@@ -42,7 +39,7 @@ public void configMapGetsCreatedForTestCustomResource() {
4239
4340 awaitResourcesCreatedOrUpdated ();
4441 awaitStatusUpdated ();
45- assertThat (integrationTestSupport .numberOfControllerExecutions ()).isEqualTo (2 );
42+ Assertions . assertThat (integrationTestSupport .numberOfControllerExecutions ()).isEqualTo (2 );
4643 });
4744 }
4845
@@ -51,20 +48,20 @@ public void eventIsSkippedChangedOnMetadataOnlyUpdate() {
5148 initAndCleanup (false );
5249 integrationTestSupport .teardownIfSuccess (
5350 () -> {
54- TestCustomResource resource = testCustomResource ();
51+ TestCustomResource resource = TestUtils . testCustomResource ();
5552
5653 integrationTestSupport
5754 .getCrOperations ()
5855 .inNamespace (IntegrationTestSupport .TEST_NAMESPACE )
5956 .create (resource );
6057
6158 awaitResourcesCreatedOrUpdated ();
62- assertThat (integrationTestSupport .numberOfControllerExecutions ()).isEqualTo (1 );
59+ Assertions . assertThat (integrationTestSupport .numberOfControllerExecutions ()).isEqualTo (1 );
6360 });
6461 }
6562
6663 void awaitResourcesCreatedOrUpdated () {
67- await ("config map created" )
64+ Awaitility . await ("config map created" )
6865 .atMost (5 , TimeUnit .SECONDS )
6966 .untilAsserted (
7067 () -> {
@@ -75,8 +72,8 @@ void awaitResourcesCreatedOrUpdated() {
7572 .inNamespace (IntegrationTestSupport .TEST_NAMESPACE )
7673 .withName ("test-config-map" )
7774 .get ();
78- assertThat (configMap ).isNotNull ();
79- assertThat (configMap .getData ().get ("test-key" )).isEqualTo ("test-value" );
75+ Assertions . assertThat (configMap ).isNotNull ();
76+ Assertions . assertThat (configMap .getData ().get ("test-key" )).isEqualTo ("test-value" );
8077 });
8178 }
8279
@@ -85,7 +82,7 @@ void awaitStatusUpdated() {
8582 }
8683
8784 void awaitStatusUpdated (int timeout ) {
88- await ("cr status updated" )
85+ Awaitility . await ("cr status updated" )
8986 .atMost (timeout , TimeUnit .SECONDS )
9087 .untilAsserted (
9188 () -> {
@@ -94,11 +91,12 @@ void awaitStatusUpdated(int timeout) {
9491 integrationTestSupport
9592 .getCrOperations ()
9693 .inNamespace (IntegrationTestSupport .TEST_NAMESPACE )
97- .withName (TEST_CUSTOM_RESOURCE_NAME )
94+ .withName (TestUtils . TEST_CUSTOM_RESOURCE_NAME )
9895 .get ();
99- assertThat (cr ).isNotNull ();
100- assertThat (cr .getStatus ()).isNotNull ();
101- assertThat (cr .getStatus ().getConfigMapStatus ()).isEqualTo ("ConfigMap Ready" );
96+ Assertions .assertThat (cr ).isNotNull ();
97+ Assertions .assertThat (cr .getStatus ()).isNotNull ();
98+ Assertions .assertThat (cr .getStatus ().getConfigMapStatus ())
99+ .isEqualTo ("ConfigMap Ready" );
102100 });
103101 }
104102}
0 commit comments