Skip to content

test: add concurrent access functional tests to Java bindings #81

@aepfli

Description

@aepfli

Problem

The Java FlagEvaluator uses synchronized methods because the WASM runtime is single-threaded. While PR #64 added JMH concurrent benchmarks, there are no functional correctness tests that verify thread safety under concurrent access.

Concurrent access is a common real-world pattern — multiple threads evaluating flags simultaneously while another thread updates state.

Scope

Add JUnit tests that verify:

  1. Concurrent evaluation — Multiple threads evaluating different flags simultaneously; all get correct results
  2. Concurrent evaluate + updateState — One thread updating flag state while others are evaluating; no crashes or corrupted results
  3. State consistency — After updateState, all subsequent evaluations (from any thread) see the new state
  4. No deadlocks — High-contention scenarios with many threads don't deadlock

Implementation Notes

  • Use ExecutorService with a thread pool (e.g., 8-16 threads)
  • Use CountDownLatch for coordinated start
  • Run enough iterations (1000+) to surface race conditions
  • Assert correctness of every evaluation result, not just absence of exceptions

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    javaJava/Chicory bindingspriority: mediumMedium prioritytestingTest coverage gaps and new test suites

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions