Skip to content
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

application data bag: Fix racy WatchApplicationSettings tests #10573

Merged
merged 1 commit into from
Aug 29, 2019

Conversation

babbageclunk
Copy link
Contributor

@babbageclunk babbageclunk commented Aug 29, 2019

Description of change

The WatchApplicationSettings tests would fail intermittently.
Example: https://jenkins.juju.canonical.com/view/Unit%20tests/job/RunUnittests-race-amd64/1764/testReport/github/com_juju_juju_state/TestPackage/

They're getting two notifications on the watcher instead of the expected one about half the time under stress-race. Adding a StartSync fixes this.

QA steps

  • With the change the tests don't fail under stress-race.

Documentation changes

None

Bug reference

None

@@ -947,6 +947,7 @@ func (s *RelationSuite) TestWatchApplicationSettings(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
relation, err := s.State.AddRelation(eps...)
c.Assert(err, jc.ErrorIsNil)
s.State.StartSync()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should instead use WaitForModelWatchersIdle(c, s.State.ModelUUID())

The reason it fails intermittently is that the state watcher will send down an initial event, but the events that are in flight from the construction of the relation may not have fully flowed through, so you end up with an additional notification.

This is why we have the WaitForModelWatcherIdle method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, using that instead - thanks.

They'd get two notifications instead of the expected one about half
the time under stress-race. Adding a WaitForModelWatchersIdle fixes
this.
@babbageclunk
Copy link
Contributor Author

$$merge$$

@babbageclunk
Copy link
Contributor Author

$$merge$$

@jujubot jujubot merged commit 1129f12 into juju:develop Aug 29, 2019
@babbageclunk babbageclunk deleted the 2.7-test-race branch August 29, 2019 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants