cli: instantiate viper instead of using a singleton #119
+115
−173
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #76
This PR contains my try at implementing this issue but I don't think it's worth to change they way we handle viper. The issue was opened with the idea of simplifying tests, but currently this seems to make it harder. I think the only advantage of this would be to run tests concurrently, which we currently do not have.
As you can see, this approach has the following problems:
root.go
then we have to either pass viper to every single command or start the api client in root as well. I initially went with the second approach, since I thought the first one would make the code a lot more verbose without much benefit.REANA_SERVER_URL
env var.testCmdRun()
, which will then perform all the tests necessary. Since now we have dependency injection, we'd need need either create a root command instead or pass a generation function totestCmdRun()
. Neither of them work:The viable alternative seems to be passing viper to very single command. I can do it to show how it looks like but it doesn't seem worth it to me. I'm happy to hear your thoughts on this.