Add SyncPlugin unit tests for ConfigSyncEventHandler#234
Open
Add SyncPlugin unit tests for ConfigSyncEventHandler#234
Conversation
- Add AgileConfig.Server.SyncPlugin project with: - ISyncPlugin interface - SyncEngine for managing plugins - ConfigSyncService for triggering sync on config changes - SyncPluginConfig, SyncContext models - Add AgileConfig.Server.SyncPlugin.Plugins.Etcd project: - EtcdSyncPlugin implementation - Add AgileConfig.Server.SyncPlugin.Plugins.Consul project: - ConsulSyncPlugin implementation - Update solution and project references
- Add ConfigSyncEventHandler to sync configs on publish - Add ConfigDeleteSyncEventHandler to remove configs on delete - Register SyncPlugin services in DI container - Register sync event handlers in SystemEventHandlersRegister
- Add RegisterBuiltInPlugins extension method - Include Etcd and Consul plugin registration samples - Plugins disabled by default, can be enabled via config
- Use correct property name Group instead of GroupName - Use AppId as AppName since entity doesn't have that property
- Change package reference from dotnet.etcd to Etcd.Client - Update EtcdSyncPlugin to use new client API
- Fix namespace issues in SyncPlugin models - Fix Config entity property references (Group not GroupName) - Fix SafeExecuteAsync lambda expressions - Fix etcd client API usage (synchronous calls) - Fix Consul KV.Set -> KV.Put - Add missing using directives
- Simplify ISyncPlugin to only have SyncAllAsync (replace all) - Add FailedSyncRecord to track failed syncs (stores only appId+env) - Add SyncRetryService for retry logic (always fetches latest configs) - Add SyncRetryBackgroundService for periodic retry - Update event handler to use new sync strategy - Placeholder implementations for Etcd and Consul plugins (TODO: fix API)
- Use dotnet-etcd package for etcd connectivity - Implement SyncAllAsync with delete + put operations - Fix API usage (synchronous methods)
- Use etcd v3 HTTP API instead of gRPC - No external etcd package needed, just HttpClient - Implement SyncAllAsync with delete + put operations - Base64 encode keys/values as required by etcd API
…lve circular dependency - Create AgileConfig.Server.SyncPlugin.Contracts project - Move ISyncPlugin interface and all models (SyncContext, SyncPluginConfig, etc.) to Contracts - Update SyncPlugin, Plugins.Etcd, Plugins.Consul to reference Contracts - Fix namespace references across all affected files - Remove duplicate ISyncPlugin.cs from SyncPlugin project
- Add 5 test cases covering: - Valid timeline triggers sync - No published configs skips sync - Null timeline returns early - Sync failure records failed attempt - Exception records failed attempt - All 11 tests pass (6 existing + 5 new)
1. Add AgileConfig.Server.SyncPlugin.Contracts to AgileConfig.sln 2. Modify SyncPluginInitializer to read config from appsettings.json 3. Add SyncPlugin section to appsettings.json with etcd plugin config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add 5 unit tests for the new SyncPlugin feature:
All 11 tests pass (6 existing + 5 new).
Test Results