2525import org .opensearch .sql .ppl .PPLIntegTestCase ;
2626
2727public class CalcitePPLCaseFunctionIT extends PPLIntegTestCase {
28- private static volatile boolean dataAppended = false ;
2928
3029 @ Override
3130 public void init () throws Exception {
@@ -40,12 +39,8 @@ public void init() throws Exception {
4039 appendDataForBadResponse ();
4140 }
4241
43- private synchronized void appendDataForBadResponse () throws IOException {
44- if (dataAppended ) {
45- return ;
46- }
47- dataAppended = true ;
48-
42+ private void appendDataForBadResponse () throws IOException {
43+ // These documents use fixed IDs (7-10), so reinserting is idempotent via PUT
4944 Request request1 = new Request ("PUT" , "/" + TEST_INDEX_WEBLOGS + "/_doc/7?refresh=true" );
5045 request1 .setJsonEntity (
5146 "{\" host\" : \" ::1\" , \" method\" : \" GET\" , \" url\" : \" /history/apollo/\" , \" response\" :"
@@ -55,14 +50,15 @@ private synchronized void appendDataForBadResponse() throws IOException {
5550 new Request ("PUT" , "/" + TestsConstants .TEST_INDEX_WEBLOGS + "/_doc/8?refresh=true" );
5651 request2 .setJsonEntity (
5752 "{\" host\" : \" 0.0.0.2\" , \" method\" : \" GET\" , \" url\" :"
58- + " \" /shuttle/missions/sts-73/mission-sts-73.html\" , \" response\" : \" 500\" , \" bytes \" : "
59- + " \" 4085\" }" );
53+ + " \" /shuttle/missions/sts-73/mission-sts-73.html\" , \" response\" : \" 500\" ,"
54+ + " \" bytes \" : \" 4085\" }" );
6055 client ().performRequest (request2 );
6156 Request request3 =
6257 new Request ("PUT" , "/" + TestsConstants .TEST_INDEX_WEBLOGS + "/_doc/9?refresh=true" );
6358 request3 .setJsonEntity (
64- "{\" host\" : \" ::3\" , \" method\" : \" GET\" , \" url\" : \" /shuttle/countdown/countdown.html\" ,"
65- + " \" response\" : \" 403\" , \" bytes\" : \" 3985\" }" );
59+ "{\" host\" : \" ::3\" , \" method\" : \" GET\" , \" url\" :"
60+ + " \" /shuttle/countdown/countdown.html\" , \" response\" : \" 403\" , \" bytes\" :"
61+ + " \" 3985\" }" );
6662 client ().performRequest (request3 );
6763 Request request4 =
6864 new Request ("PUT" , "/" + TestsConstants .TEST_INDEX_WEBLOGS + "/_doc/10?refresh=true" );
0 commit comments