@Test
public void checkBulkPolicyCreations() {

    AutoScalingPolicyTests.MockAlarmClient mockAlarmClient = new AutoScalingPolicyTests.MockAlarmClient();
    AutoScalingPolicyTests.MockAppAutoScalingClient mockAppAutoScalingClient = new AutoScalingPolicyTests.MockAppAutoScalingClient();
    InMemoryPolicyStore policyStore = new InMemoryPolicyStore();
    final int totalJobs = 300;
    List<String> jobIds = new ArrayList<>(totalJobs);
    for (int i = 0; i < totalJobs; i++) {
        String jobId = UUID.randomUUID().toString();
        jobIds.add(jobId);
    }
    V3JobOperations v3JobOperations = mockV3OperationsForJobs(jobIds);
    DefaultAppScaleManager appScaleManager = new DefaultAppScaleManager(policyStore, mockAlarmClient,
            mockAppAutoScalingClient,
            v3JobOperations,
            new DefaultRegistry(),
            AutoScalingPolicyTests.mockAppScaleManagerConfiguration(),
            Schedulers.computation(),
            mock(TitusRuntime.class));
    final CountDownLatch latch = new CountDownLatch(totalJobs);
    for (int i = 0; i < totalJobs; i++) {
        final AutoScalingPolicy autoScalingPolicy = AutoScalingPolicyTests.buildStepScalingPolicy(jobIds.get(i));
        appScaleManager.createAutoScalingPolicy(autoScalingPolicy).subscribe(pid -> {
            log.info("Policy created {}", pid);
            latch.countDown();
        });
    }
    await().timeout(30, TimeUnit.SECONDS).until(() -> mockAppAutoScalingClient.getNumPolicies() == totalJobs);
}