@@ -62,7 +62,7 @@ describe("buildAndMaybePush", () => {
62
62
buildCmd : [
63
63
"build" ,
64
64
"-t" ,
65
- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
65
+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
66
66
"--platform" ,
67
67
"linux/amd64" ,
68
68
"--provenance=false" ,
@@ -73,7 +73,7 @@ describe("buildAndMaybePush", () => {
73
73
dockerfile,
74
74
} ) ;
75
75
expect ( dockerImageInspect ) . toHaveBeenCalledWith ( "/custom/docker/path" , {
76
- imageTag : `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
76
+ imageTag : `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
77
77
formatString :
78
78
"{{ .Size }} {{ len .RootFS.Layers }} {{json .RepoDigests}}" ,
79
79
} ) ;
@@ -94,7 +94,7 @@ describe("buildAndMaybePush", () => {
94
94
buildCmd : [
95
95
"build" ,
96
96
"-t" ,
97
- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
97
+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
98
98
"--platform" ,
99
99
"linux/amd64" ,
100
100
"--provenance=false" ,
@@ -104,14 +104,26 @@ describe("buildAndMaybePush", () => {
104
104
] ,
105
105
dockerfile,
106
106
} ) ;
107
- expect ( runDockerCmd ) . toHaveBeenCalledTimes ( 1 ) ;
108
- expect ( runDockerCmd ) . toHaveBeenCalledWith ( "docker" , [
107
+
108
+ // 3 calls: docker tag + docker push + docker rm
109
+ expect ( runDockerCmd ) . toHaveBeenCalledTimes ( 3 ) ;
110
+ expect ( runDockerCmd ) . toHaveBeenNthCalledWith ( 1 , "docker" , [
111
+ "tag" ,
112
+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
113
+ `${ getCloudflareContainerRegistry ( ) } /some-account-id/test-app:tag` ,
114
+ ] ) ;
115
+ expect ( runDockerCmd ) . toHaveBeenNthCalledWith ( 2 , "docker" , [
109
116
"push" ,
110
117
`${ getCloudflareContainerRegistry ( ) } /some-account-id/test-app:tag` ,
111
118
] ) ;
119
+ expect ( runDockerCmd ) . toHaveBeenNthCalledWith ( 3 , "docker" , [
120
+ "image" ,
121
+ "rm" ,
122
+ `${ getCloudflareContainerRegistry ( ) } /some-account-id/test-app:tag` ,
123
+ ] ) ;
112
124
expect ( dockerImageInspect ) . toHaveBeenCalledOnce ( ) ;
113
125
expect ( dockerImageInspect ) . toHaveBeenCalledWith ( "docker" , {
114
- imageTag : `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
126
+ imageTag : `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
115
127
formatString :
116
128
"{{ .Size }} {{ len .RootFS.Layers }} {{json .RepoDigests}}" ,
117
129
} ) ;
@@ -121,7 +133,7 @@ describe("buildAndMaybePush", () => {
121
133
it ( "should be able to build image and not push if it already exists in remote" , async ( ) => {
122
134
vi . mocked ( runDockerCmd ) . mockResolvedValueOnce ( ) ;
123
135
vi . mocked ( dockerImageInspect ) . mockResolvedValue (
124
- '53387881 2 ["registry.cloudflare.com/some-account-id/ test-app@sha256:three"]'
136
+ '53387881 2 ["registry.cloudflare.com/test-app@sha256:three"]'
125
137
) ;
126
138
await runWrangler (
127
139
"containers build ./container-context -t test-app:tag -p"
@@ -130,7 +142,7 @@ describe("buildAndMaybePush", () => {
130
142
buildCmd : [
131
143
"build" ,
132
144
"-t" ,
133
- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
145
+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
134
146
"--platform" ,
135
147
"linux/amd64" ,
136
148
"--provenance=false" ,
@@ -154,11 +166,11 @@ describe("buildAndMaybePush", () => {
154
166
expect ( runDockerCmd ) . toHaveBeenNthCalledWith ( 2 , "docker" , [
155
167
"image" ,
156
168
"rm" ,
157
- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
169
+ `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
158
170
] ) ;
159
171
expect ( dockerImageInspect ) . toHaveBeenCalledOnce ( ) ;
160
172
expect ( dockerImageInspect ) . toHaveBeenCalledWith ( "docker" , {
161
- imageTag : `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app:tag` ,
173
+ imageTag : `${ getCloudflareContainerRegistry ( ) } /test-app:tag` ,
162
174
formatString :
163
175
"{{ .Size }} {{ len .RootFS.Layers }} {{json .RepoDigests}}" ,
164
176
} ) ;
@@ -172,7 +184,7 @@ describe("buildAndMaybePush", () => {
172
184
buildCmd : [
173
185
"build" ,
174
186
"-t" ,
175
- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app` ,
187
+ `${ getCloudflareContainerRegistry ( ) } /test-app` ,
176
188
"--platform" ,
177
189
"linux/amd64" ,
178
190
"--provenance=false" ,
@@ -194,7 +206,7 @@ describe("buildAndMaybePush", () => {
194
206
buildCmd : [
195
207
"build" ,
196
208
"-t" ,
197
- `${ getCloudflareContainerRegistry ( ) } /some-account-id/ test-app` ,
209
+ `${ getCloudflareContainerRegistry ( ) } /test-app` ,
198
210
"--platform" ,
199
211
"linux/amd64" ,
200
212
"--provenance=false" ,
@@ -270,27 +282,24 @@ describe("buildAndMaybePush", () => {
270
282
} ) ;
271
283
272
284
describe ( "resolveAppDiskSize" , ( ) => {
273
- const accountBase = {
274
- limits : { disk_mb_per_deployment : 2000 } ,
275
- } as CompleteAccountCustomer ;
276
285
it ( "should return parsed app disk size" , ( ) => {
277
- const result = resolveAppDiskSize ( accountBase , {
286
+ const result = resolveAppDiskSize ( {
278
287
...defaultConfiguration ,
279
288
configuration : { image : "" , disk : { size : "500MB" } } ,
280
289
} ) ;
281
290
expect ( result ) . toBeCloseTo ( 500 * 1000 * 1000 , - 5 ) ;
282
291
} ) ;
283
292
284
293
it ( "should return default size when disk size not set" , ( ) => {
285
- const result = resolveAppDiskSize ( accountBase , {
294
+ const result = resolveAppDiskSize ( {
286
295
...defaultConfiguration ,
287
296
configuration : { image : "" } ,
288
297
} ) ;
289
298
expect ( result ) . toBeCloseTo ( 2 * 1000 * 1000 * 1000 , - 5 ) ;
290
299
} ) ;
291
300
292
301
it ( "should return undefined if app is not passed" , ( ) => {
293
- expect ( resolveAppDiskSize ( accountBase , undefined ) ) . toBeUndefined ( ) ;
302
+ expect ( resolveAppDiskSize ( undefined ) ) . toBeUndefined ( ) ;
294
303
} ) ;
295
304
} ) ;
296
305
} ) ;
0 commit comments