@@ -1700,7 +1700,7 @@ public void scriptFlush(GlideClient regularClient) {
1700
1700
script .close ();
1701
1701
}
1702
1702
1703
- @ Disabled ("flaky test: re-enable once fixed" )
1703
+ // @Disabled("flaky test: re-enable once fixed")
1704
1704
@ ParameterizedTest
1705
1705
@ MethodSource ("getClients" )
1706
1706
@ SneakyThrows
@@ -1724,19 +1724,41 @@ public void scriptKill(GlideClient regularClient) {
1724
1724
try (var testClient =
1725
1725
GlideClient .createClient (commonClientConfig ().requestTimeout (10000 ).build ()).get ()) {
1726
1726
try {
1727
- testClient .invokeScript (script );
1727
+ // testClient.invokeScript(script);
1728
1728
1729
1729
Thread .sleep (1000 );
1730
1730
1731
1731
// Run script kill until it returns OK
1732
1732
boolean scriptKilled = false ;
1733
1733
int timeout = 4000 ; // ms
1734
+ boolean first = true ;
1734
1735
while (timeout >= 0 ) {
1735
1736
try {
1736
- assertEquals (OK , regularClient .scriptKill ().get ());
1737
+ if (first ) {
1738
+ throw new ExecutionException (new RequestException ("Hello!" ));
1739
+ // assertEquals(OK, OK);
1740
+ } else {
1741
+ System .out .println ("Trying to kill script now" );
1742
+ assertEquals (OK , regularClient .scriptKill ().get ());
1743
+ System .out .println ("We did it" );
1744
+ }
1737
1745
scriptKilled = true ;
1738
1746
break ;
1739
1747
} catch (RequestException ignored ) {
1748
+ } catch (ExecutionException exception ) {
1749
+ // If exception says no scripts in execution right now, rerun script.
1750
+ System .out .println ("caught the exception" );
1751
+ if (exception .getCause () instanceof RequestException &&
1752
+ executionException
1753
+ .getMessage ()
1754
+ .toLowerCase ()
1755
+ .contains ("no scripts in execution right now" )) {
1756
+ testClient .invokeScript (script );
1757
+ timeout = 4000 ; // TODO: see if this is a good idea or not
1758
+ System .out .println ("Printed!!" );
1759
+ first = false ;
1760
+ Thread .sleep (1000 );
1761
+ }
1740
1762
}
1741
1763
Thread .sleep (500 );
1742
1764
timeout -= 500 ;
0 commit comments