@@ -57,13 +57,13 @@ func TestBasic(t *testing.T) {
5757 // Setup GCS
5858 v1 := & osvschema.Vulnerability {Id : "aaa-123" , Modified : timestamppb .Now ()}
5959 v1Data , _ := proto .Marshal (v1 )
60- if err := gcsClient .WriteObject (ctx , "aaa-123.pb" , v1Data , nil ); err != nil {
60+ if err := gcsClient .WriteObject (ctx , "all/pb/ aaa-123.pb" , v1Data , nil ); err != nil {
6161 t .Fatalf ("failed to write GCS object: %v" , err )
6262 }
6363
6464 v2 := & osvschema.Vulnerability {Id : "aaa-124" , Modified : timestamppb .Now ()}
6565 v2Data , _ := proto .Marshal (v2 )
66- if err := gcsClient .WriteObject (ctx , "aaa-124.pb" , v2Data , nil ); err != nil {
66+ if err := gcsClient .WriteObject (ctx , "all/pb/ aaa-124.pb" , v2Data , nil ); err != nil {
6767 t .Fatalf ("failed to write GCS object: %v" , err )
6868 }
6969
@@ -87,7 +87,7 @@ func TestBasic(t *testing.T) {
8787 }
8888
8989 // Check GCS
90- data , err := gcsClient .ReadObject (ctx , "aaa-123.pb" )
90+ data , err := gcsClient .ReadObject (ctx , "all/pb/ aaa-123.pb" )
9191 if err != nil {
9292 t .Fatalf ("failed to read GCS object: %v" , err )
9393 }
@@ -119,7 +119,7 @@ func TestMissingVuln(t *testing.T) {
119119 // Setup GCS only for vuln1
120120 v1 := & osvschema.Vulnerability {Id : "aaa-123" , Modified : timestamppb .Now ()}
121121 v1Data , _ := proto .Marshal (v1 )
122- if err := gcsClient .WriteObject (ctx , "aaa-123.pb" , v1Data , nil ); err != nil {
122+ if err := gcsClient .WriteObject (ctx , "all/pb/ aaa-123.pb" , v1Data , nil ); err != nil {
123123 t .Fatalf ("failed to write GCS object: %v" , err )
124124 }
125125
@@ -141,7 +141,7 @@ func TestMissingVuln(t *testing.T) {
141141 }
142142
143143 // Check GCS for vuln1
144- data , err := gcsClient .ReadObject (ctx , "aaa-123.pb" )
144+ data , err := gcsClient .ReadObject (ctx , "all/pb/ aaa-123.pb" )
145145 if err != nil {
146146 t .Fatalf ("failed to read GCS object: %v" , err )
147147 }
@@ -154,7 +154,7 @@ func TestMissingVuln(t *testing.T) {
154154 }
155155
156156 // Verify non-existent-123 was not created in GCS
157- _ , err = gcsClient .ReadObject (ctx , "non-existent-123.pb" )
157+ _ , err = gcsClient .ReadObject (ctx , "all/pb/ non-existent-123.pb" )
158158 if ! errors .Is (err , clients .ErrNotFound ) {
159159 t .Errorf ("expected non-existent-123.pb to not exist, got err: %v" , err )
160160 }
@@ -188,7 +188,7 @@ func TestMissingGCSButInDatastore(t *testing.T) {
188188 // Setup GCS only for vuln1
189189 v1 := & osvschema.Vulnerability {Id : "aaa-123" , Modified : timestamppb .Now ()}
190190 v1Data , _ := proto .Marshal (v1 )
191- if err := gcsClient .WriteObject (ctx , "aaa-123.pb" , v1Data , nil ); err != nil {
191+ if err := gcsClient .WriteObject (ctx , "all/pb/ aaa-123.pb" , v1Data , nil ); err != nil {
192192 t .Fatalf ("failed to write GCS object: %v" , err )
193193 }
194194
@@ -249,18 +249,18 @@ func TestGenerationMismatch(t *testing.T) {
249249 // Setup GCS with an older generation
250250 v1 := & osvschema.Vulnerability {Id : "aaa-123" , Modified : timestamppb .Now ()}
251251 v1Data , _ := proto .Marshal (v1 )
252- if err := gcsClient .WriteObject (ctx , "aaa-123.pb" , v1Data , nil ); err != nil {
252+ if err := gcsClient .WriteObject (ctx , "all/pb/ aaa-123.pb" , v1Data , nil ); err != nil {
253253 t .Fatalf ("failed to write GCS object: %v" , err )
254254 }
255255
256256 v2 := & osvschema.Vulnerability {Id : "aaa-124" , Modified : timestamppb .Now ()}
257257 v2Data , _ := proto .Marshal (v2 )
258- if err := gcsClient .WriteObject (ctx , "aaa-124.pb" , v2Data , nil ); err != nil {
258+ if err := gcsClient .WriteObject (ctx , "all/pb/ aaa-124.pb" , v2Data , nil ); err != nil {
259259 t .Fatalf ("failed to write GCS object: %v" , err )
260260 }
261261
262262 // Simulate a concurrent update by setting WriteErrors for aaa-123.pb
263- gcsClient .WriteErrors ["aaa-123.pb" ] = clients .ErrPreconditionFailed
263+ gcsClient .WriteErrors ["all/pb/ aaa-123.pb" ] = clients .ErrPreconditionFailed
264264
265265 updater := NewUpdater (ctx , dsClient , gcsClient , publisher )
266266 if err := ComputeAliasGroups (ctx , dsClient , updater .Ch ); err != nil {
@@ -301,7 +301,7 @@ func TestBugReachesLimit(t *testing.T) {
301301 // Setup GCS
302302 v1 := & osvschema.Vulnerability {Id : "aaa-111" , Modified : timestamppb .Now ()}
303303 v1Data , _ := proto .Marshal (v1 )
304- if err := gcsClient .WriteObject (ctx , "aaa-111.pb" , v1Data , nil ); err != nil {
304+ if err := gcsClient .WriteObject (ctx , "all/pb/ aaa-111.pb" , v1Data , nil ); err != nil {
305305 t .Fatalf ("failed to write GCS object: %v" , err )
306306 }
307307
@@ -322,7 +322,7 @@ func TestBugReachesLimit(t *testing.T) {
322322 }
323323
324324 // Check GCS to ensure aliases are empty
325- data , err := gcsClient .ReadObject (ctx , "aaa-111.pb" )
325+ data , err := gcsClient .ReadObject (ctx , "all/pb/ aaa-111.pb" )
326326 if err != nil {
327327 t .Fatalf ("failed to read GCS object: %v" , err )
328328 }
@@ -374,7 +374,7 @@ func TestUpdateAliasGroup(t *testing.T) {
374374 // Setup GCS for bbb-123 (to check update)
375375 v1 := & osvschema.Vulnerability {Id : "bbb-123" , Modified : timestamppb .Now ()}
376376 v1Data , _ := proto .Marshal (v1 )
377- if err := gcsClient .WriteObject (ctx , "bbb-123.pb" , v1Data , nil ); err != nil {
377+ if err := gcsClient .WriteObject (ctx , "all/pb/ bbb-123.pb" , v1Data , nil ); err != nil {
378378 t .Fatalf ("failed to write GCS object: %v" , err )
379379 }
380380
@@ -419,7 +419,7 @@ func TestUpdateAliasGroup(t *testing.T) {
419419 }
420420
421421 // Check GCS for bbb-123
422- data , err := gcsClient .ReadObject (ctx , "bbb-123.pb" )
422+ data , err := gcsClient .ReadObject (ctx , "all/pb/ bbb-123.pb" )
423423 if err != nil {
424424 t .Fatalf ("failed to read GCS object: %v" , err )
425425 }
@@ -465,7 +465,7 @@ func TestCreateAliasGroup(t *testing.T) {
465465 // Setup GCS for test-123
466466 v1 := & osvschema.Vulnerability {Id : "test-123" , Modified : timestamppb .Now ()}
467467 v1Data , _ := proto .Marshal (v1 )
468- if err := gcsClient .WriteObject (ctx , "test-123.pb" , v1Data , nil ); err != nil {
468+ if err := gcsClient .WriteObject (ctx , "all/pb/ test-123.pb" , v1Data , nil ); err != nil {
469469 t .Fatalf ("failed to write GCS object: %v" , err )
470470 }
471471
@@ -509,7 +509,7 @@ func TestCreateAliasGroup(t *testing.T) {
509509 }
510510
511511 // Check GCS for test-123
512- data , err := gcsClient .ReadObject (ctx , "test-123.pb" )
512+ data , err := gcsClient .ReadObject (ctx , "all/pb/ test-123.pb" )
513513 if err != nil {
514514 t .Fatalf ("failed to read GCS object: %v" , err )
515515 }
@@ -555,7 +555,7 @@ func TestDeleteAliasGroup(t *testing.T) {
555555 // Setup GCS
556556 v1 := & osvschema.Vulnerability {Id : "ccc-123" , Modified : timestamppb .Now ()}
557557 v1Data , _ := proto .Marshal (v1 )
558- if err := gcsClient .WriteObject (ctx , "ccc-123.pb" , v1Data , nil ); err != nil {
558+ if err := gcsClient .WriteObject (ctx , "all/pb/ ccc-123.pb" , v1Data , nil ); err != nil {
559559 t .Fatalf ("failed to write GCS object: %v" , err )
560560 }
561561
@@ -577,7 +577,7 @@ func TestDeleteAliasGroup(t *testing.T) {
577577 }
578578
579579 // Check GCS for ccc-123
580- data , err := gcsClient .ReadObject (ctx , "ccc-123.pb" )
580+ data , err := gcsClient .ReadObject (ctx , "all/pb/ ccc-123.pb" )
581581 if err != nil {
582582 t .Fatalf ("failed to read GCS object: %v" , err )
583583 }
@@ -626,13 +626,13 @@ func TestSplitAliasGroup(t *testing.T) {
626626 // Setup GCS
627627 v1 := & osvschema.Vulnerability {Id : "ddd-123" , Modified : timestamppb .Now ()}
628628 v1Data , _ := proto .Marshal (v1 )
629- if err := gcsClient .WriteObject (ctx , "ddd-123.pb" , v1Data , nil ); err != nil {
629+ if err := gcsClient .WriteObject (ctx , "all/pb/ ddd-123.pb" , v1Data , nil ); err != nil {
630630 t .Fatalf ("failed to write GCS object: %v" , err )
631631 }
632632
633633 v2 := & osvschema.Vulnerability {Id : "ddd-124" , Modified : timestamppb .Now ()}
634634 v2Data , _ := proto .Marshal (v2 )
635- if err := gcsClient .WriteObject (ctx , "ddd-124.pb" , v2Data , nil ); err != nil {
635+ if err := gcsClient .WriteObject (ctx , "all/pb/ ddd-124.pb" , v2Data , nil ); err != nil {
636636 t .Fatalf ("failed to write GCS object: %v" , err )
637637 }
638638
@@ -653,7 +653,7 @@ func TestSplitAliasGroup(t *testing.T) {
653653 }
654654
655655 // Check GCS
656- data , err := gcsClient .ReadObject (ctx , "ddd-123.pb" )
656+ data , err := gcsClient .ReadObject (ctx , "all/pb/ ddd-123.pb" )
657657 if err != nil {
658658 t .Fatalf ("failed to read GCS object: %v" , err )
659659 }
@@ -665,7 +665,7 @@ func TestSplitAliasGroup(t *testing.T) {
665665 t .Errorf ("expected 0 aliases for ddd-123, got %v" , updatedV1 .GetAliases ())
666666 }
667667
668- data , err = gcsClient .ReadObject (ctx , "ddd-124.pb" )
668+ data , err = gcsClient .ReadObject (ctx , "all/pb/ ddd-124.pb" )
669669 if err != nil {
670670 t .Fatalf ("failed to read GCS object: %v" , err )
671671 }
@@ -705,7 +705,7 @@ func TestAllowList(t *testing.T) {
705705 // Setup GCS
706706 v1 := & osvschema.Vulnerability {Id : "eee-123" , Modified : timestamppb .Now ()}
707707 v1Data , _ := proto .Marshal (v1 )
708- if err := gcsClient .WriteObject (ctx , "eee-123.pb" , v1Data , nil ); err != nil {
708+ if err := gcsClient .WriteObject (ctx , "all/pb/ eee-123.pb" , v1Data , nil ); err != nil {
709709 t .Fatalf ("failed to write GCS object: %v" , err )
710710 }
711711
@@ -777,7 +777,7 @@ func TestDenyList(t *testing.T) {
777777 // Setup GCS
778778 v1 := & osvschema.Vulnerability {Id : "fff-123" , Modified : timestamppb .Now ()}
779779 v1Data , _ := proto .Marshal (v1 )
780- if err := gcsClient .WriteObject (ctx , "fff-123.pb" , v1Data , nil ); err != nil {
780+ if err := gcsClient .WriteObject (ctx , "all/pb/ fff-123.pb" , v1Data , nil ); err != nil {
781781 t .Fatalf ("failed to write GCS object: %v" , err )
782782 }
783783
@@ -840,7 +840,7 @@ func TestMergeAliasGroup(t *testing.T) {
840840 // Setup GCS for ggg-123
841841 v1 := & osvschema.Vulnerability {Id : "ggg-123" , Modified : timestamppb .Now ()}
842842 v1Data , _ := proto .Marshal (v1 )
843- if err := gcsClient .WriteObject (ctx , "ggg-123.pb" , v1Data , nil ); err != nil {
843+ if err := gcsClient .WriteObject (ctx , "all/pb/ ggg-123.pb" , v1Data , nil ); err != nil {
844844 t .Fatalf ("failed to write GCS object: %v" , err )
845845 }
846846
@@ -911,7 +911,7 @@ func TestPartialMergeAliasGroup(t *testing.T) {
911911 // Setup GCS for hhh-123
912912 v1 := & osvschema.Vulnerability {Id : "hhh-123" , Modified : timestamppb .Now ()}
913913 v1Data , _ := proto .Marshal (v1 )
914- if err := gcsClient .WriteObject (ctx , "hhh-123.pb" , v1Data , nil ); err != nil {
914+ if err := gcsClient .WriteObject (ctx , "all/pb/ hhh-123.pb" , v1Data , nil ); err != nil {
915915 t .Fatalf ("failed to write GCS object: %v" , err )
916916 }
917917
@@ -986,7 +986,7 @@ func TestAliasGroupReachesLimit(t *testing.T) {
986986 // Setup GCS for iii-new
987987 v1 := & osvschema.Vulnerability {Id : "iii-new" , Modified : timestamppb .Now ()}
988988 v1Data , _ := proto .Marshal (v1 )
989- if err := gcsClient .WriteObject (ctx , "iii-new.pb" , v1Data , nil ); err != nil {
989+ if err := gcsClient .WriteObject (ctx , "all/pb/ iii-new.pb" , v1Data , nil ); err != nil {
990990 t .Fatalf ("failed to write GCS object: %v" , err )
991991 }
992992
0 commit comments