yangjj-iso opened a new pull request, #7659:
URL: https://github.com/apache/shenyu/pull/7659
Fixes #6220.
For Nacos, `serviceExists()` reports whether a service has healthy
instances. `DefaultDiscoveryProcessor.createProxySelector()` treats an empty
service as an error before subscribing, so restoring a persisted selector for
an offline backend aborts Admin startup and never installs the listener needed
for its recovery.
Allow the registry watch to be installed when no instances are available.
The existing initial fetch can then remove stale upstreams and publish an empty
snapshot, while later registry events restore the backend. Missing discovery
initialization and actual subscription failures still propagate normally.
Add three regression scenarios through the real Admin
synchronization/processor code and the real Nacos SPI provider, with the Nacos
NamingService and persistence boundary mocked:
- Restore both selector and proxy-selector records while the service is
offline, then synchronize the namespace again without duplicating
subscriptions. Verify stale upstream removal and empty snapshots.
- For each restoration path, deliver later online/offline events and verify
persisted upstream changes, synchronization snapshots, and namespace/selector
identity.
- Verify that a subscription error retains its cause, does not cache a
successful watch, and permits a subsequent retry.
Update the existing processor test to verify the uninitialized-discovery
error separately from a valid discovery whose service has no instances.
Validation:
- All three new scenarios fail on the original implementation at the
service-existence guard.
- After the fix, all 53 selected Admin/Nacos tests pass with zero
failures/errors/skips.
- Checkstyle and Apache RAT pass across the affected reactor; `git diff
--check` passes.
- Full-repository install and testing against a live Nacos server were not
run locally.
```sh
./mvnw -B -ntp -pl shenyu-admin -am test \
-Dtest=DefaultDiscoveryProcessorTest,NacosDiscoveryRecoveryTest,DiscoveryServiceImplTest,DiscoveryDataChangedEventSyncListenerTest,CustomDiscoveryUpstreamParserTest,DiscoveryTransferTest,NacosInstanceRegisterRepositoryTest,DiscoveryProcessorHolderTest
\
-Dsurefire.failIfNoSpecifiedTests=false -DskipRemoteResources=true \
-Djacoco.skip=true -Dmaven.javadoc.skip=true
./mvnw -B -ntp -pl shenyu-admin -am apache-rat:check
-DskipRemoteResources=true
```
- [x] Read the [contribution
guidelines](https://shenyu.apache.org/community/contributor-guide/).
- [x] Submit regression tests.
- [ ] Full local `./mvnw clean install -Dmaven.javadoc.skip=true`
(affected-reactor validation above).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]