-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
maint(landscape-mock): Bugfixes and logging in Landcape mock #377
Conversation
Now that the mock Landscape service has loging, we need a way of setting it from the command line. To avoid parsing even more arguments manually, I switched to Cobra with a very similar structure to that of the mock contract server.
This fixes a panic (write to closed channel) in the tests. The problem was that multiple goroutines were writing to the same channel, so none of them could reliably be in charge of closing it. Now there is a single writing goroutine, which closes the channel on exit.
fc9897f
to
4710da1
Compare
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.
Just noticed a typo.
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.
I have quite some cosmetic/minor suggestion, to keep things in line with other projects and avoid the elements of suprprises when going to this mock.
And btw:
so I switched to Cobra.
I would have bet that would happen! :)
It looks better in terminals
I changed the structure of the code so it more closely resembles the WSL-Pro-Service and Windows-Agent apps. The Landscape mock App matches the interface except that it is missing the Quit method. I did not implement it because I saw no reason to. This method is used only in signal handling, which we don't use in the Landscape mock.
Hey, this is only to parse the |
We used to check that the message was not nill, but forgot to check the error. This double-check (is err nil? + is message nil?) would cause a bit of ugly nesting so I moved it into newHostInfo so we can return instead of nest. This required a renaming of newHostInfo to receiveHostInfo to keep the naming accurate.
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 now!
This PR is a spin-off off #326 . This PR does two things:
UDENG-1549