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

Unable to verify context in empty Publisher using StepVerifierOptions #3373

Open
ranarula opened this issue Mar 2, 2023 · 0 comments
Open
Assignees
Labels
type/bug A general bug
Milestone

Comments

@ranarula
Copy link

ranarula commented Mar 2, 2023

Expected Behavior

All test pass

Actual Behavior

  • Only non-empty publisher test passes with StepVerifierOptions
  • Test with empty publisher using StepVerifierOptions fail with "No propagated Context"
  • Non empty publisher with ContextWrite passes

Steps to Reproduce

Run these test

public class ContextTest {

  StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create()
      .withInitialContext(Context.of("a", "b"));
  //fails
  @Test
  void testContextEmptyMono() {
    StepVerifier.create(Mono.empty(), stepVerifierOptions)
        .expectAccessibleContext()
        .contains("a", "b")
        .then()
        .verifyComplete();
  }

  @Test
  void testContextEmptyFlux() {
    StepVerifier.create(Flux.empty(), stepVerifierOptions)
        .expectAccessibleContext()
        .contains("a", "b")
        .then()
        .verifyComplete();
  }

  //passes
@Test
  void testContextEmptyMonoWithContextWrite() {
    StepVerifier.create(Mono.empty().contextWrite(Context.of("a","b")))
        .expectAccessibleContext()
        .contains("a", "b")
        .then()
        .verifyComplete();
  }

  @Test
  void testContextNonEmptyMono() {
    StepVerifier.create(Mono.just("item"), stepVerifierOptions)
        .expectAccessibleContext()
        .contains("a", "b")
        .then()
        .expectNext("item")
        .verifyComplete();
  }

  @Test
  void testContextNonEmptyFlux() {
    StepVerifier.create(Flux.just("item"), stepVerifierOptions)
        .expectAccessibleContext()
        .contains("a", "b")
        .then()
        .expectNext("item")
        .verifyComplete();
  }
}

Your Environment

  • Reactor version(s) used: 3.4.27
  • JVM version (java -version): 11
@reactorbot reactorbot added the ❓need-triage This issue needs triage, hasn't been looked at by a team member yet label Mar 2, 2023
@OlegDokuka OlegDokuka added type/bug A general bug and removed ❓need-triage This issue needs triage, hasn't been looked at by a team member yet labels Mar 6, 2023
@chemicL chemicL added this to the 3.6.x Backlog milestone Aug 2, 2024
@chemicL chemicL self-assigned this Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants