Skip to content

pkg/agent initial tests and other minor improvements#116

Merged
invidian merged 10 commits intomasterfrom
invidian/agent-improvements
Feb 17, 2022
Merged

pkg/agent initial tests and other minor improvements#116
invidian merged 10 commits intomasterfrom
invidian/agent-improvements

Conversation

@invidian
Copy link
Member

@invidian invidian commented Jan 7, 2022

No description provided.

@invidian invidian force-pushed the invidian/agent-improvements branch 6 times, most recently from 2988aa0 to 26f7a8b Compare January 17, 2022 11:18
@invidian invidian force-pushed the invidian/agent-improvements branch 4 times, most recently from bbccc85 to ed12f67 Compare February 11, 2022 15:30
This makes it easier when running agent in the container and also allows
testing code paths which reads the files.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So context can be re-used for API calls etc, as context also provides a
done channel, so logic using channels don't have to be changed right
now.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
So it can be lowered in unit tests.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
This way, we don't leave running goroutine when Run() context is
cancelled.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
@invidian invidian force-pushed the invidian/agent-improvements branch 2 times, most recently from d4a0059 to b79b3d3 Compare February 15, 2022 13:44
This way, when context is cancelled, we exit the loop gracefully, rather
than hanging infinitely.

No error returned in this case and is arbitrary, it could as well be an
error. However, we actually really wait for both reboot need and reboot
permission here, so exiting without error likely make sense here.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
@invidian invidian force-pushed the invidian/agent-improvements branch 3 times, most recently from 833d8fa to 7331e65 Compare February 16, 2022 13:20
So we don't end up in unresponsive deadlock.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
As default 'go test' timeout is 10 minutes already, but it won't be able
to trigger, as job will be killed before it happens, which makes it
difficult to investigate.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
@invidian invidian force-pushed the invidian/agent-improvements branch 4 times, most recently from 633e7b6 to 0ac5a74 Compare February 16, 2022 17:27
@invidian
Copy link
Member Author

Tests started passing on CI after some timing issues (I suspect CPU on GHA being stalled for some time?). Now tests styling, naming and stability needs to be reviewed, perhaps some tests can be further optimized in regards to execution time or simplicity.

@invidian invidian force-pushed the invidian/agent-improvements branch 3 times, most recently from c38b17a to ebe512f Compare February 16, 2022 23:29
@invidian invidian marked this pull request as ready for review February 16, 2022 23:34
@invidian
Copy link
Member Author

The test suite is rather extensive, but I think it's a good start for further refactoring and small features. I'll merge it tomorrow if there is no objections.

So it can be tested.

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
@invidian invidian force-pushed the invidian/agent-improvements branch from ebe512f to f208ea3 Compare February 17, 2022 09:11
Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant