autopilot: fix race condition in new test

This commit is contained in:
Olaoluwa Osuntokun 2019-11-01 19:30:21 -07:00
parent acd8a6e302
commit 083b574fd8
No known key found for this signature in database
GPG Key ID: BC13F65E2DC84465

View File

@ -338,6 +338,11 @@ func TestAgentHeuristicUpdateSignal(t *testing.T) {
testCtx, cleanup := setup(t, nil)
defer cleanup()
pub, err := testCtx.graph.addRandNode()
if err != nil {
t.Fatalf("unable to generate key: %v", err)
}
// We'll send an initial "no" response to advance the agent past its
// initial check.
respondMoreChans(t, testCtx, moreChansResp{0, 0})
@ -356,10 +361,6 @@ func TestAgentHeuristicUpdateSignal(t *testing.T) {
// At this point, the agent should now be querying the heuristic for
// scores. We'll respond.
pub, err := testCtx.graph.addRandNode()
if err != nil {
t.Fatalf("unable to generate key: %v", err)
}
nodeID := NewNodeID(pub)
scores := map[NodeID]*NodeScore{
nodeID: {