Feature/speedup quota tests (#1125)

* reduce the number of created entities in tests

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch.io>

* fixed tests

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch.io>

* fixed review findings

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch.io>

* merged master

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch.io>

* adapted target count

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch.io>

* fixed review findings

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch.io>

* fixed RolloutManagementTest

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch.io>

* fixed flaky test ConcurrentDistributionSetInvalidationTest

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch.io>
This commit is contained in:
Ahmed Sayed
2022-02-21 12:58:05 +01:00
committed by GitHub
parent 44a85f20eb
commit 949cd8cd8b
17 changed files with 144 additions and 88 deletions

View File

@@ -170,7 +170,7 @@ public class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
final DistributionSet ds = testdataFactory.createDistributionSet("");
// create artifact
final int artifactSize = 5 * 1024 * 1024;
final int artifactSize = (int) quotaManagement.getMaxArtifactSize();
final byte random[] = RandomUtils.nextBytes(artifactSize);
final Artifact artifact = artifactManagement.create(new ArtifactUpload(new ByteArrayInputStream(random),
ds.findFirstModuleByType(osType).get().getId(), "file1", false, artifactSize));
@@ -238,7 +238,7 @@ public class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
// create ds
final DistributionSet ds = testdataFactory.createDistributionSet("");
final int resultLength = 5 * 1000 * 1024;
final int resultLength = (int) quotaManagement.getMaxArtifactSize();
// create artifact
final byte random[] = RandomUtils.nextBytes(resultLength);
@@ -250,7 +250,7 @@ public class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
// now assign and download successful
assignDistributionSet(ds, targets);
final int range = 100 * 1024;
final int range = resultLength / 50;
// full file download with standard range request
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@@ -493,7 +493,7 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
.get(0);
final List<String> messages = new ArrayList<>();
for (int i = 0; i < 51; i++) {
for (int i = 0; i < quotaManagement.getMaxMessagesPerActionStatus() + 1; i++) {
messages.add(String.valueOf(i));
}

View File

@@ -112,7 +112,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
void createRolloutWithNotWellFormedFilterReturnsBadRequest() throws Exception {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
mvc.perform(post("/rest/v1/rollouts").content(
JsonBuilder.rollout("name", "desc", 10, dsA.getId(), "name=test", null))
JsonBuilder.rollout("name", "desc", 5, dsA.getId(), "name=test", null))
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
@@ -143,7 +143,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
testdataFactory.createTargets(20, "target", "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
postRollout("rollout1", 10, dsA.getId(), "id==target*", 20, Action.ActionType.FORCED);
postRollout("rollout1", 5, dsA.getId(), "id==target*", 20, Action.ActionType.FORCED);
}
@Test
@@ -399,7 +399,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
testdataFactory.createTargets(20, "target", "rollout");
// setup - create 2 rollouts
postRollout("rollout1", 10, dsA.getId(), "id==target*", 20, Action.ActionType.FORCED);
postRollout("rollout1", 5, dsA.getId(), "id==target*", 20, Action.ActionType.FORCED);
postRollout("rollout2", 5, dsA.getId(), "id==target-0001*", 10, Action.ActionType.FORCED);
// Run here, because Scheduler is disabled during tests
@@ -440,7 +440,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
testdataFactory.createTargets(20, "target", "rollout");
// setup - create 2 rollouts
postRollout("rollout1", 10, dsA.getId(), "id==target*", 20, Action.ActionType.FORCED);
postRollout("rollout1", 5, dsA.getId(), "id==target*", 20, Action.ActionType.FORCED);
postRollout("rollout2", 5, dsA.getId(), "id==target*", 20, Action.ActionType.FORCED);
// Run here, because Scheduler is disabled during tests
@@ -822,7 +822,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
@Description("Start the rollout in async mode")
void startingRolloutSwitchesIntoRunningStateAsync() throws Exception {
final int amountTargets = 1000;
final int amountTargets = 50;
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
@@ -965,7 +965,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
testdataFactory.createTargets(20, "target", "rollout");
final DistributionSet dsA = testdataFactory.createDistributionSet("");
postRollout("rollout1", 10, dsA.getId(), "id==target*", 20, Action.ActionType.DOWNLOAD_ONLY);
postRollout("rollout1", 5, dsA.getId(), "id==target*", 20, Action.ActionType.DOWNLOAD_ONLY);
}
@Test

View File

@@ -183,7 +183,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
final String name = "exampleRollout";
final String type = "forced";
final String description = "Rollout for all named targets";
final int groupSize = 10;
final int groupSize = 5;
final Long dsId = testdataFactory.createDistributionSet().getId();
final String targetFilter = "id==targets-*";
@@ -642,7 +642,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
if (isMultiAssignmentsEnabled()) {
rolloutCreate.weight(400);
}
final Rollout rollout = rolloutManagement.create(rolloutCreate, 10, new RolloutGroupConditionBuilder()
final Rollout rollout = rolloutManagement.create(rolloutCreate, 5, new RolloutGroupConditionBuilder()
.withDefaults().successCondition(RolloutGroupSuccessCondition.THRESHOLD, "10").build());
// Run here, because Scheduler is disabled during tests