Skip to content

Commit 51e806c

Browse files
ktosokavon
authored andcommitted
update distributed_actor_init_local test
1 parent a4a5d32 commit 51e806c

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

test/Distributed/Runtime/distributed_actor_init_local.swift

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,27 @@ enum MyError: Error {
1515
}
1616

1717
distributed actor PickATransport1 {
18-
init(kappa system: FakeActorSystem, other: Int) {}
18+
init(kappa system: FakeActorSystem, other: Int) {
19+
self.actorSystem = system
20+
}
1921
}
2022

2123
distributed actor PickATransport2 {
22-
init(other: Int, thesystem: FakeActorSystem) async {}
24+
init(other: Int, thesystem: FakeActorSystem) async {
25+
self.actorSystem = thesystem
26+
}
2327
}
2428

2529
distributed actor LocalWorker {
26-
init(system: FakeActorSystem) {}
30+
init(system: FakeActorSystem) {
31+
self.actorSystem = system
32+
}
2733
}
2834

2935
distributed actor Bug_CallsReadyTwice {
3036
var x: Int
3137
init(system: FakeActorSystem, wantBug: Bool) async {
38+
self.actorSystem = system
3239
if wantBug {
3340
self.x = 1
3441
}
@@ -38,6 +45,7 @@ distributed actor Bug_CallsReadyTwice {
3845

3946
distributed actor Throwy {
4047
init(system: FakeActorSystem, doThrow: Bool) throws {
48+
self.actorSystem = system
4149
if doThrow {
4250
throw MyError.test
4351
}
@@ -47,6 +55,7 @@ distributed actor Throwy {
4755
distributed actor ThrowBeforeFullyInit {
4856
var x: Int
4957
init(system: FakeActorSystem, doThrow: Bool) throws {
58+
self.actorSystem = system
5059
if doThrow {
5160
throw MyError.test
5261
}
@@ -108,13 +117,26 @@ struct FakeActorSystem: DistributedActorSystem {
108117
func remoteCall<Act, Err, Res>(
109118
on actor: Act,
110119
target: RemoteCallTarget,
111-
invocation: inout InvocationDecoder,
120+
invocation: inout InvocationEncoder,
112121
throwing: Err.Type,
113122
returning: Res.Type
114123
) async throws -> Res
115-
where Act: DistributedActor,
116-
Act.ID == ActorID,
117-
Res: SerializationRequirement {
124+
where Act: DistributedActor,
125+
Act.ID == ActorID,
126+
Err: Error,
127+
Res: SerializationRequirement {
128+
throw ExecuteDistributedTargetError(message: "Not implemented")
129+
}
130+
131+
func remoteCallVoid<Act, Err>(
132+
on actor: Act,
133+
target: RemoteCallTarget,
134+
invocation: inout InvocationEncoder,
135+
throwing: Err.Type
136+
) async throws
137+
where Act: DistributedActor,
138+
Act.ID == ActorID,
139+
Err: Error {
118140
throw ExecuteDistributedTargetError(message: "Not implemented")
119141
}
120142

@@ -167,7 +189,7 @@ func test() async {
167189
// NOTE: All allocated distributed actors should be saved in this array, so
168190
// that they will be deallocated together at the end of this test!
169191
// This convention helps ensure that the test is not flaky.
170-
var test: [DistributedActor?] = []
192+
var test: [(any DistributedActor)?] = []
171193

172194
test.append(LocalWorker(system: system))
173195
// CHECK: assign type:LocalWorker, id:ActorAddress(address: "[[ID1:.*]]")

0 commit comments

Comments
 (0)