Skip to content

Commit

Permalink
Disable Launch start wait for Secondary Launches if async reporting i…
Browse files Browse the repository at this point in the history
…s enabled. Disable Statistics for Secondary Launches.
  • Loading branch information
HardNorth committed Oct 25, 2024
1 parent 6af9ab9 commit 6faba51
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## [Unreleased]
### Added
- `rp.client.join.launch.timeout.value` and `rp.client.join.launch.timeout.unit` configuration properties to control SecondaryLaunch start timeout on client join, by @HardNorth
### Changed
- Disable Launch start wait for Secondary Launches if async reporting is enabled, by @HardNorth
- Disable Statistics for Secondary Launches, by @HardNorth

## [5.2.15]
### Changed
Expand Down
17 changes: 15 additions & 2 deletions src/main/java/com/epam/reportportal/service/LaunchImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,33 @@ private void truncateAttributes(@Nonnull final FinishExecutionRQ rq) {
/**
* Starts launch in ReportPortal. Does NOT start the same launch twice
*
* @param statistics Send or not Launch statistics
* @return Launch ID promise
*/
@Nonnull
public Maybe<String> start() {
protected Maybe<String> start(boolean statistics) {
launch.subscribe(logMaybeResults("Launch start"));
ListenerParameters params = getParameters();
if(params.isPrintLaunchUuid()) {
launch.subscribe(printLaunch(params));
}
LaunchLoggingContext.init(this.launch, getClient(), getScheduler(), getParameters());
getStatisticsService().sendEvent(launch, startRq);
if(statistics) {
getStatisticsService().sendEvent(launch, startRq);
}
return launch;
}

/**
* Starts launch in ReportPortal. Does NOT start the same launch twice
*
* @return Launch ID promise
*/
@Nonnull
public Maybe<String> start() {
return start(true);
}

/**
* Finishes launch in ReportPortal. Blocks until all items are reported correctly
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ public Boolean call() {
disposables.add(launch.subscribe(uuid -> {
Maybe<LaunchResource> maybeRs = client.getLaunchByUuid(uuid);
if (maybeRs != null) {
disposables.add(maybeRs.subscribe(
launchResource -> result = Boolean.TRUE,
throwable -> LOGGER.debug(
"Unable to get a Launch: " + throwable.getLocalizedMessage(),
disposables.add(maybeRs.subscribe(launchResource -> result = Boolean.TRUE,
throwable -> LOGGER.debug("Unable to get a Launch: " + throwable.getLocalizedMessage(),
throwable
)
));
Expand All @@ -92,8 +90,10 @@ public Boolean call() {
@Nonnull
@Override
public Maybe<String> start() {
waitForLaunchStart();
return super.start();
if (!getParameters().isAsyncReporting()) {
waitForLaunchStart();
}
return super.start(false);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class ReportPortalClientJoinTest {
private final Supplier<ListenerParameters> paramSupplier = () -> {
ListenerParameters p = TestUtils.standardParameters();
p.setClientJoin(true);
p.setAsyncReporting(false);
return p;
};

Expand Down Expand Up @@ -346,10 +347,9 @@ public void test_secondary_launch_awaits_get_launch_by_uuid_correct_response_for
}

@Test
public void test_secondary_launch_awaits_get_launch_by_uuid_correct_response_for_v2() {
public void test_secondary_launch_does_not_await_get_launch_by_uuid_correct_response_for_v2() {
int num = 2;
simulateObtainLaunchUuidResponse(launchIdLock);
simulateGetLaunchByUuidResponse(rpClient);
ListenerParameters p = paramSupplier.get();
p.setAsyncReporting(true);
List<Launch> launches = new ArrayList<>(num);
Expand All @@ -360,7 +360,7 @@ public void test_secondary_launch_awaits_get_launch_by_uuid_correct_response_for
launches.get(1).start();

verify(launchIdLock, timeout(WAIT_TIMEOUT).times(2)).obtainLaunchUuid(anyString());
verify(rpClient, after(WAIT_TIMEOUT * 3).times(3)).getLaunchByUuid(anyString());
verify(rpClient, after(WAIT_TIMEOUT * 3).times(0)).getLaunchByUuid(anyString());
}

@Test
Expand Down

0 comments on commit 6faba51

Please sign in to comment.