From 3006afd95a757f579d8c138b55fa603acd4c39fc Mon Sep 17 00:00:00 2001 From: Ark2307 Date: Wed, 23 Oct 2024 18:47:51 +0530 Subject: [PATCH] Adding debug logs and increasing delta time --- apps/testing/src/main/java/com/akto/testing/Main.java | 2 +- apps/testing/src/main/java/com/akto/testing/TestExecutor.java | 3 +++ libs/utils/src/main/java/com/akto/testing/ApiExecutor.java | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/testing/src/main/java/com/akto/testing/Main.java b/apps/testing/src/main/java/com/akto/testing/Main.java index f5473e2d10..9b1150ca47 100644 --- a/apps/testing/src/main/java/com/akto/testing/Main.java +++ b/apps/testing/src/main/java/com/akto/testing/Main.java @@ -173,7 +173,7 @@ private static TestingRunResultSummary findPendingTestingRunResultSummary(int us Bson filter2 = Filters.and( Filters.eq(TestingRun.STATE, TestingRun.State.RUNNING), - Filters.lte(TestingRunResultSummary.START_TIMESTAMP, now - 5*60), + Filters.lte(TestingRunResultSummary.START_TIMESTAMP, now - 20*60), Filters.gt(TestingRunResultSummary.START_TIMESTAMP, delta) ); diff --git a/apps/testing/src/main/java/com/akto/testing/TestExecutor.java b/apps/testing/src/main/java/com/akto/testing/TestExecutor.java index ee4957b6fe..c141cae8e2 100644 --- a/apps/testing/src/main/java/com/akto/testing/TestExecutor.java +++ b/apps/testing/src/main/java/com/akto/testing/TestExecutor.java @@ -176,7 +176,10 @@ public void apiWiseInit(TestingRun testingRun, ObjectId summaryId, boolean debug } try { + int currentTime = Context.now(); + loggerMaker.infoAndAddToDb("Starting StatusCodeAnalyser at: " + currentTime, LogDb.TESTING); StatusCodeAnalyser.run(sampleDataMapForStatusCodeAnalyser, sampleMessageStore , authMechanismStore, testingRun.getTestingRunConfig()); + loggerMaker.infoAndAddToDb("Completing StatusCodeAnalyser in: " + (Context.now() - currentTime) + " at: " + Context.now(), LogDb.TESTING); } catch (Exception e) { loggerMaker.errorAndAddToDb("Error while running status code analyser " + e.getMessage(), LogDb.TESTING); } diff --git a/libs/utils/src/main/java/com/akto/testing/ApiExecutor.java b/libs/utils/src/main/java/com/akto/testing/ApiExecutor.java index 2528bb8404..c3ae94d9b7 100644 --- a/libs/utils/src/main/java/com/akto/testing/ApiExecutor.java +++ b/libs/utils/src/main/java/com/akto/testing/ApiExecutor.java @@ -368,7 +368,6 @@ private static void calculateHashAndAddAuth(OriginalHttpRequest originalHttpRequ if (!executeScript) { return; } - loggerMaker.infoAndAddToDb("Starting calculateHashAndAddAuth"); int accountId = Context.accountId.get(); try { String script; @@ -383,9 +382,10 @@ private static void calculateHashAndAddAuth(OriginalHttpRequest originalHttpRequ if (testScript != null && testScript.getJavascript() != null) { script = testScript.getJavascript(); } else { - loggerMaker.infoAndAddToDb("returning from calculateHashAndAddAuth, no test script present"); + // loggerMaker.infoAndAddToDb("returning from calculateHashAndAddAuth, no test script present"); return; } + loggerMaker.infoAndAddToDb("Starting calculateHashAndAddAuth"); ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("nashorn");