@@ -65,7 +65,13 @@ var _ = Describe("gateway", func() {
65
65
},
66
66
Username : "einstein" ,
67
67
}
68
- homeRef = & storagep.Reference {Path : "/users/f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c" }
68
+ homeRef = & storagep.Reference {
69
+ ResourceId : & storagep.ResourceId {
70
+ StorageId : user .Id .OpaqueId ,
71
+ OpaqueId : user .Id .OpaqueId ,
72
+ },
73
+ Path : "." ,
74
+ }
69
75
70
76
infos2Etags = func (infos []* storagep.ResourceInfo ) map [string ]string {
71
77
etags := map [string ]string {}
@@ -208,15 +214,17 @@ var _ = Describe("gateway", func() {
208
214
})
209
215
210
216
Describe ("ListContainer" , func () {
211
- It ("merges the lists of both shards" , func () {
217
+ // Note: The Gateway doesn't merge any lists any more. This needs to be done by the client
218
+ // TODO: Move the tests to a place where they can actually test something
219
+ PIt ("merges the lists of both shards" , func () {
212
220
listRes , err := serviceClient .ListContainer (ctx , & storagep.ListContainerRequest {Ref : projectsRef })
213
221
Expect (err ).ToNot (HaveOccurred ())
214
222
Expect (listRes .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
215
223
216
224
Expect (infos2Paths (listRes .Infos )).To (ConsistOf ([]string {"/projects/a - project" , "/projects/z - project" }))
217
225
})
218
226
219
- It ("propagates the etags from both shards" , func () {
227
+ PIt ("propagates the etags from both shards" , func () {
220
228
rootEtag := getProjectsEtag ()
221
229
222
230
listRes , err := serviceClient .ListContainer (ctx , & storagep.ListContainerRequest {Ref : projectsRef })
@@ -291,7 +299,12 @@ var _ = Describe("gateway", func() {
291
299
Expect (createRes .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
292
300
space := createRes .StorageSpace
293
301
294
- listRes , err := serviceClient .ListContainer (ctx , & storagep.ListContainerRequest {Ref : projectsRef })
302
+ ref := & storagep.Reference {
303
+ ResourceId : space .Root ,
304
+ Path : "." ,
305
+ }
306
+
307
+ listRes , err := serviceClient .ListContainer (ctx , & storagep.ListContainerRequest {Ref : ref })
295
308
Expect (err ).ToNot (HaveOccurred ())
296
309
Expect (listRes .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
297
310
@@ -305,32 +318,39 @@ var _ = Describe("gateway", func() {
305
318
306
319
It ("lists individual project spaces" , func () {
307
320
By ("trying to list a non-existent space" )
308
- listRes , err := serviceClient .ListContainer (ctx , & storagep.ListContainerRequest {Ref : & storagep.Reference {Path : "/projects/does-not-exist" }})
321
+ listRes , err := serviceClient .ListContainer (ctx , & storagep.ListContainerRequest {Ref : & storagep.Reference {
322
+ ResourceId : & storagep.ResourceId {
323
+ StorageId : "does-not-exist" ,
324
+ OpaqueId : "neither-supposed-to-exist" ,
325
+ },
326
+ Path : "." ,
327
+ }})
309
328
Expect (err ).ToNot (HaveOccurred ())
310
329
Expect (listRes .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_NOT_FOUND ))
311
330
312
331
By ("listing an existing space" )
313
- listRes , err = serviceClient .ListContainer (ctx , & storagep.ListContainerRequest {Ref : & storagep.Reference {Path : "/projects/a - project " }})
332
+ listRes , err = serviceClient .ListContainer (ctx , & storagep.ListContainerRequest {Ref : & storagep.Reference {ResourceId : shard1Space . Root , Path : ". " }})
314
333
Expect (err ).ToNot (HaveOccurred ())
315
334
Expect (listRes .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
316
335
Expect (len (listRes .Infos )).To (Equal (2 ))
317
336
paths := []string {}
318
337
for _ , i := range listRes .Infos {
319
338
paths = append (paths , i .Path )
320
339
}
321
- Expect (paths ).To (ConsistOf ([]string {"/projects/a - project/ file.txt" , "/projects/a - project/ .space" }))
340
+ Expect (paths ).To (ConsistOf ([]string {"file.txt" , ".space" }))
322
341
})
323
342
324
343
})
325
344
})
326
345
327
346
Context ("with a basic user storage" , func () {
328
347
var (
329
- fs storage.FS
330
- embeddedFs storage.FS
331
- homeSpace * storagep.StorageSpace
332
- embeddedSpace * storagep.StorageSpace
333
- embeddedRef * storagep.Reference
348
+ fs storage.FS
349
+ embeddedFs storage.FS
350
+ homeSpace * storagep.StorageSpace
351
+ embeddedSpace * storagep.StorageSpace
352
+ embeddedSpaceID string
353
+ embeddedRef * storagep.Reference
334
354
)
335
355
336
356
BeforeEach (func () {
@@ -352,8 +372,10 @@ var _ = Describe("gateway", func() {
352
372
"treetime_accounting" : true ,
353
373
})
354
374
Expect (err ).ToNot (HaveOccurred ())
355
- err = fs .CreateHome (ctx )
375
+
376
+ r , err := serviceClient .CreateHome (ctx , & storagep.CreateHomeRequest {})
356
377
Expect (err ).ToNot (HaveOccurred ())
378
+ Expect (r .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
357
379
358
380
spaces , err := fs .ListStorageSpaces (ctx , []* storagep.ListStorageSpacesRequest_Filter {}, nil )
359
381
Expect (err ).ToNot (HaveOccurred ())
@@ -374,21 +396,28 @@ var _ = Describe("gateway", func() {
374
396
"treetime_accounting" : true ,
375
397
})
376
398
Expect (err ).ToNot (HaveOccurred ())
377
- res , err := embeddedFs .CreateStorageSpace (ctx , & storagep.CreateStorageSpaceRequest {
399
+ res , err := serviceClient .CreateStorageSpace (ctx , & storagep.CreateStorageSpaceRequest {
378
400
Type : "project" ,
379
401
Name : "embedded project" ,
380
402
Owner : user ,
381
403
})
382
404
Expect (err ).ToNot (HaveOccurred ())
383
405
Expect (res .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
384
406
embeddedSpace = res .StorageSpace
385
- embeddedRef = & storagep.Reference {Path : path .Join (homeRef .Path , "Projects" , embeddedSpace .Id .OpaqueId )}
407
+ embeddedRef = & storagep.Reference {
408
+ ResourceId : & storagep.ResourceId {
409
+ StorageId : embeddedSpace .Id .OpaqueId ,
410
+ OpaqueId : embeddedSpace .Id .OpaqueId ,
411
+ },
412
+ Path : "." , // path.Join(homeRef.Path, "Projects", embeddedSpace.Id.OpaqueId),
413
+ }
386
414
err = helpers .Upload (ctx ,
387
415
embeddedFs ,
388
416
& storagep.Reference {ResourceId : & storagep.ResourceId {StorageId : embeddedSpace .Id .OpaqueId }, Path : "/embedded.txt" },
389
417
[]byte ("22" ),
390
418
)
391
419
Expect (err ).ToNot (HaveOccurred ())
420
+ embeddedSpaceID = embeddedSpace .Id .OpaqueId
392
421
})
393
422
394
423
Describe ("ListContainer" , func () {
@@ -399,27 +428,27 @@ var _ = Describe("gateway", func() {
399
428
Expect (len (listRes .Infos )).To (Equal (2 ))
400
429
401
430
var fileInfo * storagep.ResourceInfo
402
- var embeddedInfo * storagep.ResourceInfo
431
+ // var embeddedInfo *storagep.ResourceInfo
403
432
for _ , i := range listRes .Infos {
404
- if i .Path == "/users/f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c/ file.txt" {
433
+ if i .Path == "file.txt" {
405
434
fileInfo = i
406
- } else if i .Path == "/users/f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c/ Projects" {
407
- embeddedInfo = i
408
- }
435
+ } // else if i.Path == "Projects" {
436
+ // embeddedInfo = i
437
+ // }
409
438
410
439
}
411
440
Expect (fileInfo ).ToNot (BeNil ())
412
441
Expect (fileInfo .Owner .OpaqueId ).To (Equal (user .Id .OpaqueId ))
413
- Expect (fileInfo .Path ).To (Equal ("/users/f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c/ file.txt" ))
442
+ Expect (fileInfo .Path ).To (Equal ("file.txt" ))
414
443
Expect (fileInfo .Size ).To (Equal (uint64 (1 )))
415
444
416
- Expect (embeddedInfo ).ToNot (BeNil ())
417
- Expect (embeddedInfo .Owner .OpaqueId ).To (Equal (user .Id .OpaqueId ))
418
- Expect (embeddedInfo .Path ).To (Equal ("/users/f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c/ Projects" ))
419
- Expect (embeddedInfo .Size ).To (Equal (uint64 (2 )))
445
+ // Expect(embeddedInfo).ToNot(BeNil())
446
+ // Expect(embeddedInfo.Owner.OpaqueId).To(Equal(user.Id.OpaqueId))
447
+ // Expect(embeddedInfo.Path).To(Equal("Projects"))
448
+ // Expect(embeddedInfo.Size).To(Equal(uint64(2)))
420
449
})
421
450
422
- It ("lists the embedded project space" , func () {
451
+ PIt ("lists the embedded project space" , func () {
423
452
listRes , err := serviceClient .ListContainer (ctx , & storagep.ListContainerRequest {Ref : embeddedRef })
424
453
Expect (err ).ToNot (HaveOccurred ())
425
454
Expect (listRes .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
@@ -447,9 +476,11 @@ var _ = Describe("gateway", func() {
447
476
448
477
info := statRes .Info
449
478
Expect (info .Type ).To (Equal (storagep .ResourceType_RESOURCE_TYPE_CONTAINER ))
450
- Expect (info .Path ).To (Equal (homeRef . Path ))
479
+ Expect (info .Path ).To (Equal (user . Id . OpaqueId ))
451
480
Expect (info .Owner .OpaqueId ).To (Equal (user .Id .OpaqueId ))
452
- Expect (info .Size ).To (Equal (uint64 (3 ))) // home: 1, embedded: 2
481
+
482
+ // TODO: size aggregating is done by the client now - so no chance testing that here
483
+ // Expect(info.Size).To(Equal(uint64(3))) // home: 1, embedded: 2
453
484
})
454
485
455
486
It ("stats the embedded space" , func () {
@@ -459,12 +490,13 @@ var _ = Describe("gateway", func() {
459
490
460
491
info := statRes .Info
461
492
Expect (info .Type ).To (Equal (storagep .ResourceType_RESOURCE_TYPE_CONTAINER ))
462
- Expect (info .Path ).To (Equal (embeddedRef . Path ))
493
+ Expect (info .Path ).To (Equal (embeddedSpaceID ))
463
494
Expect (info .Owner .OpaqueId ).To (Equal (user .Id .OpaqueId ))
464
495
Expect (info .Size ).To (Equal (uint64 (2 )))
465
496
})
466
497
467
- It ("propagates Sizes from within the root space" , func () {
498
+ PIt ("propagates Sizes from within the root space" , func () {
499
+ // TODO: this cannot work atm as the propagation is not done by the gateway anymore
468
500
statRes , err := serviceClient .Stat (ctx , & storagep.StatRequest {Ref : homeRef })
469
501
Expect (err ).ToNot (HaveOccurred ())
470
502
Expect (statRes .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
@@ -503,7 +535,7 @@ var _ = Describe("gateway", func() {
503
535
Expect (statRes .Info .Size ).To (Equal (uint64 (33 )))
504
536
})
505
537
506
- It ("propagates Sizes from within the embedded space" , func () {
538
+ PIt ("propagates Sizes from within the embedded space" , func () {
507
539
statRes , err := serviceClient .Stat (ctx , & storagep.StatRequest {Ref : homeRef })
508
540
Expect (err ).ToNot (HaveOccurred ())
509
541
Expect (statRes .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
@@ -585,7 +617,7 @@ var _ = Describe("gateway", func() {
585
617
Expect (newEtag3 ).ToNot (Equal (newEtag2 ))
586
618
})
587
619
588
- It ("propagates Etags from within the embedded space" , func () {
620
+ PIt ("propagates Etags from within the embedded space" , func () {
589
621
statRes , err := serviceClient .Stat (ctx , & storagep.StatRequest {Ref : homeRef })
590
622
Expect (err ).ToNot (HaveOccurred ())
591
623
Expect (statRes .Status .Code ).To (Equal (rpcv1beta1 .Code_CODE_OK ))
0 commit comments