Skip to content

Commit

Permalink
Merge pull request #9433 from manadart/2.4-remote-relations-test-fail
Browse files Browse the repository at this point in the history
#9433

## Description of change

This patch simply ensures that change event invocation for this test is executed after all the test arrangements have completed.

## QA steps

I could get this test to fail in reasonable time before; it now passes consistently

## Documentation changes

None. 

## Bug reference

https://bugs.launchpad.net/juju-core/+bug/1802277
  • Loading branch information
jujubot committed Nov 9, 2018
2 parents 7a12b3b + 6306ef9 commit 510a0d7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions worker/remoterelations/remoterelations_test.go
Expand Up @@ -70,7 +70,7 @@ func waitForStubCalls(c *gc.C, stub *jujutesting.Stub, expected []jujutesting.St
return
}
}
c.Fatalf("failed to see expected calls. saw: %v", calls)
c.Fatalf("failed to see expected calls.\nexpected: %v\nobserved: %v", expected, calls)
}

func (s *remoteRelationsSuite) assertRemoteApplicationWorkers(c *gc.C) worker.Worker {
Expand Down Expand Up @@ -546,8 +546,6 @@ func (s *remoteRelationsSuite) assertRemoteRelationsChangedError(c *gc.C, dying
s.waitForWorkerStubCalls(c, expected)
s.stub.ResetCalls()

relWatcher, _ := s.relationsFacade.remoteApplicationRelationsWatcher("db2")
relWatcher.changes <- []string{"db2:db django:db"}
relTag := names.NewRelationTag("db2:db django:db")
expected = []jujutesting.StubCall{
{"Relations", []interface{}{[]string{"db2:db django:db"}}},
Expand Down Expand Up @@ -579,7 +577,8 @@ func (s *remoteRelationsSuite) assertRemoteRelationsChangedError(c *gc.C, dying
s.relationsFacade.updateRelationLife("db2:db django:db", params.Dying)
forceCleanup := true
expected = append(expected, jujutesting.StubCall{
"PublishRelationChange", []interface{}{
FuncName: "PublishRelationChange",
Args: []interface{}{
params.RemoteRelationChangeEvent{
ApplicationToken: "token-django",
RelationToken: "token-db2:db django:db",
Expand All @@ -590,6 +589,10 @@ func (s *remoteRelationsSuite) assertRemoteRelationsChangedError(c *gc.C, dying
}},
)
}

relWatcher, _ := s.relationsFacade.remoteApplicationRelationsWatcher("db2")
relWatcher.changes <- []string{"db2:db django:db"}

// After the worker resumes, normal processing happens.
s.waitForWorkerStubCalls(c, expected)
}
Expand Down

0 comments on commit 510a0d7

Please sign in to comment.