apache / apache/auron

SparkAuronConfiguration does not work well with unit tests

Open
#1,729 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
1.8k
Forks
241
Avg merge
2d 12h
Merged PRs (30d)
21

Description

**Describe the bug**
The configuration component is:
- Backed by a global singleton and process-wide mutable state.
- Read indirectly through static helpers instead of via injected or scoped configuration.
- Not aligned with the usual test utilities (e.g., per-test overrides / context-local configs).
- This makes it difficult for unit tests to toggle config in a safe, local way.

Ideally, it should look like the utility provided by AuronConverters.

```scala
private lazy val foo: Boolean =
AuronConverters.getBooleanConf(
"spark.auron.foo",
defaultValue = false)
```

**To Reproduce**
1. Write code that reads a configuration flag via the global config helper.
2. In a unit test, try to change behavior by setting that config just for the test (e.g., via a per-test helper or context API).
3. The code still reads from the global state.

**Expected behavior**
Configuration should be:
- Scoped (per test, per request, or per session), not global.
- Injectable or overridable at the boundary of the component under test.
- Compatible with normal testing patterns (e.g., fixtures, context managers, withConfig { ... }-style APIs).

**Screenshots**

**Additional context**

A more test-friendly design would centralize config in a small object passed into components (or read from a clearly scoped context), so each test can construct the configuration it needs without mutating global state.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.