Repository navigation
cluster: return an error when edit-config rejects a topology file - #2762
developer-Bushido wants to merge 1 commit into
Conversation
With --topology-file, edit-config printed "New topology could not be saved" and "Nothing changed." and exited with 0 when the file could not be parsed or changed an immutable field. A script or CI job could not tell that the topology was not applied. Return the error in this case. The interactive mode is not changed, it still asks whether to continue editing.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2762 +/- ##
==========================================
- Coverage 43.82% 43.64% -0.19%
==========================================
Files 430 430
Lines 48094 48094
==========================================
- Hits 21077 20988 -89
- Misses 24262 24374 +112
+ Partials 2755 2732 -23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The playground failure looks like the known flaky start check (connection refused on 127.0.0.1:9527), not related to this change. Could someone rerun it? |
What problem does this PR solve?
tiup cluster edit-config <name> --topology-file <file>exits with 0 when the file is not applied. If the file cannot be parsed or changes an immutable field, it printsNew topology could not be saved: ...andNothing changed.and returns success, so a script or a CI job cannot tell that the topology was rejected. We had a CI job that looked green for weeks while the change was never applied.With
--format jsonthe output of such a run is also not valid JSON, and it ends with{"exit_code":0}:tiup dm edit-configuses the same code and behaves the same way.What is changed and how it works?
--topology-file,edit-confignow returns the error when the file cannot be parsed or changes an immutable field, so the command exits with 1. In JSON mode the result is{"exit_code":1,"error":"..."}.ErrTopologyParseFailed, the same error thatdeploy,scale-outandcheckreturn for a broken topology file.The behaviour changes only for a
--topology-filerun that was rejected: the exit code was 0 and is now 1, and the reason is printed as an error instead ofNew topology could not be saved: ...followed byNothing changed..Check List
Tests
TestEditConfigTopologyFilerunsEditConfigwith a topology file that changes an immutable field, one with an unknown field, an unchanged one and one with an editable change. The first two cases fail without the fix.Code changes
Side effects
Related changes
Release notes:
Summary by CodeRabbit