Refactor string normalization function and test it. #35
Labels
good first issue
Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.
hacktoberfest
Description
This package normalizes certain strings in the intermediate representation.
It strips any whitespace and quotations/commas from each container's environment variables.
Two things need to be done:
Some examples of code that needs to be refactored:
for _, scObj := range ir.Services {
https://github.com/konveyor/move2kube/blob/master/internal/optimizer/normalizecharactersoptimizer.go#L34-L35
TrimSpace
https://golang.org/pkg/strings/#TrimSpacehttps://github.com/konveyor/move2kube/blob/master/internal/optimizer/normalizecharactersoptimizer.go#L40-L41
https://github.com/konveyor/move2kube/blob/master/internal/optimizer/normalizecharactersoptimizer.go#L60-L64
How to get started
For this issue you should start with some simple tests that creates simple IR objects and calls the function on them.
Next step would be to make slight changes to the IR objects and create a separate subtest for each scenario.
Some scenarios that are good to test:
affinity
.How to add unit tests
Some guidelines:
Some helpful resources on how to write unit tests in Go:
Code to be tested
move2kube/internal/optimizer/normalizecharactersoptimizer.go
Lines 32 to 64 in c9b5d0f
The text was updated successfully, but these errors were encountered: