Skip to content

Commit

Permalink
Merge pull request #1664 from akto-api-security/hotfix/fix_temp_testing
Browse files Browse the repository at this point in the history
Adding debug logs and increasing delta time
  • Loading branch information
notshivansh authored Oct 23, 2024
2 parents 786fbab + 3006afd commit c0ff52f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/testing/src/main/java/com/akto/testing/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);

Expand Down
3 changes: 3 additions & 0 deletions apps/testing/src/main/java/com/akto/testing/TestExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions libs/utils/src/main/java/com/akto/testing/ApiExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand Down

0 comments on commit c0ff52f

Please sign in to comment.