Skip to content

Feature/test suite #1996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.akto.dao.testing.sources.TestSourceConfigsDao;
import com.akto.dao.testing_run_findings.TestingRunIssuesDao;
import com.akto.dao.testing.*;
import com.akto.dao.testing.config.EditableTestingRunConfig;
import com.akto.dto.ApiInfo;
import com.akto.dto.User;
import com.akto.dto.ApiToken.Utility;
Expand Down Expand Up @@ -234,12 +235,13 @@ public String startTest() {
}

}

if (this.overriddenTestAppUrl != null || this.selectedTests != null) {
int id = UUID.randomUUID().hashCode() & 0xfffffff ;
int id = UUID.randomUUID().hashCode() & 0xfffffff;
TestingRunConfig testingRunConfig = new TestingRunConfig(id, null, this.selectedTests, null, this.overriddenTestAppUrl, this.testRoleId);
this.testIdConfig = testingRunConfig.getId();
TestingRunConfigDao.instance.insertOne(testingRunConfig);
}
}

}

Expand Down Expand Up @@ -506,7 +508,7 @@ else if(this.testingRun.getPeriodInSeconds() > 0){
}

TestingRunConfig runConfig = TestingRunConfigDao.instance.findOne(
Filters.eq("_id", this.testingRun.getTestIdConfig()), Projections.exclude("collectionWiseApiInfoKey", "testSubCategoryList")
Filters.eq("_id", this.testingRun.getTestIdConfig()), Projections.exclude("collectionWiseApiInfoKey")
);

this.testingRun.setTestingRunConfig(runConfig);
Expand Down Expand Up @@ -1125,11 +1127,28 @@ public String getCurrentTestStateStatus(){
return Action.SUCCESS.toUpperCase();
}

private EditableTestingRunConfig editableTestingRunConfig;

public String modifyTestingRunConfig(){
TestingRunConfigDao.instance.updateOne(
Filters.eq(Constants.ID, this.testingRunConfigId),
Updates.set("configsAdvancedSettings", this.testConfigsAdvancedSettings)
);
Updates.combine(
Updates.set("configsAdvancedSettings", this.editableTestingRunConfig.getTestConfigsAdvancedSettings()),
Updates.set("testSubCategoryList", this.editableTestingRunConfig.getSubCategoriesList()),
Updates.set("testRoleId", this.editableTestingRunConfig.getTestRoleId()),
Updates.set("overriddenTestAppUrl", this.editableTestingRunConfig.getOverriddenTestAppUrl())
)
);

if(editableTestingRunConfig.getTestingRunHexId() != null){
TestingRunDao.instance.updateOne(
Filters.eq(Constants.ID, new ObjectId(editableTestingRunConfig.getTestingRunHexId())),
Updates.combine(
Updates.set("testRunTime", this.editableTestingRunConfig.getTestRunTime()),
Updates.set("maxConcurrentRequests", this.editableTestingRunConfig.getMaxConcurrentRequests())
)
);
}
return SUCCESS.toUpperCase();
}

Expand Down Expand Up @@ -1568,6 +1587,10 @@ public void setTestingRunConfigId(int testingRunConfigId) {
this.testingRunConfigId = testingRunConfigId;
}

public void setEditableTestingRunConfig(EditableTestingRunConfig editableTestingRunConfig) {
this.editableTestingRunConfig = editableTestingRunConfig;
}

public Map<String, Integer> getTestCountMap() {
return testCountMap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ function ApiDetails(props) {
endpoints={[apiDetail]}
filtered={true}
useLocalSubCategoryData={useLocalSubCategoryData}
preActivator={false}
/>
<Box>
<Tooltip content="Open URL in test editor" dismissOnMouseOut>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ function ApiEndpoints(props) {
closeRunTest={() => setRunTests(false)}
disabled={showEmptyScreen}
selectedResourcesForPrimaryAction={selectedResourcesForPrimaryAction}
preActivator={false}
/>
</HorizontalStack>
)
Expand Down
Loading