-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix flakey tentacle command line tests #737
Fix flakey tentacle command line tests #737
Conversation
This pull request has been linked to Shortcut Story #65398: Fix flakey tentacle command line tests. |
@@ -404,10 +408,12 @@ public async Task ListInstancesCommandJson(TentacleConfigurationTestCase tc) | |||
public async Task ShouldLogStartupDiagnosticsToInstanceLogFileOnly(TentacleConfigurationTestCase tc) |
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.
This was the test that was flaky
1714600
to
ef2570a
Compare
FYI, turns out this was not the primary reason for the flaky test. The main reason was that when Tentacle starts up, it checks to see if it If that fails, it will fall back to logging into the default log file (that all tentacles log into). This is what happened when the logs were not showing up.
This PR will solve that issue for tests. |
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
…tances of Tentancle in the same directory
…causing a test to fail that we did not think was worth spending time fixing
34289eb
to
b25550c
Compare
We decided to remove It was considered not worth investing time to fix this. So we deleted this enhancement. |
[sc-65398]
Background
The
TentacleCommandLineTests.ShouldLogStartupDiagnosticsToInstanceLogFileOnly
test was flaky. This needed to be fixed.Results
Before
The test would create an instance of Tentacle by running
Tentacle.exe
(setting everything up). Then, while this instance was running, it would run theshow-thumbprint
command against the same executable, creating a second instance.What we believe was causing the failure was that the first instance was writing to the log file while the second instance was starting up. This would, lock the log file and prevent the second instance from writing logs.
This test does its assertion by looking at the log file. Since the second instance logs were not being logged, it would therefore fail.
One would expect the second instance to throw an error when file locking occurs. However, we have configured NLog with
throwExceptions="false"
, so if any errors are thrown while logging, it will simply not log and continue as if nothing has happened. This is great for customers, but not for finding test issues.After
To solve this, we stop the first instance of the running tentacle before we attempt to run the command. This will prevent the file lock, and will therefore allows the logs to be populated as expected.
To make the other tests in this file safer, we also stopped the initial Tentacle instance for each test that also ran a second instance over the first.
To help diagnose future issues, we have also set
throwExceptions="true"
for tests only. We proved this does indeed work with this test run (where we purposely locked the file)How to review this PR
Quality ✔️
Pre-requisites