Skip to content

Commit 04ea1e5

Browse files
committed
=test #575 harden test_clusterReceptionist_shouldRemoveActorsOfTerminatedNodeFromListings_onNodeCrash
1 parent 2caf01f commit 04ea1e5

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

Sources/DistributedActors/Cluster/ClusterShell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ internal class ClusterShell {
154154
}
155155

156156
guard let removedAssociation = removedAssociationOption else {
157-
system.log.warning("Attempted to terminate non-existing association [\(reflecting: remoteNode)].")
157+
system.log.debug("Attempted to terminate non-existing association [\(reflecting: remoteNode)].")
158158
return
159159
}
160160

Sources/DistributedActorsTestKit/TestProbes+Receptionist.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ extension ActorTestProbe where Message == Receptionist.Listing<String> {
2626
expected: Set<ActorRef<String>>, within timeout: TimeAmount,
2727
file: StaticString = #file, line: UInt = #line, column: UInt = #column
2828
) throws {
29-
let listing = try self.fishForMessages(within: timeout, file: file, line: line) {
30-
if $0.refs.count == expected.count { return .catchComplete }
31-
else { return .ignore }
32-
}.first!
29+
do {
30+
let listing = try self.fishForMessages(within: timeout, file: file, line: line) {
31+
if $0.refs.count == expected.count { return .catchComplete }
32+
else { return .ignore }
33+
}.first!
3334

34-
// TODO: not super efficient, rework eventually
35-
listing.refs.map { $0.path }.sorted().shouldEqual(expected.map { $0.address.path }.sorted(), file: file, line: line, column: column)
35+
// TODO: not super efficient, rework eventually
36+
listing.refs.map { $0.path }.sorted().shouldEqual(expected.map { $0.address.path }.sorted(), file: file, line: line, column: column)
37+
} catch {
38+
throw self.error("Expected \(expected), error: \(error)", file: file, line: line)
39+
}
3640
}
3741
}

Tests/DistributedActorsTests/Cluster/Reception/OpLogClusterReceptionistClusteredTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ final class OpLogClusterReceptionistClusteredTests: ClusteredActorSystemsXCTestC
302302
try p2.eventuallyExpectListing(expected: [firstRef, secondRef], within: .seconds(3))
303303

304304
// crash the second node
305-
second.shutdown()
305+
second.shutdown().wait()
306306

307307
// it should be removed from all listings; on both nodes, for all keys
308308
try p1.eventuallyExpectListing(expected: [firstRef], within: .seconds(5))

0 commit comments

Comments
 (0)