tests/index.jsView |
---|
44 | 44 | type: testVMContainer.typeId |
45 | 45 | } |
46 | 46 | })) |
47 | 47 | |
| 48 | + hypervisor.pin(rootContainer) |
| 49 | + |
48 | 50 | const [portRef1, portRef2] = rootContainer.ports.createChannel() |
49 | 51 | const initMessage = rootContainer.createMessage({ |
50 | 52 | data: { |
51 | 53 | code: Buffer.from('test code'), |
88 | 90 | data: { |
89 | 91 | type: testVMContainer.typeId |
90 | 92 | } |
91 | 93 | })) |
| 94 | + |
| 95 | + hypervisor.pin(root) |
92 | 96 | const [portRef1, portRef2] = root.ports.createChannel() |
93 | 97 | |
94 | 98 | await root.ports.bind('one', portRef1) |
95 | 99 | await root.createInstance(root.createMessage({ |
157 | 161 | data: { |
158 | 162 | type: testVMContainer.typeId |
159 | 163 | } |
160 | 164 | })) |
| 165 | + |
| 166 | + hypervisor.pin(root) |
| 167 | + |
161 | 168 | const rootId = root.id |
162 | 169 | const [portRef1, portRef2] = root.ports.createChannel() |
163 | 170 | await root.createInstance(root.createMessage({ |
164 | 171 | data: { |
243 | 250 | data: { |
244 | 251 | type: Root.typeId |
245 | 252 | } |
246 | 253 | })) |
| 254 | + |
| 255 | + hypervisor.pin(root) |
| 256 | + |
247 | 257 | await root.message(root.createMessage()) |
248 | 258 | const stateRoot = await hypervisor.createStateRoot() |
249 | 259 | |
250 | 260 | t.deepEquals(stateRoot, { |
335 | 345 | data: { |
336 | 346 | type: Root.typeId |
337 | 347 | } |
338 | 348 | })) |
| 349 | + |
| 350 | + hypervisor.pin(root) |
339 | 351 | const [portRef1, portRef2] = root.ports.createChannel() |
340 | 352 | |
341 | 353 | const message = root.createMessage() |
342 | 354 | await Promise.all([ |
452 | 464 | data: { |
453 | 465 | type: Root.typeId |
454 | 466 | } |
455 | 467 | })) |
| 468 | + |
| 469 | + hypervisor.pin(root) |
| 470 | + |
456 | 471 | const [portRef1, portRef2] = root.ports.createChannel() |
457 | 472 | const [portRef3, portRef4] = root.ports.createChannel() |
458 | 473 | |
459 | 474 | const message = root.createMessage() |
538 | 553 | data: { |
539 | 554 | type: Root.typeId |
540 | 555 | } |
541 | 556 | })) |
| 557 | + |
| 558 | + hypervisor.pin(root) |
| 559 | + |
542 | 560 | const [portRef1, portRef2] = root.ports.createChannel() |
543 | 561 | await Promise.all([ |
544 | 562 | root.ports.bind('first', portRef1), |
545 | 563 | root.createInstance(root.createMessage({ |
571 | 589 | type: BaseContainer.typeId |
572 | 590 | } |
573 | 591 | })) |
574 | 592 | |
| 593 | + hypervisor.pin(root) |
| 594 | + |
575 | 595 | const [portRef1, portRef2] = root.ports.createChannel() |
576 | 596 | root.createInstance(root.createMessage({ |
577 | 597 | data: { |
578 | 598 | type: BaseContainer.typeId |
649 | 669 | data: { |
650 | 670 | type: Root.typeId |
651 | 671 | } |
652 | 672 | })) |
| 673 | + |
| 674 | + hypervisor.pin(root) |
| 675 | + |
653 | 676 | const [portRef1, portRef2] = root.ports.createChannel() |
654 | 677 | await root.ports.bind('first', portRef1) |
655 | 678 | await root.createInstance(root.createMessage({ |
656 | 679 | data: { |
691 | 714 | data: { |
692 | 715 | type: Root.typeId |
693 | 716 | } |
694 | 717 | })) |
| 718 | + |
| 719 | + hypervisor.pin(root) |
| 720 | + |
695 | 721 | const [portRef1, portRef2] = root.ports.createChannel() |
696 | 722 | await root.ports.bind('first', portRef1) |
697 | 723 | await root.createInstance(root.createMessage({ |
698 | 724 | data: { |
752 | 778 | data: { |
753 | 779 | type: Root.typeId |
754 | 780 | } |
755 | 781 | })) |
| 782 | + |
| 783 | + hypervisor.pin(root) |
| 784 | + |
756 | 785 | const [portRef1, portRef2] = root.ports.createChannel() |
757 | 786 | await root.ports.bind('first', portRef1) |
758 | 787 | await root.createInstance(root.createMessage({ |
759 | 788 | data: { |
834 | 863 | data: { |
835 | 864 | type: Root.typeId |
836 | 865 | } |
837 | 866 | })) |
| 867 | + |
| 868 | + hypervisor.pin(root) |
| 869 | + |
838 | 870 | const [portRef1, portRef2] = root.ports.createChannel() |
839 | 871 | await root.ports.bind('first', portRef1) |
840 | 872 | await root.createInstance(root.createMessage({ |
841 | 873 | data: { |
920 | 952 | type: Root.typeId |
921 | 953 | } |
922 | 954 | })) |
923 | 955 | |
| 956 | + hypervisor.pin(root) |
| 957 | + |
924 | 958 | const [portRef1, portRef2] = root.ports.createChannel() |
925 | 959 | await Promise.all([ |
926 | 960 | root.ports.bind('first', portRef1), |
927 | 961 | root.createInstance(root.createMessage({ |
958 | 992 | } |
959 | 993 | } |
960 | 994 | |
961 | 995 | const hypervisor = new Hypervisor(node.dag) |
962 | | - |
963 | 996 | hypervisor.registerContainer(testVMContainer) |
964 | 997 | |
965 | 998 | const rootContainer = await hypervisor.createInstance(new Message({ |
966 | 999 | data: { |
967 | 1000 | type: testVMContainer.typeId |
968 | 1001 | } |
969 | 1002 | })) |
970 | 1003 | |
| 1004 | + hypervisor.pin(rootContainer) |
| 1005 | + |
971 | 1006 | const [portRef1, portRef2] = rootContainer.ports.createChannel() |
972 | 1007 | const initMessage = rootContainer.createMessage({ |
973 | 1008 | data: { |
974 | 1009 | type: testVMContainer.typeId |
1063 | 1098 | hypervisor.registerContainer(TestVMContainer2) |
1064 | 1099 | |
1065 | 1100 | const port = hypervisor.creationService.getPort() |
1066 | 1101 | |
1067 | | - await hypervisor.createInstance(new Message({ |
| 1102 | + const root = await hypervisor.createInstance(new Message({ |
1068 | 1103 | data: { |
1069 | 1104 | type: TestVMContainer.typeId |
1070 | 1105 | }, |
1071 | 1106 | ports: [port] |
1072 | 1107 | })) |
1073 | 1108 | |
| 1109 | + hypervisor.pin(root) |
| 1110 | + |
1074 | 1111 | const stateRoot = await hypervisor.createStateRoot() |
1075 | 1112 | |
1076 | 1113 | const expectedSR = { |
1077 | 1114 | '/': 'zdpuAonuhk7ZhdghJh4saaUCskY5mXZ6M9BcV9iAhCanAQx9i' |