@@ -41,7 +41,7 @@ test.afterEach.always(async (t) => {
41
41
delete process . env . NETLIFY_BLOBS_CONTEXT
42
42
} )
43
43
44
- test . serial ( "blobs upload, don't run when deploy id is provided and no files in directory" , async ( t ) => {
44
+ test . serial ( 'Blobs upload step uploads files when deploy ID is provided and no files in directory' , async ( t ) => {
45
45
const {
46
46
success,
47
47
logs : { stdout } ,
@@ -57,7 +57,7 @@ test.serial("blobs upload, don't run when deploy id is provided and no files in
57
57
} )
58
58
59
59
test . serial (
60
- "blobs upload, don't run when there are files but deploy id is not provided using legacy API" ,
60
+ 'Blobs upload step uploads files when there are files but deploy ID is not provided ( legacy API)' ,
61
61
async ( t ) => {
62
62
const fixture = await new Fixture ( './fixtures/src_with_blobs_legacy' ) . withCopyRoot ( { git : false } )
63
63
@@ -77,7 +77,7 @@ test.serial(
77
77
} ,
78
78
)
79
79
80
- test . serial ( 'blobs upload, uploads files to deploy store using legacy API' , async ( t ) => {
80
+ test . serial ( 'Blobs upload step uploads files to deploy store ( legacy API) ' , async ( t ) => {
81
81
const fixture = await new Fixture ( './fixtures/src_with_blobs_legacy' ) . withCopyRoot ( { git : false } )
82
82
83
83
const {
@@ -121,7 +121,50 @@ test.serial('blobs upload, uploads files to deploy store using legacy API', asyn
121
121
t . true ( stdout . join ( '\n' ) . includes ( 'Uploading blobs to deploy store' ) )
122
122
} )
123
123
124
- test . serial ( 'blobs upload, uploads files to deploy store' , async ( t ) => {
124
+ test . serial ( 'Blobs upload step uploads files to deploy store (legacy deploy config API)' , async ( t ) => {
125
+ const fixture = await new Fixture ( './fixtures/src_with_blobs_legacy_deploy_config' ) . withCopyRoot ( { git : false } )
126
+
127
+ const {
128
+ success,
129
+ logs : { stdout } ,
130
+ } = await fixture
131
+ . withFlags ( { deployId : 'abc123' , siteId : 'test' , token : TOKEN , offline : true , cwd : fixture . repositoryRoot } )
132
+ . runBuildProgrammatic ( )
133
+ t . true ( success )
134
+ t . is ( t . context . blobRequests . set . length , 6 )
135
+
136
+ const regionRequests = t . context . blobRequests . set . filter ( ( urlPath ) => {
137
+ const url = new URL ( urlPath , 'http://localhost' )
138
+
139
+ return url . searchParams . has ( 'region' )
140
+ } )
141
+
142
+ t . is ( regionRequests . length , 3 )
143
+
144
+ const storeOpts = { deployID : 'abc123' , siteID : 'test' , token : TOKEN }
145
+ if ( semver . lt ( nodeVersion , '18.0.0' ) ) {
146
+ const nodeFetch = await import ( 'node-fetch' )
147
+ storeOpts . fetch = nodeFetch . default
148
+ }
149
+
150
+ const store = getDeployStore ( storeOpts )
151
+
152
+ const blob1 = await store . getWithMetadata ( 'something.txt' )
153
+ t . is ( blob1 . data , 'some value' )
154
+ t . deepEqual ( blob1 . metadata , { } )
155
+
156
+ const blob2 = await store . getWithMetadata ( 'with-metadata.txt' )
157
+ t . is ( blob2 . data , 'another value' )
158
+ t . deepEqual ( blob2 . metadata , { meta : 'data' , number : 1234 } )
159
+
160
+ const blob3 = await store . getWithMetadata ( 'nested/file.txt' )
161
+ t . is ( blob3 . data , 'file value' )
162
+ t . deepEqual ( blob3 . metadata , { some : 'metadata' } )
163
+
164
+ t . true ( stdout . join ( '\n' ) . includes ( 'Uploading blobs to deploy store' ) )
165
+ } )
166
+
167
+ test . serial ( 'Blobs upload step uploads files to deploy store' , async ( t ) => {
125
168
const fixture = await new Fixture ( './fixtures/src_with_blobs' ) . withCopyRoot ( { git : false } )
126
169
127
170
const {
@@ -167,13 +210,13 @@ test.serial('blobs upload, uploads files to deploy store', async (t) => {
167
210
t . true ( stdout . join ( '\n' ) . includes ( 'Uploading blobs to deploy store' ) )
168
211
} )
169
212
170
- test . serial ( 'blobs upload, cancels deploy if blob metadata is malformed' , async ( t ) => {
213
+ test . serial ( 'Blobs upload step cancels deploy if blob metadata is malformed' , async ( t ) => {
171
214
const fixture = await new Fixture ( './fixtures/src_with_malformed_blobs_metadata' ) . withCopyRoot ( { git : false } )
172
215
const { success, severityCode } = await fixture
173
216
. withFlags ( { deployId : 'abc123' , siteId : 'test' , token : TOKEN , offline : true , debug : false } )
174
217
. runBuildProgrammatic ( )
175
218
176
- const blobsDir = join ( fixture . repositoryRoot , '.netlify' , 'blobs' , 'deploy' )
219
+ const blobsDir = join ( fixture . repositoryRoot , '.netlify' , 'v1' , ' blobs', 'deploy' )
177
220
await t . notThrowsAsync ( access ( blobsDir ) )
178
221
179
222
t . is ( t . context . blobRequests . set , undefined )
0 commit comments