Skip to content

Test passing a config template to the RegisterCommand

What does this MR do?

It provides coverage to the register command when passing --template-config. There is already some low-level testing done TestConfigTemplate_MergeTo, but this MR adds testing of the logic when integrated into the RegisterCommand in mergeTemplate.

Both tests share the same base test cases, which were extracted to getBaseMergeTemplateTestCases(). I also added a utility replaceFatalLogWithPanic method to help test that logrus.Fatal is indeed called. Not sure if we want to move this method to helpers/test/helpers.go since it is a reusable method.

Why was this MR needed?

To add test coverage to mergeTemplate.

What's the best way to test this MR?

Compare the before/after coverage.

What are the relevant issue numbers?

Part of #26642 (closed)

Merge request reports