git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit b17f430cb428dc0322dc3915948f9c7802107eda

fix ports

wanderer committed on 8/8/2017, 11:18:14 PM
Parent: 4d0111a3323bd33403464ccb1760f2df9aaa623e

Files changed

tests/index.jschanged
tests/index.jsView
@@ -13,9 +13,9 @@
1313 onCreation (message) {
1414 this.kernel.state.code = message.data.byteLength ? message.data : undefined
1515 const port = message.ports[0]
1616 if (port) {
17- this.kernel.ports.bind('root', port)
17 + return this.kernel.ports.bind('root', port)
1818 }
1919 }
2020 static get typeId () {
2121 return 9
@@ -26,9 +26,9 @@
2626 tape('basic', async t => {
2727 t.plan(3)
2828 let message
2929 const expectedState = {
30- '/': 'zdpuAsvLUNKxnxpKxuipCJz7sH4kmHuu3gVEUEmJ1QuWnikht'
30 + '/': 'zdpuApGUFnjcY3eBeVPFfnEgGunPz8vyXVJbrkgBmYwrbVDpA'
3131 }
3232
3333 class testVMContainer extends BaseContainer {
3434 onMessage (m) {
@@ -49,17 +49,15 @@
4949 })
5050
5151 rootContainer.createInstance(testVMContainer.typeId, initMessage)
5252
53- rootContainer.ports.bind('first', portRef1)
53 + await rootContainer.ports.bind('first', portRef1)
5454 message = rootContainer.createMessage()
5555 rootContainer.send(portRef1, message)
5656
5757 const stateRoot = await hypervisor.createStateRoot(Infinity)
5858 t.deepEquals(stateRoot, expectedState, 'expected root!')
5959 t.equals(hypervisor.scheduler.oldest(), 0)
60- await hypervisor.graph.tree(stateRoot, Infinity, true)
61- console.log(JSON.stringify(stateRoot, null, 2))
6260 } catch (e) {
6361 console.log(e)
6462 }
6563 })
@@ -80,9 +78,9 @@
8078
8179 const root = await hypervisor.createInstance(testVMContainer.typeId)
8280 const [portRef1, portRef2] = root.ports.createChannel()
8381
84- root.ports.bind('one', portRef1)
82 + await root.ports.bind('one', portRef1)
8583 root.createInstance(testVMContainer.typeId, root.createMessage({
8684 ports: [portRef2]
8785 }))
8886
@@ -99,9 +97,9 @@
9997 tape('one child contract with saturated ports', async t => {
10098 t.plan(2)
10199 let message
102100 const expectedState = {
103- '/': 'zdpuAnfZ1fGUSzNwAovfArzcTfEVbXjVYABprgtjUKMtGb8k5'
101 + '/': 'zdpuArCqpDZtEqjrXrRhMiYLE7QQ1szVr1qLVkiwtDLincGWU'
104102 }
105103
106104 class testVMContainer2 extends BaseContainer {
107105 onMessage (m) {
@@ -117,11 +115,11 @@
117115 const [portRef1, portRef2] = this.kernel.ports.createChannel()
118116 this.kernel.createInstance(testVMContainer2.typeId, this.kernel.createMessage({
119117 ports: [portRef2]
120118 }))
121- this.kernel.ports.bind('child', portRef1)
122119 this.kernel.incrementTicks(2)
123120 this.kernel.send(portRef1, m)
121 + return this.kernel.ports.bind('child', portRef1)
124122 }
125123 }
126124
127125 const hypervisor = new Hypervisor(node.dag)
@@ -133,19 +131,19 @@
133131 root.createInstance(testVMContainer.typeId, root.createMessage({
134132 ports: [portRef2]
135133 }))
136134
137- root.ports.bind('first', portRef1)
135 + await root.ports.bind('first', portRef1)
138136 message = root.createMessage({
139137 data: 'test'
140138 })
141139
142140 root.send(portRef1, message)
143141 const stateRoot = await hypervisor.createStateRoot(Infinity)
144142
143 + t.deepEquals(stateRoot, expectedState, 'expected state')
145144 // await hypervisor.graph.tree(stateRoot, Infinity, true)
146145 // console.log(JSON.stringify(stateRoot, null, 2))
147- t.deepEquals(stateRoot, expectedState, 'expected state')
148146 })
149147
150148 tape('one child contract', async t => {
151149 t.plan(4)
@@ -177,11 +175,11 @@
177175 const [portRef1, portRef2] = this.kernel.ports.createChannel()
178176 this.kernel.createInstance(testVMContainer2.typeId, this.kernel.createMessage({
179177 ports: [portRef2]
180178 }))
181- this.kernel.ports.bind('child', portRef1)
182179 this.kernel.send(portRef1, m)
183180 this.kernel.incrementTicks(1)
181 + return this.kernel.ports.bind('child', portRef1)
184182 }
185183 }
186184
187185 const hypervisor = new Hypervisor(node.dag)
@@ -194,9 +192,9 @@
194192 root.createInstance(testVMContainer.typeId, root.createMessage({
195193 ports: [portRef2]
196194 }))
197195
198- root.ports.bind('first', portRef1)
196 + await root.ports.bind('first', portRef1)
199197 message = root.createMessage()
200198
201199 root.send(portRef1, message)
202200 const stateRoot = await hypervisor.createStateRoot(Infinity)
@@ -228,11 +226,13 @@
228226 const [portRef1, portRef2] = this.kernel.ports.createChannel()
229227 const [portRef3, portRef4] = this.kernel.ports.createChannel()
230228 const [portRef5, portRef6] = this.kernel.ports.createChannel()
231229
232- this.kernel.ports.bind('one', portRef1)
233- this.kernel.ports.bind('two', portRef3)
234- this.kernel.ports.bind('three', portRef5)
230 + await Promise.all(
231 + this.kernel.ports.bind('one', portRef1),
232 + this.kernel.ports.bind('two', portRef3),
233 + this.kernel.ports.bind('three', portRef5)
234 + )
235235
236236 const message1 = this.kernel.createMessage({
237237 ports: [portRef2]
238238 })
@@ -258,9 +258,9 @@
258258 await root.message(root.createMessage())
259259 const stateRoot = await hypervisor.createStateRoot()
260260
261261 t.deepEquals(stateRoot, {
262- '/': 'zdpuAtChoDT1Er7c9Ndv6ov4m46wibCNY1HKthoVLUn5n4Rg5'
262 + '/': 'zdpuAoifKuJkWz9Fjvt79NmGq3tcefhfCyq8iM8YhcFdV9bmZ'
263263 }, 'should revert the state')
264264 })
265265
266266 tape('message should arrive in the correct oder if sent in order', async t => {
@@ -274,11 +274,8 @@
274274
275275 const [portRef1, portRef2] = this.kernel.ports.createChannel()
276276 const [portRef3, portRef4] = this.kernel.ports.createChannel()
277277
278- this.kernel.ports.bind('two', portRef3)
279- this.kernel.ports.bind('one', portRef1)
280-
281278 const message1 = this.kernel.createMessage({
282279 ports: [portRef2]
283280 })
284281 const message2 = this.kernel.createMessage({
@@ -289,8 +286,12 @@
289286 this.kernel.createInstance(Second.typeId, message2)
290287
291288 this.kernel.send(portRef1, this.kernel.createMessage())
292289 this.kernel.send(portRef3, this.kernel.createMessage())
290 + return Promise.all(
291 + this.kernel.ports.bind('two', portRef3),
292 + this.kernel.ports.bind('one', portRef1)
293 + )
293294 } else if (runs === 1) {
294295 runs++
295296 t.equals(m.data, 'first', 'should recive the first message')
296297 } else if (runs === 2) {
@@ -337,9 +338,9 @@
337338 root.createInstance(Root.typeId, root.createMessage({
338339 ports: [portRef2]
339340 }))
340341
341- root.ports.bind('first', portRef1)
342 + await root.ports.bind('first', portRef1)
342343 const message = root.createMessage()
343344 root.send(portRef1, message)
344345 })
345346
@@ -354,11 +355,8 @@
354355
355356 const [portRef1, portRef2] = this.kernel.ports.createChannel()
356357 const [portRef3, portRef4] = this.kernel.ports.createChannel()
357358
358- this.kernel.ports.bind('one', portRef1)
359- this.kernel.ports.bind('two', portRef3)
360-
361359 const message1 = this.kernel.createMessage({
362360 ports: [portRef2]
363361 })
364362 const message2 = this.kernel.createMessage({
@@ -369,8 +367,13 @@
369367 this.kernel.createInstance(Second.typeId, message2)
370368
371369 this.kernel.send(portRef1, this.kernel.createMessage())
372370 this.kernel.send(portRef3, this.kernel.createMessage())
371 +
372 + return Promise.all([
373 + this.kernel.ports.bind('one', portRef1),
374 + this.kernel.ports.bind('two', portRef3)
375 + ])
373376 } else if (runs === 1) {
374377 runs++
375378 t.equals(m.data, 'second', 'should recived the second message')
376379 } else if (runs === 2) {
@@ -417,9 +420,9 @@
417420 root.createInstance(Root.typeId, root.createMessage({
418421 ports: [portRef2]
419422 }))
420423
421- root.ports.bind('first', portRef1)
424 + await root.ports.bind('first', portRef1)
422425 const message = root.createMessage()
423426 root.send(portRef1, message)
424427 })
425428
@@ -433,10 +436,8 @@
433436 runs++
434437 const [portRef1, portRef2] = this.kernel.ports.createChannel()
435438 const [portRef3, portRef4] = this.kernel.ports.createChannel()
436439
437- this.kernel.ports.bind('one', portRef1)
438- this.kernel.ports.bind('two', portRef3)
439440
440441 const message1 = this.kernel.createMessage({
441442 ports: [portRef2]
442443 })
@@ -450,8 +451,13 @@
450451 this.kernel.send(portRef1, this.kernel.createMessage())
451452 this.kernel.send(portRef3, this.kernel.createMessage())
452453
453454 this.kernel.incrementTicks(6)
455 +
456 + return Promise.all([
457 + this.kernel.ports.bind('one', portRef1),
458 + this.kernel.ports.bind('two', portRef3)
459 + ])
454460 } else if (runs === 1) {
455461 runs++
456462 t.equals(m.data, 'first', 'should recive the first message')
457463 } else if (runs === 2) {
@@ -495,9 +501,9 @@
495501 root.createInstance(Root.typeId, root.createMessage({
496502 ports: [portRef2]
497503 }))
498504
499- root.ports.bind('first', portRef1)
505 + await root.ports.bind('first', portRef1)
500506 const message = root.createMessage()
501507 root.send(portRef1, message)
502508 })
503509
@@ -511,11 +517,8 @@
511517 runs++
512518 const [portRef1, portRef2] = this.kernel.ports.createChannel()
513519 const [portRef3, portRef4] = this.kernel.ports.createChannel()
514520
515- this.kernel.ports.bind('one', portRef1)
516- this.kernel.ports.bind('two', portRef3)
517-
518521 const message1 = this.kernel.createMessage({
519522 ports: [portRef2]
520523 })
521524 const message2 = this.kernel.createMessage({
@@ -528,8 +531,12 @@
528531 this.kernel.send(portRef1, this.kernel.createMessage())
529532 this.kernel.send(portRef3, this.kernel.createMessage())
530533
531534 this.kernel.incrementTicks(6)
535 + return Promise.all([
536 + this.kernel.ports.bind('one', portRef1),
537 + this.kernel.ports.bind('two', portRef3)
538 + ])
532539 } else if (runs === 1) {
533540 runs++
534541 t.equals(m.data, 'first', 'should recive the first message')
535542 } else if (runs === 2) {
@@ -587,15 +594,15 @@
587594 const [portRef1, portRef2] = root.ports.createChannel()
588595
589596 const message = root.createMessage()
590597 root.send(portRef1, message)
591- root.ports.bind('first', portRef1)
598 + await root.ports.bind('first', portRef1)
592599 root.createInstance(Root.typeId, root.createMessage({
593600 ports: [portRef2]
594601 }))
595602
596603 const [portRef3, portRef4] = root.ports.createChannel()
597- root.ports.bind('sencond', portRef3)
604 + await root.ports.bind('sencond', portRef3)
598605 root.createInstance(Waiter.typeId, root.createMessage({
599606 ports: [portRef4]
600607 }))
601608
@@ -615,11 +622,8 @@
615622 runs++
616623 const [portRef1, portRef2] = this.kernel.ports.createChannel()
617624 const [portRef3, portRef4] = this.kernel.ports.createChannel()
618625
619- this.kernel.ports.bind('two', portRef3)
620- this.kernel.ports.bind('one', portRef1)
621-
622626 const message1 = this.kernel.createMessage({
623627 ports: [portRef2]
624628 })
625629 const message2 = this.kernel.createMessage({
@@ -632,8 +636,12 @@
632636 this.kernel.send(portRef1, this.kernel.createMessage())
633637 this.kernel.send(portRef3, this.kernel.createMessage())
634638
635639 this.kernel.incrementTicks(6)
640 + return Promise.all([
641 + this.kernel.ports.bind('two', portRef3),
642 + this.kernel.ports.bind('one', portRef1)
643 + ])
636644 } else if (runs === 1) {
637645 runs++
638646 t.equals(m.data, 'second', 'should recived the second message')
639647 } else if (runs === 2) {
@@ -679,9 +687,9 @@
679687 const [portRef1, portRef2] = root.ports.createChannel()
680688 const message = root.createMessage()
681689
682690 root.send(portRef1, message)
683- root.ports.bind('first', portRef1)
691 + await root.ports.bind('first', portRef1)
684692 root.createInstance(Root.typeId, root.createMessage({
685693 ports: [portRef2]
686694 }))
687695 })
@@ -691,16 +699,16 @@
691699
692700 let runs = 0
693701
694702 class Root extends BaseContainer {
695- onMessage (m) {
703 + async onMessage (m) {
696704 if (!runs) {
697705 runs++
698706 const [portRef1, portRef2] = this.kernel.ports.createChannel()
699707 const [portRef3, portRef4] = this.kernel.ports.createChannel()
700708
701- this.kernel.ports.bind('one', portRef1)
702- this.kernel.ports.bind('two', portRef3)
709 + await this.kernel.ports.bind('one', portRef1)
710 + await this.kernel.ports.bind('two', portRef3)
703711
704712 const message1 = this.kernel.createMessage({
705713 ports: [portRef2]
706714 })
@@ -758,9 +766,9 @@
758766 const [portRef1, portRef2] = root.ports.createChannel()
759767 const message = root.createMessage()
760768
761769 root.send(portRef1, message)
762- root.ports.bind('first', portRef1)
770 + await root.ports.bind('first', portRef1)
763771 root.createInstance(Root.typeId, root.createMessage({
764772 ports: [portRef2]
765773 }))
766774 })
@@ -775,13 +783,13 @@
775783 onMessage (m) {
776784 let one = this.kernel.ports.get('one')
777785 if (!one) {
778786 const [portRef1, portRef2] = this.kernel.ports.createChannel()
779- this.kernel.ports.bind('one', portRef1)
780787 const message1 = this.kernel.createMessage({
781788 ports: [portRef2]
782789 })
783790 this.kernel.createInstance(First.typeId, message1)
791 + return this.kernel.ports.bind('one', portRef1)
784792 } else {
785793 this.kernel.send(one, this.kernel.createMessage())
786794 this.kernel.send(one, this.kernel.createMessage())
787795 }
@@ -808,9 +816,9 @@
808816 hypervisor.registerContainer(First)
809817
810818 const root = await hypervisor.createInstance(Root.typeId)
811819 const [portRef1, portRef2] = root.ports.createChannel()
812- root.ports.bind('first', portRef1)
820 + await root.ports.bind('first', portRef1)
813821 root.createInstance(Root.typeId, root.createMessage({
814822 ports: [portRef2]
815823 }))
816824
@@ -832,9 +840,9 @@
832840 const [portRef1, portRef2] = root.ports.createChannel()
833841 root.createInstance(BaseContainer.typeId, root.createMessage({
834842 ports: [portRef2]
835843 }))
836- root.ports.bind('test', portRef1)
844 + await root.ports.bind('test', portRef1)
837845
838846 try {
839847 root.createMessage({
840848 ports: [portRef1]
@@ -869,16 +877,16 @@
869877 }
870878 class Root extends BaseContainer {
871879 onMessage (m) {
872880 const [portRef1, portRef2] = this.kernel.ports.createChannel()
873- this.kernel.ports.bind('one', portRef1)
874881 const message1 = this.kernel.createMessage({
875882 ports: [portRef2]
876883 })
877884
878885 this.kernel.createInstance(First.typeId, message1)
879886 this.kernel.send(portRef1, this.kernel.createMessage())
880887 this.kernel.incrementTicks(6)
888 + return this.kernel.ports.bind('one', portRef1)
881889 }
882890 }
883891
884892 class First extends BaseContainer {
@@ -897,9 +905,9 @@
897905 hypervisor.registerContainer(First)
898906
899907 const root = await hypervisor.createInstance(Root.typeId)
900908 const [portRef1, portRef2] = root.ports.createChannel()
901- root.ports.bind('first', portRef1)
909 + await root.ports.bind('first', portRef1)
902910 root.createInstance(Root.typeId, root.createMessage({
903911 ports: [portRef2]
904912 }))
905913
@@ -914,9 +922,9 @@
914922 })
915923
916924 tape('clear unbounded ports', async t => {
917925 const expectedSr = {
918- '/': 'zdpuAxVzUQRWaAeFWXq5TgDpZqPaNgNp1ZuEfxbxg7h4qnXmC'
926 + '/': 'zdpuAopMy53q2uvL2a4fhVEAvwXjSDW28fh8zhQUj598tb5md'
919927 }
920928 class Root extends BaseContainer {
921929 onMessage (m) {
922930 this.kernel.createInstance(Root.typeId)
@@ -928,9 +936,9 @@
928936 hypervisor.registerContainer(Root)
929937
930938 const root = await hypervisor.createInstance(Root.typeId)
931939 const [portRef1, portRef2] = root.ports.createChannel()
932- root.ports.bind('first', portRef1)
940 + await root.ports.bind('first', portRef1)
933941 root.createInstance(Root.typeId, root.createMessage({
934942 ports: [portRef2]
935943 }))
936944
@@ -955,13 +963,13 @@
955963 }
956964 }
957965
958966 class Sub extends BaseContainer {
959- onInitailize (message) {
960- this.kernel.ports.bind('root', message.ports[0])
961- const [portRef1, portRef2] = root.ports.createChannel()
962- root.ports.bind('child', portRef1)
963- root.createInstance(Root.typeId, root.createMessage({
967 + async onInitailize (message) {
968 + await this.kernel.ports.bind('root', message.ports[0])
969 + const [portRef1, portRef2] = this.kernel.ports.createChannel()
970 + await this.kernel.ports.bind('child', portRef1)
971 + this.kernel.createInstance(Root.typeId, this.kernel.createMessage({
964972 ports: [portRef2]
965973 }))
966974 }
967975 static get typeId () {
@@ -975,9 +983,9 @@
975983 hypervisor.registerContainer(Sub)
976984
977985 const root = await hypervisor.createInstance(Root.typeId)
978986 const [portRef1, portRef2] = root.ports.createChannel()
979- root.ports.bind('first', portRef1)
987 + await root.ports.bind('first', portRef1)
980988 root.createInstance(Root.typeId, root.createMessage({
981989 ports: [portRef2]
982990 }))
983991
@@ -992,25 +1000,25 @@
9921000 const expectedSr = {
9931001 '/': 'zdpuApKrsvsWknDML2Mme9FyZfRnVZ1hTCoKzkooYAWT3dUDV'
9941002 }
9951003 class Root extends BaseContainer {
996- onMessage (m) {
1004 + async onMessage (m) {
9971005 if (m.ports.length) {
9981006 const port = this.kernel.ports.get('test1')
9991007 this.kernel.send(port, m)
1000- this.kernel.ports.unbind('test1')
1008 + return this.kernel.ports.unbind('test1')
10011009 } else {
10021010 const [portRef1, portRef2] = this.kernel.ports.createChannel()
10031011 this.kernel.createInstance(Sub.typeId, this.kernel.createMessage({
10041012 ports: [portRef2]
10051013 }))
1006- this.kernel.ports.bind('test1', portRef1)
1014 + await this.kernel.ports.bind('test1', portRef1)
10071015
10081016 const [portRef3, portRef4] = this.kernel.ports.createChannel()
10091017 this.kernel.createInstance(Sub.typeId, this.kernel.createMessage({
10101018 ports: [portRef4]
10111019 }))
1012- this.kernel.ports.bind('test2', portRef3)
1020 + await this.kernel.ports.bind('test2', portRef3)
10131021 this.kernel.send(portRef3, this.kernel.createMessage({
10141022 data: 'getChannel'
10151023 }))
10161024 }
@@ -1020,15 +1028,15 @@
10201028 class Sub extends BaseContainer {
10211029 onMessage (message) {
10221030 if (message.data === 'getChannel') {
10231031 const ports = this.kernel.ports.createChannel()
1024- this.kernel.ports.bind('channel', ports[0])
10251032 this.kernel.send(message.fromPort, this.kernel.createMessage({
10261033 data: 'bindPort',
10271034 ports: [ports[1]]
10281035 }))
1036 + return this.kernel.ports.bind('channel', ports[0])
10291037 } else if (message.data === 'bindPort') {
1030- this.kernel.ports.bind('channel', message.ports[0])
1038 + return this.kernel.ports.bind('channel', message.ports[0])
10311039 }
10321040 }
10331041 static get typeId () {
10341042 return 299
@@ -1041,9 +1049,9 @@
10411049 hypervisor.registerContainer(Sub)
10421050
10431051 const root = await hypervisor.createInstance(Root.typeId)
10441052 const [portRef1, portRef2] = root.ports.createChannel()
1045- root.ports.bind('first', portRef1)
1053 + await root.ports.bind('first', portRef1)
10461054 root.createInstance(Root.typeId, root.createMessage({
10471055 ports: [portRef2]
10481056 }))
10491057
@@ -1056,29 +1064,29 @@
10561064 })
10571065
10581066 tape('should remove multiple subgraphs', async t => {
10591067 const expectedSr = {
1060- '/': 'zdpuAo1qZHhS6obxbGbtvnUxkbAxA6VSbcjYiiTVNWTm37xQv'
1068 + '/': 'zdpuAohccQTxM82d8N6Q82z234nQskeQoJGJu3eAVmxoQwWde'
10611069 }
10621070 class Root extends BaseContainer {
1063- onMessage (m) {
1071 + async onMessage (m) {
10641072 if (m.ports.length) {
10651073 const port = this.kernel.ports.get('test1')
10661074 this.kernel.send(port, m)
1067- this.kernel.ports.unbind('test1')
1068- this.kernel.ports.unbind('test2')
1075 + await this.kernel.ports.unbind('test1')
1076 + await this.kernel.ports.unbind('test2')
10691077 } else {
10701078 const [portRef1, portRef2] = this.kernel.ports.createChannel()
10711079 this.kernel.createInstance(Sub.typeId, this.kernel.createMessage({
10721080 ports: [portRef2]
10731081 }))
1074- this.kernel.ports.bind('test1', portRef1)
1082 + await this.kernel.ports.bind('test1', portRef1)
10751083
10761084 const [portRef3, portRef4] = this.kernel.ports.createChannel()
10771085 this.kernel.createInstance(Sub.typeId, this.kernel.createMessage({
10781086 ports: [portRef4]
10791087 }))
1080- this.kernel.ports.bind('test2', portRef3)
1088 + await this.kernel.ports.bind('test2', portRef3)
10811089 this.kernel.send(portRef3, this.kernel.createMessage({
10821090 data: 'getChannel'
10831091 }))
10841092 }
@@ -1088,15 +1096,15 @@
10881096 class Sub extends BaseContainer {
10891097 onMessage (message) {
10901098 if (message.data === 'getChannel') {
10911099 const ports = this.kernel.ports.createChannel()
1092- this.kernel.ports.bind('channel', ports[0])
10931100 this.kernel.send(message.fromPort, this.kernel.createMessage({
10941101 data: 'bindPort',
10951102 ports: [ports[1]]
10961103 }))
1104 + return this.kernel.ports.bind('channel', ports[0])
10971105 } else if (message.data === 'bindPort') {
1098- this.kernel.ports.bind('channel', message.ports[0])
1106 + return this.kernel.ports.bind('channel', message.ports[0])
10991107 }
11001108 }
11011109 static get typeId () {
11021110 return 299
@@ -1110,9 +1118,9 @@
11101118
11111119 const root = await hypervisor.createInstance(Root.typeId)
11121120
11131121 const [portRef1, portRef2] = root.ports.createChannel()
1114- root.ports.bind('first', portRef1)
1122 + await root.ports.bind('first', portRef1)
11151123 root.createInstance(Root.typeId, root.createMessage({
11161124 ports: [portRef2]
11171125 }))
11181126
@@ -1152,17 +1160,17 @@
11521160 })
11531161
11541162 rootContainer.createInstance(testVMContainer.typeId, initMessage)
11551163
1156- rootContainer.ports.bind('first', portRef1)
1164 + await rootContainer.ports.bind('first', portRef1)
11571165 const message = rootContainer.createMessage()
11581166 const rPort = rootContainer.getResponsePort(message)
11591167 const rPort2 = rootContainer.getResponsePort(message)
11601168
11611169 t.equals(rPort2, rPort)
11621170
11631171 rootContainer.send(portRef1, message)
1164- rootContainer.ports.bind('response', rPort)
1172 + await rootContainer.ports.bind('response', rPort)
11651173 })
11661174
11671175 tape('start up', async t => {
11681176 t.plan(1)

Built with git-ssb-web