-
Notifications
You must be signed in to change notification settings - Fork 188
master/worker/task add strictly config verification #212
Conversation
Codecov Report
@@ Coverage Diff @@
## master #212 +/- ##
================================================
+ Coverage 58.5971% 58.9167% +0.3196%
================================================
Files 123 123
Lines 14057 14069 +12
================================================
+ Hits 8237 8289 +52
+ Misses 4990 4950 -40
Partials 830 830 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides after this pr, old task config or DM instance config in user environment may not work because of historical deprecated configuration, we'd better update docs to record this after this pr is merged. https://github.com/pingcap/docs-cn/blob/master/dev/reference/tools/data-migration/dm-upgrade.md
@@ -294,7 +294,7 @@ func (c *TaskConfig) DecodeFile(fpath string) error { | |||
return errors.Annotatef(err, "read config file %v", fpath) | |||
} | |||
|
|||
err = yaml.Unmarshal(bs, c) | |||
err = yaml.UnmarshalStrict(bs, c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can add one more test to cover DecodeFile
with invalid yaml config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
OK, And maybe ansible-playbook config templates also need to update? but I didn't find dm-ansible git repo. |
it is in DM repo, |
I have removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* add task config verify * remove useless test config * add decodefile tests * remove useless config in dm-ansible
What problem does this PR solve?
Make sure all items in configuration file has been parsed and user always knows the exactly configuration about master worker and task.
What is changed and how it works?
unmarshalStrict
to decode and return error to caller when not all config item decoded and duplicate item existedCheck List
Tests