Skip to content

Commit ed2407b

Browse files
committed
[Distributed] more tests to call through on remote any SomeDistActor
1 parent d321725 commit ed2407b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test/Distributed/Runtime/distributed_actor_hop_to.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,32 @@ distributed actor Worker: LifecycleWatch {
4141

4242
@main struct Main {
4343
static func main() async {
44-
let worker: any LifecycleWatch = Worker(actorSystem: DefaultDistributedActorSystem())
44+
let actorSystem = DefaultDistributedActorSystem()
45+
46+
let worker: any LifecycleWatch = Worker(actorSystem: actorSystem)
4547
try! await worker.test(x: 42, "on protocol")
4648

4749
// CHECK: executed: test(x:_:)
4850
// CHECK: executed: watch(x:_:) - x = 42, y = on protocol
4951
// CHECK: done executed: test(x:_:)
5052

53+
// ==== --------------------------------------------------------------------
54+
55+
let remote = try! Worker.resolve(id: worker.id, using: actorSystem)
56+
try! await remote.test(x: 42, "direct") // Remote call
57+
// CHECK: >> remoteCallVoid: on:main.Worker, target:test(x:_:)
58+
// CHECK: << onReturnVoid: ()
59+
60+
let remoteAny: any LifecycleWatch = remote
61+
try! await remoteAny.test(x: 42, "direct") // Remote call
62+
// CHECK: >> remoteCallVoid: on:main.Worker, target:test(x:_:)
63+
// CHECK: << onReturnVoid: ()
64+
65+
let remoteAnyOptional: (any LifecycleWatch)? = remote
66+
try! await remoteAnyOptional?.test(x: 42, "direct") // Remote call
67+
// CHECK: >> remoteCallVoid: on:main.Worker, target:test(x:_:)
68+
// CHECK: << onReturnVoid: ()
69+
5170
print("OK") // CHECK: OK
5271
}
5372
}

0 commit comments

Comments
 (0)