@@ -221,6 +221,91 @@ describe("wrangler deploy with containers", () => {
221221 ` ) ;
222222 } ) ;
223223
224+ it ( "should be able to deploy a new container with custom instance limits" , async ( ) => {
225+ // note no docker commands have been mocked here!
226+ mockGetVersion ( "Galaxy-Class" ) ;
227+ writeWranglerConfig ( {
228+ ...DEFAULT_DURABLE_OBJECTS ,
229+ containers : [
230+ {
231+ ...DEFAULT_CONTAINER_FROM_REGISTRY ,
232+ configuration : {
233+ vcpu : 1 ,
234+ memory_mib : 1000 ,
235+ disk : { size_mb : 2000 } ,
236+ } ,
237+ } ,
238+ ] ,
239+ } ) ;
240+
241+ mockGetApplications ( [ ] ) ;
242+
243+ mockCreateApplication ( {
244+ name : "my-container" ,
245+ max_instances : 10 ,
246+ scheduling_policy : SchedulingPolicy . DEFAULT ,
247+ configuration : {
248+ image : "docker.io/hello:world" ,
249+ disk : {
250+ size_mb : 2000 ,
251+ } ,
252+ vcpu : 1 ,
253+ memory_mib : 1000 ,
254+ } ,
255+ } ) ;
256+
257+ await runWrangler ( "deploy index.js" ) ;
258+
259+ expect ( std . out ) . toMatchInlineSnapshot ( `
260+ "Total Upload: xx KiB / gzip: xx KiB
261+ Worker Startup Time: 100 ms
262+ Your Worker has access to the following bindings:
263+ Binding Resource
264+ env.EXAMPLE_DO_BINDING (ExampleDurableObject) Durable Object
265+
266+ Uploaded test-name (TIMINGS)
267+ Deployed test-name triggers (TIMINGS)
268+ https://test-name.test-sub-domain.workers.dev
269+ Current Version ID: Galaxy-Class"
270+ ` ) ;
271+ expect ( std . err ) . toMatchInlineSnapshot ( `""` ) ;
272+
273+ expect ( cliStd . stdout ) . toMatchInlineSnapshot ( `
274+ "╭ Deploy a container application deploy changes to your application
275+ │
276+ │ Container application changes
277+ │
278+ ├ NEW my-container
279+ │
280+ │ [[containers]]
281+ │ name = \\"my-container\\"
282+ │ scheduling_policy = \\"default\\"
283+ │ instances = 0
284+ │ max_instances = 10
285+ │
286+ │ [containers.configuration]
287+ │ image = \\"docker.io/hello:world\\"
288+ │ memory_mib = 1_000
289+ │ vcpu = 1
290+ │
291+ │ [containers.configuration.disk]
292+ │ size_mb = 2_000
293+ │
294+ │ [containers.constraints]
295+ │ tier = 1
296+ │
297+ │ [containers.durable_objects]
298+ │ namespace_id = \\"1\\"
299+ │
300+ │
301+ │ SUCCESS Created application my-container (Application ID: undefined)
302+ │
303+ ╰ Applied changes
304+
305+ "
306+ ` ) ;
307+ } ) ;
308+
224309 it ( "should resolve the docker build context path based on the dockerfile location, if image_build_context is not provided" , async ( ) => {
225310 vi . stubEnv ( "WRANGLER_DOCKER_BIN" , "/usr/bin/docker" ) ;
226311 mockGetVersion ( "Galaxy-Class" ) ;
@@ -1364,8 +1449,6 @@ function mockModifyApplication(expected?: Partial<Application>) {
13641449 http . patch ( "*/applications/:id" , async ( { request } ) => {
13651450 const json = await request . json ( ) ;
13661451 if ( expected !== undefined ) {
1367- // console.dir("expected" + JSON.stringify(expected, null, 2));
1368- // console.dir("json" + JSON.stringify(json, null, 2));
13691452 expect ( json ) . toMatchObject ( expected ) ;
13701453 }
13711454 expect ( ( json as CreateApplicationRequest ) . name ) . toBeUndefined ( ) ;
@@ -1386,8 +1469,6 @@ function mockCreateApplicationRollout(expected?: Record<string, unknown>) {
13861469 http . post ( "*/applications/:id/rollouts" , async ( { request } ) => {
13871470 const json = await request . json ( ) ;
13881471 if ( expected !== undefined ) {
1389- // console.dir("expected" + JSON.stringify(expected, null, 2));
1390- // console.dir("json" + JSON.stringify(json, null, 2));
13911472 expect ( json ) . toMatchObject ( expected ) ;
13921473 }
13931474 return HttpResponse . json ( {
0 commit comments