You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: TOOLS-3077 - Add Server Diff Functionality to asconfig diff Command (#70)
* feat: TOOLS-3077 add server diff functionality to compare local config with running Aerospike server
- Introduced a new `--server` flag for the `diff` command to allow comparison of a local configuration file against the live configuration from a running Aerospike server.
- Updated error handling for argument counts specific to server diff.
- Refactored the diff command to separate file-to-file and server-to-file comparison logic.
* test: add comprehensive tests for server diff functionality and argument validation
- Introduced new test cases for the `--server` flag in the diff command, covering various scenarios including missing arguments, invalid formats, and non-existent files.
- Added validation tests for server diff arguments to ensure proper error handling.
- Enhanced existing tests for file diff functionality to include edge cases and argument validation.
* chore: update go.sum to remove obsolete aerospike-management-lib entries
- Removed outdated versions of aerospike-management-lib from go.sum to streamline dependencies and ensure compatibility with the latest library versions.
* feat: Improve type-aware comparison in diff logic
Replaces reflect.DeepEqual with a custom valuesEqual function for more robust type-aware comparison, handling cases like int vs string, slices, and booleans. Ensures server and local configs are parsed through the same path to normalize data types before diffing, improving accuracy of configuration diffs.
* fix: Improve valuesEqual logic and add comprehensive tests
Refactored the valuesEqual function to compare values by string conversion first, improving type flexibility and preventing panics on slice comparison. Added extensive unit tests for valuesEqual, isSlice, slicesEqual, diffFlatMaps, and argument validation in diff_test.go to ensure correctness and robustness of diff logic.
* feat: make slice comparison order-agnostic and efficient
Refactored slicesEqual to compare slices in an order-agnostic way using frequency counting for O(n) complexity. Added convertToStringSlice to handle different slice types and ensure consistent comparison. Updated tests to validate new behavior, including mixed types and order variations.
* feat: Add beta warning and adjust log levels in diff command
Introduces a warning message indicating the server diff feature is in beta
Since the generate command is in beta and diff with server uses generate functionality
* refactor: refactor diff command and add subcommand for server diff
Refactors the diff command to use a subcommand structure, moving server diff functionality to a new 'diff server' subcommand. Simplifies flag handling, updates help text and examples, and streamlines the diff logic by removing custom value comparison in favor of reflect.DeepEqual.
* refactor: Remove redundant and low-level unit tests from diff_test.go
This commit removes extensive low-level unit tests for helper functions such as valuesEqual, isSlice, and slicesEqual, as well as redundant server diff argument validation and flag validation tests. The remaining tests focus on higher-level command behavior and integration, streamlining the test suite and reducing maintenance overhead.
* docs: Update diff command descriptions for server comparison
Expanded the short and long descriptions of the diff command to clarify support for comparing a config file against a running server. Marked the server comparison feature as BETA in the server subcommand descriptions.
* docs: TOOLS-3077 Update diff command descriptions for clarity
Improved the short and long descriptions for the diff and server subcommands to clarify that comparisons are made against a running server's configuration. Updated examples and added notes about supported file formats for better user guidance.
* fix: Refactor format flag handling in diff commands
Moved the --format flag from persistent to local flags in the diff command and hid it in the server diff subcommand, as the format will be auto-detected. Added a debug log to show the detected local file format.
* feat: TOOLS-3077 Refactor diff command to use subcommands
Introduces 'files' and 'server' subcommands for the diff command, improving clarity and extensibility. The legacy behavior is preserved for backward compatibility, with a warning message. Adds tests for both legacy and new subcommand usage, including argument validation.
* fix: Update diff tests to use substring match
Changed the diff test assertion to check if the output contains the expected result instead of requiring an exact match. This allows for additional warnings or messages in the output without failing the test.
* docs: Update diff command help text and examples
Improved the help text and examples for the diff, diff files, and diff server commands to clarify usage, supported formats, and default behaviors. Added more detailed flag descriptions and updated example host/port formats for consistency.
* Update cmd/diff.go
update server diff usage example
Co-authored-by: dwelch-spike <[email protected]>
---------
Co-authored-by: dwelch-spike <[email protected]>
0 commit comments