@@ -65,26 +65,26 @@ Meta.test(
65
65
const port = metaTest . port ;
66
66
const gate = `http://localhost:${ port } ` ;
67
67
68
- await metaTest . should ( "work after deploying artifact to S3" , async ( ) => {
69
- const s3 = new S3Client ( syncConfig . s3 ) ;
70
- assertEquals ( ( await listObjects ( s3 , syncConfig . s3Bucket ) ) ?. length , 0 ) ;
71
-
72
- const { serialized, typegate : gateResponseAdd } = await tgDeploy ( tg , {
73
- baseUrl : gate ,
74
- auth,
75
- artifactsConfig : {
76
- prismaMigration : {
77
- globalAction : {
78
- create : true ,
79
- reset : false ,
80
- } ,
81
- migrationDir : "prisma-migrations" ,
68
+ const { serialized, typegate : gateResponseAdd } = await tgDeploy ( tg , {
69
+ baseUrl : gate ,
70
+ auth,
71
+ artifactsConfig : {
72
+ prismaMigration : {
73
+ globalAction : {
74
+ create : true ,
75
+ reset : false ,
82
76
} ,
83
- dir : cwd ,
77
+ migrationDir : "prisma-migrations" ,
84
78
} ,
85
- typegraphPath : path . join ( cwd , "wasmedge.ts" ) ,
86
- secrets : { } ,
87
- } ) ;
79
+ dir : cwd ,
80
+ } ,
81
+ typegraphPath : path . join ( cwd , "wasmedge.ts" ) ,
82
+ secrets : { } ,
83
+ } ) ;
84
+
85
+ await metaTest . should ( "work after deploying artifact to S3" , async ( ) => {
86
+ const s3 = new S3Client ( syncConfig . s3 ) ;
87
+ assertEquals ( ( await listObjects ( s3 , syncConfig . s3Bucket ) ) ?. length , 2 ) ;
88
88
89
89
assertExists ( serialized , "serialized has a value" ) ;
90
90
assertEquals ( gateResponseAdd , {
@@ -109,6 +109,41 @@ Meta.test(
109
109
} )
110
110
. on ( engine ) ;
111
111
112
+ await engine . terminate ( ) ;
113
+ s3 . destroy ( ) ;
114
+ } ) ;
115
+
116
+ await metaTest . should ( "work with multiple typegate instances" , async ( ) => {
117
+ const s3 = new S3Client ( syncConfig . s3 ) ;
118
+
119
+ // typegraphs are pushed to s3 whenever pushed to a typegate
120
+ assertEquals ( ( await listObjects ( s3 , syncConfig . s3Bucket ) ) ?. length , 3 ) ;
121
+
122
+ const engine = await metaTest . engineFromDeployed ( serialized ) ;
123
+
124
+ await gql `
125
+ query {
126
+ test_wasi_ts(a: 11, b: 12)
127
+ }
128
+ `
129
+ . expectData ( {
130
+ test_wasi_ts : 23 ,
131
+ } )
132
+ . on ( engine ) ;
133
+
134
+ // second engine on the other typegate instance
135
+ const engine2 = await metaTest . engineFromDeployed ( serialized ) ;
136
+
137
+ await gql `
138
+ query {
139
+ test_wasi_ts(a: 15, b: 2)
140
+ }
141
+ `
142
+ . expectData ( {
143
+ test_wasi_ts : 17 ,
144
+ } )
145
+ . on ( engine2 ) ;
146
+
112
147
const { typegate : gateResponseRem } = await tgRemove ( tg , {
113
148
baseUrl : gate ,
114
149
auth,
@@ -117,63 +152,8 @@ Meta.test(
117
152
assertEquals ( gateResponseRem , { data : { removeTypegraphs : true } } ) ;
118
153
119
154
await engine . terminate ( ) ;
155
+ await engine2 . terminate ( ) ;
120
156
s3 . destroy ( ) ;
121
157
} ) ;
122
158
} ,
123
159
) ;
124
-
125
- // Meta.test(
126
- // {
127
- // name: "WasmEdge Runtime typescript SDK: Multiple typegate instances",
128
- // syncConfig,
129
- // async setup() {
130
- // await cleanUp();
131
- // },
132
- // async teardown() {
133
- // await cleanUp();
134
- // },
135
- // port: true,
136
- // multipleTypegates: 3,
137
- // },
138
- // async (metaTest) => {
139
- // const port = metaTest.port;
140
- // const gate = `http://localhost:${port}`;
141
- // await metaTest.should("work with multiple typegate instances", async () => {
142
- // const s3 = new S3Client(syncConfig.s3);
143
- // assertEquals((await listObjects(s3, syncConfig.s3Bucket))?.length, 0);
144
-
145
- // const { serialized, typegate: _gateResponseAdd } = await tgDeploy(tg, {
146
- // baseUrl: gate,
147
- // auth,
148
- // artifactsConfig: {
149
- // prismaMigration: {
150
- // globalAction: {
151
- // create: true,
152
- // reset: false,
153
- // },
154
- // migrationDir: "prisma-migrations",
155
- // },
156
- // dir: cwd,
157
- // },
158
- // typegraphPath: path.join(cwd, "wasmedge.ts"),
159
- // secrets: {},
160
- // });
161
-
162
- // assertEquals((await listObjects(s3, syncConfig.s3Bucket))?.length, 1);
163
-
164
- // const engine = await metaTest.engineFromDeployed(serialized);
165
-
166
- // await gql`
167
- // query {
168
- // test_wasi_ts(a: 11, b: 2)
169
- // }
170
- // `
171
- // .expectData({
172
- // test_wasi_ts: 13,
173
- // })
174
- // .on(engine);
175
- // await engine.terminate();
176
- // s3.destroy();
177
- // });
178
- // },
179
- // );
0 commit comments