Skip to content
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

Fix stress test expectation and bug in ColdTestPublisher #3700

Merged
merged 2 commits into from
Feb 13, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ public void arbiter(II_Result r) {

// Ignore, flaky test (https://github.com/reactor/reactor-core/issues/3633)
//@JCStressTest
Comment on lines 273 to 274
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Ignore, flaky test (https://github.com/reactor/reactor-core/issues/3633)
//@JCStressTest
@JCStressTest

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the other tests can now have the ignores removed

@Outcome(id = {"200, 0", "200, 1"}, expect = ACCEPTABLE, desc = "Should produced exactly what was requested")
@Outcome(id = {"200, 0, 0", "200, 0, 1"}, expect = ACCEPTABLE, desc = "Should " +
"produced exactly what was requested")
@State
public static class RequestAndProduceStressTest2 extends FluxSwitchMapStressTest {

Expand Down Expand Up @@ -312,9 +313,17 @@ public void outerRequest() {
}

@Arbiter
public void arbiter(II_Result r) {
r.r1 = (int) (stressSubscriber.onNextCalls.get() + switchMapMain.requested);
r.r2 = stressSubscriber.onCompleteCalls.get();
public void arbiter(III_Result r) {
r.r1 = stressSubscriber.onNextCalls.get();
r.r2 = (int) switchMapMain.requested;
r.r3 = stressSubscriber.onCompleteCalls.get();

switch (r.toString()) {
case "200, 0, 0":
case "200, 0, 1":
break;
default: throw new IllegalStateException(r + " " + fastLogger);
}

if (stressSubscriber.onNextCalls.get() < 200 && stressSubscriber.onNextDiscarded.get() < switchMapMain.requested) {
throw new IllegalStateException(r + " " + fastLogger);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2021 VMware Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2017-2024 VMware Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -103,6 +103,7 @@ public void subscribe(Subscriber<? super T> s) {
}

s.onSubscribe(p); // will trigger drain() via request()
p.drain(); // ensures that empty source terminal signal is propagated without waiting for a request from the subscriber
}

boolean add(ColdTestPublisherSubscription<T> s) {
Expand Down Expand Up @@ -315,7 +316,7 @@ private void drain() {
* @return true if the TestPublisher was terminated, false otherwise
*/
private boolean emitTerminalSignalIfAny() {
if (parent.done) {
if (parent.done && this.parent.values.size() == index) {
parent.remove(this);

final Throwable t = parent.error;
Expand Down