Operator-sdk: Restore generator unit tests

Created on 15 Jun 2018  路  3Comments  路  Source: operator-framework/operator-sdk

As part of the generator refactoring #310 we've mistakenly removed all the generator unit tests.
We need to revert that and add them back.

/cc @theishshah

aretesting kinbug

Most helpful comment

We should add a code coverage indicator to prevent this kind of mistake in the future.

All 3 comments

On second thought this might not actually be an issue since we've combined all the previous generator functions into one.
https://github.com/operator-framework/operator-sdk/blob/master/pkg/generator/generator.go#L491
Taking a closer look at our previous unit tests.

We should add a code coverage indicator to prevent this kind of mistake in the future.

@theishshah As discussed offline you're right that we've reduced the generator functions down into the renderWriteFile() function and that code path can be covered by a single unit test like TestGenVersion(). Although that is only testing renderFile() and not renderWriteFile().

But the function is not the only thing that the original unit tests were meant to cover. We also need to test all of the templates themselves. So right now if someone accidentally changes any one of the templates there's nothing to test the expected output. So we need to add them back.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kristiandrucker picture kristiandrucker  路  5Comments

nrvnrvn picture nrvnrvn  路  5Comments

surajssd picture surajssd  路  3Comments

magescher picture magescher  路  3Comments

bobdonat picture bobdonat  路  3Comments