Skip to content

CAMEL-25645: camel-milo - ServerCertificateValidationTest writes the value before the consumers start - #27999

Merged
davsclaus merged 1 commit into
mainfrom
fix/milo-server-cert-test-bad-value
Oct 17, 2026
Merged

davsclaus merged 1 commit into
mainfrom
fix/milo-server-cert-test-bad-value

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Summary

ServerCertificateValidationTest.onlyClientsThatCanValidateTheServerCertificateConnect fails on main:

mock://trustAll Received message count. Expected: <1> but was: <2>

CAMEL-25626 (#27908) and CAMEL-25645 (#27824) were merged 26 seconds apart on 2026-10-16, and neither PR build ran with the other change. Since CAMEL-25626, a consumer also delivers a null value with a Bad status. So the trustAll client, which connects before the test writes Foo, first receives the initial DataValue[value=null, statusCode=Bad] of milo-server:myitem1. The main build does not run the camel-milo tests, so it did not catch this. The failure shows up on every PR that touches camel-milo (for example #27910 and #27906).

The consumer routes are now autoStartup(false), and the test starts them after it writes the value, as MonitorItemTest does since CAMEL-25626. Foo is then the first notification of every client that connects, and the expectations do not change. Test-only change.

Test plan

  • ServerCertificateValidationTest fails on main (55ed20f) and passes with this change (3 runs)
  • Full camel-milo test suite: 74 run, 0 failures

Claude Code on behalf of Claus Ibsen

🤖 Generated with Claude Code

…value before the consumers start

Since CAMEL-25626 a consumer also delivers a null value with a Bad status, so
a client that connected before the test wrote Foo received the initial Bad
value of the item as well, and mock:trustAll got 2 messages. The two changes
were merged on main 26 seconds apart and neither PR build ran with the other.

The consumer routes now start after the value is written, as MonitorItemTest
does since CAMEL-25626, so Foo is the first notification of each client.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@davsclaus davsclaus added the test label Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-milo

🔬 Scalpel shadow comparison — Scalpel: 1 of 706 tested, 0 compile-only — current: 8 all tested

Maveniverse Scalpel detected 1 affected modules (current approach: 8).

Skip-tests mode would test 1 modules (1 direct + 0 downstream), skip tests for 0 (generated code, meta-modules)

Modules only in current approach (7)
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules Scalpel would test (1)
  • camel-milo ← components/camel-milo/src/test/java/org/apache/camel/component/milo/ServerCertificateValidationTest.java

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (8 modules, 1m 51s total)

Total reactor time: 1m 51s

Module Duration Status
Camel :: JBang :: Plugin :: Validate 46.4s SUCCESS
Camel :: JBang :: MCP 36.6s SUCCESS
Camel :: YAML DSL :: Validator 20.2s SUCCESS
Camel :: JBang :: Plugin :: MCP 3.3s SUCCESS
Camel :: YAML DSL :: Validator Maven Plugin 2.8s SUCCESS
Camel :: Launcher :: Container 1.8s SUCCESS
Camel :: JBang :: Plugin :: TUI n/a
Camel :: Milo n/a

Top 20 slowest modules:

  • Camel :: JBang :: Plugin :: Validate (46.4s)
  • Camel :: JBang :: MCP (36.6s)
  • Camel :: YAML DSL :: Validator (20.2s)
  • Camel :: JBang :: Plugin :: MCP (3.3s)
  • Camel :: YAML DSL :: Validator Maven Plugin (2.8s)
  • Camel :: Launcher :: Container (1.8s)

⚙️ View full build and test results

@davsclaus davsclaus added this to the 4.24.0 milestone Oct 17, 2026
@davsclaus
davsclaus merged commit eb14b16 into main Oct 17, 2026
6 checks passed
@davsclaus
davsclaus deleted the fix/milo-server-cert-test-bad-value branch October 17, 2026 13:30
gnodet added a commit to gnodet/camel that referenced this pull request Oct 23, 2026
…dundant test changes

- Add testAwaitedCallReturnsResult() to CallClientTest to verify that an awaited
  call returns a non-null CallMethodResult with a good status and the expected
  output argument (CAMEL-25694 regression test on the real server path)
- Add upgrade guide entry for the two observable behaviour changes:
  * an awaited write/call/read that fails now fails the exchange
  * an awaited call that succeeds now returns CallMethodResult as the body
- Revert comment-only changes to ServerCertificateValidationTest: main already
  has the autoStartup(false) fix from CAMEL-25645 (apache#27999), so these rewrites
  only add noise to the commit history
davsclaus pushed a commit that referenced this pull request Oct 23, 2026
…ted as success (#27956)

* CAMEL-25694: camel-milo - fix write/call service failures being reported as success

In SubscriptionManager.write(), call(), readValues() and browse(), the futures
returned by the underlying Milo client were chained with handleAsync(). When the
upstream future completed exceptionally (e.g. Bad_Timeout service fault), the
handleAsync() callback ran with a non-null 'e' parameter but returned the result
value (null), converting the exceptional completion into a normal completion with
a null value.

MiloClientProducer awaits the future with whenComplete() and only sets an exchange
exception when the throwable is non-null. Since handleAsync() had already discarded
the exception, the producer saw a null-completed future, reported success, and set
the exchange body to null.

The fix replaces handleAsync() with whenCompleteAsync() in all four methods.
whenCompleteAsync() runs the side-effect (handleConnectionFailure) but propagates
the original completion unchanged: exceptional stays exceptional, success stays
success.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: ServerCertificateValidationTest - start consumer routes after initial write

OPC UA consumers deliver the current server node value when they subscribe.
In the original test, all routes started automatically before the write, so
each consumer received two messages: the uninitialised value at subscription
time, and the 'Foo' write. The mock expected exactly 1 message, causing a
deterministic failure ('Expected: <1> but was: <2>').

Follow the pattern established in MonitorItemTest: mark consumer routes with
autoStartup(false), write the initial value first via the server producer,
then start all consumer routes. Each consumer then sees only one notification
(the value written before it subscribed).

* fix: update SubscriptionManager test constructor calls to match new signature

* fix: address review - add awaited call test, upgrade guide, revert redundant test changes

- Add testAwaitedCallReturnsResult() to CallClientTest to verify that an awaited
  call returns a non-null CallMethodResult with a good status and the expected
  output argument (CAMEL-25694 regression test on the real server path)
- Add upgrade guide entry for the two observable behaviour changes:
  * an awaited write/call/read that fails now fails the exchange
  * an awaited call that succeeds now returns CallMethodResult as the body
- Revert comment-only changes to ServerCertificateValidationTest: main already
  has the autoStartup(false) fix from CAMEL-25645 (#27999), so these rewrites
  only add noise to the commit history

* fix: fix upgrade guide wording - Bad_TypeMismatch is a per-node status, not a transport failure

* fix: use correct requestBodyAndHeader signature with endpoint URI in CallClientTest

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant