Skip to content

Commit

Permalink
Use event listener for identity rather than polling
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Broadhurst <[email protected]>
  • Loading branch information
peterbroadhurst committed Jan 19, 2024
1 parent bca6aa1 commit 765fd8b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func WaitForEvent(t *testing.T, c chan *core.EventDelivery, eventType core.Event
t.Logf("Detected '%s' event for ref '%s'", ed.Type, ed.Reference)
return
}
t.Logf("Ignored event '%s'", ed.ID)
t.Logf("Ignored event '%s' [%s]", ed.ID, ed.Type)
}
}

Expand All @@ -149,7 +149,7 @@ func WaitForMessageConfirmed(t *testing.T, c chan *core.EventDelivery, msgType c
t.Logf("Detected '%s' event for message '%s' of type '%s'", ed.Type, ed.Message.Header.ID, msgType)
return ed
}
t.Logf("Ignored event '%s'", ed.ID)
t.Logf("Ignored event '%s' [%s]", ed.ID, ed.Type)
}
}

Expand All @@ -160,7 +160,7 @@ func WaitForMessageRejected(t *testing.T, c chan *core.EventDelivery, msgType co
t.Logf("Detected '%s' event for message '%s' of type '%s'", ed.Type, ed.Message.Header.ID, msgType)
return ed
}
t.Logf("Ignored event '%s'", ed.ID)
t.Logf("Ignored event '%s' [%s]", ed.ID, ed.Type)
}
}

Expand All @@ -171,7 +171,7 @@ func WaitForIdentityConfirmed(t *testing.T, c chan *core.EventDelivery) *core.Ev
t.Logf("Detected '%s' event for identity '%s'", ed.Type, ed.Reference)
return ed
}
t.Logf("Ignored event '%s'", ed.ID)
t.Logf("Ignored event '%s' [%s]", ed.ID, ed.Type)
}
}

Expand Down
14 changes: 7 additions & 7 deletions test/e2e/multiparty/contract_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package multiparty
import (
"fmt"
"strings"
"time"

"github.com/hyperledger/firefly-common/pkg/fftypes"
"github.com/hyperledger/firefly/pkg/core"
Expand Down Expand Up @@ -109,7 +108,7 @@ func runMigrationTest(suite *ContractMigrationTestSuite, address1, address2 stri
e2e.PollForUp(suite.T(), client1)
e2e.PollForUp(suite.T(), client2)

eventNames := "message_confirmed|blockchain_event_received"
eventNames := "message_confirmed|blockchain_event_received|identity_confirmed"
queryString := fmt.Sprintf("namespace=%s&ephemeral&autoack&filter.events=%s", testNamespace, eventNames)
received1 := e2e.WsReader(client1.WebSocket(suite.T(), queryString, nil))
received2 := e2e.WsReader(client2.WebSocket(suite.T(), queryString, nil))
Expand Down Expand Up @@ -151,11 +150,12 @@ func runMigrationTest(suite *ContractMigrationTestSuite, address1, address2 stri
client2.RegisterSelfNode(suite.T(), true)

// Wait for the orgs to propagate (org2 to node1, and org1 to node 2)
for client1.GetOrganization(suite.T(), suite.testState.org2.Name) == nil {
time.Sleep(100 * time.Millisecond)
}
for client2.GetOrganization(suite.T(), suite.testState.org1.Name) == nil {
time.Sleep(100 * time.Millisecond)
orgConfs := append([]*core.EventDelivery{}, e2e.WaitForIdentityConfirmed(suite.T(), received1))
orgConfs = append(orgConfs, e2e.WaitForIdentityConfirmed(suite.T(), received1))
orgConfs = append(orgConfs, e2e.WaitForIdentityConfirmed(suite.T(), received2))
orgConfs = append(orgConfs, e2e.WaitForIdentityConfirmed(suite.T(), received2))
for _, oc := range orgConfs {
assert.Regexp(suite.T(), fmt.Sprintf("%s|%s", suite.testState.org1.Name, suite.testState.org2.Name), oc.Identity.DID)
}

// Migrate to the new contract
Expand Down

0 comments on commit 765fd8b

Please sign in to comment.