refactor: update delivery callback in TestPacketReceiptCallbacks to use channel for improved synchronization
Some checks failed
Go Build Multi-Platform / build (amd64, freebsd) (push) Failing after 33s
Go Build Multi-Platform / build (amd64, darwin) (push) Failing after 20s
Go Build Multi-Platform / build (amd64, windows) (push) Failing after 30s
Go Build Multi-Platform / build (amd64, linux) (push) Failing after 38s
Go Build Multi-Platform / build (arm, freebsd) (push) Failing after 39s
Go Build Multi-Platform / build (arm, linux) (push) Failing after 36s
Go Test Multi-Platform / Test (macos-latest, amd64) (push) Has been cancelled
Go Build Multi-Platform / build (arm, windows) (push) Failing after 34s
Go Build Multi-Platform / build (arm64, darwin) (push) Failing after 30s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 1m25s
Go Revive Lint / lint (push) Successful in 44s
Go Build Multi-Platform / build (arm64, freebsd) (push) Failing after 29s
Go Build Multi-Platform / build (arm64, linux) (push) Failing after 31s
Go Build Multi-Platform / build (arm64, windows) (push) Failing after 44s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 43s
Go Build Multi-Platform / Create Release (push) Has been skipped
Run Gosec / tests (push) Successful in 59s
Go Test Multi-Platform / Test (windows-latest, amd64) (push) Has been cancelled
Go Test Multi-Platform / Test (macos-latest, arm64) (push) Has been cancelled
Some checks failed
Go Build Multi-Platform / build (amd64, freebsd) (push) Failing after 33s
Go Build Multi-Platform / build (amd64, darwin) (push) Failing after 20s
Go Build Multi-Platform / build (amd64, windows) (push) Failing after 30s
Go Build Multi-Platform / build (amd64, linux) (push) Failing after 38s
Go Build Multi-Platform / build (arm, freebsd) (push) Failing after 39s
Go Build Multi-Platform / build (arm, linux) (push) Failing after 36s
Go Test Multi-Platform / Test (macos-latest, amd64) (push) Has been cancelled
Go Build Multi-Platform / build (arm, windows) (push) Failing after 34s
Go Build Multi-Platform / build (arm64, darwin) (push) Failing after 30s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 1m25s
Go Revive Lint / lint (push) Successful in 44s
Go Build Multi-Platform / build (arm64, freebsd) (push) Failing after 29s
Go Build Multi-Platform / build (arm64, linux) (push) Failing after 31s
Go Build Multi-Platform / build (arm64, windows) (push) Failing after 44s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 43s
Go Build Multi-Platform / Create Release (push) Has been skipped
Run Gosec / tests (push) Successful in 59s
Go Test Multi-Platform / Test (windows-latest, amd64) (push) Has been cancelled
Go Test Multi-Platform / Test (macos-latest, arm64) (push) Has been cancelled
This commit is contained in:
@@ -181,9 +181,9 @@ func TestPacketReceiptCallbacks(t *testing.T) {
|
|||||||
receipt := NewPacketReceipt(pkt)
|
receipt := NewPacketReceipt(pkt)
|
||||||
receipt.SetDestinationIdentity(testIdent)
|
receipt.SetDestinationIdentity(testIdent)
|
||||||
|
|
||||||
deliveryCalled := false
|
deliveryCalled := make(chan bool, 1)
|
||||||
receipt.SetDeliveryCallback(func(r *PacketReceipt) {
|
receipt.SetDeliveryCallback(func(r *PacketReceipt) {
|
||||||
deliveryCalled = true
|
deliveryCalled <- true
|
||||||
})
|
})
|
||||||
|
|
||||||
packetHash := pkt.GetHash()
|
packetHash := pkt.GetHash()
|
||||||
@@ -200,9 +200,10 @@ func TestPacketReceiptCallbacks(t *testing.T) {
|
|||||||
|
|
||||||
receipt.ValidateProof(proof, proofPacket)
|
receipt.ValidateProof(proof, proofPacket)
|
||||||
|
|
||||||
time.Sleep(10 * time.Millisecond)
|
select {
|
||||||
|
case <-deliveryCalled:
|
||||||
if !deliveryCalled {
|
// Success
|
||||||
|
case <-time.After(100 * time.Millisecond):
|
||||||
t.Error("Delivery callback was not called")
|
t.Error("Delivery callback was not called")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user