diff --git a/pkg/assembler/backends/ent/backend/hasMetadata.go b/pkg/assembler/backends/ent/backend/hasMetadata.go index c1769e04dd..ab88c929e3 100644 --- a/pkg/assembler/backends/ent/backend/hasMetadata.go +++ b/pkg/assembler/backends/ent/backend/hasMetadata.go @@ -32,6 +32,7 @@ import ( ) func (b *EntBackend) HasMetadata(ctx context.Context, filter *model.HasMetadataSpec) ([]*model.HasMetadata, error) { + fmt.Printf("HasMetadata ctx %v %+v\n", &ctx, ctx) records, err := b.client.HasMetadata.Query(). Where(hasMetadataPredicate(filter)). Limit(MaxPageSize). @@ -60,8 +61,9 @@ func (b *EntBackend) IngestHasMetadata(ctx context.Context, subject model.Packag } func (b *EntBackend) IngestBulkHasMetadata(ctx context.Context, subjects model.PackageSourceOrArtifactInputs, pkgMatchType *model.MatchFlags, hasMetadataList []*model.HasMetadataInputSpec) ([]string, error) { + fmt.Printf("IngestBulkHasMetadata ctx %v %+v\n", &ctx, ctx) var results = make([]string, len(hasMetadataList)) - eg, ctx := errgroup.WithContext(ctx) + eg, egCtx := errgroup.WithContext(ctx) for i := range hasMetadataList { index := i hmSpec := *hasMetadataList[index] @@ -74,11 +76,12 @@ func (b *EntBackend) IngestBulkHasMetadata(ctx context.Context, subjects model.P subject = model.PackageSourceOrArtifactInput{Source: subjects.Sources[index]} } concurrently(eg, func() error { - hm, err := b.IngestHasMetadata(ctx, subject, pkgMatchType, hmSpec) + hm, err := b.IngestHasMetadata(egCtx, subject, pkgMatchType, hmSpec) if err == nil { results[index] = hm.ID return err } else { + fmt.Printf("error is %s\n", err) return gqlerror.Errorf("IngestBulkHasMetadata failed with element #%v %+v with err: %v", index, *subject.Package, err) } }) diff --git a/pkg/assembler/backends/ent/backend/hasMetadata_test.go b/pkg/assembler/backends/ent/backend/hasMetadata_test.go index 04aab9194f..5421c60119 100644 --- a/pkg/assembler/backends/ent/backend/hasMetadata_test.go +++ b/pkg/assembler/backends/ent/backend/hasMetadata_test.go @@ -18,6 +18,7 @@ package backend import ( + "fmt" "strconv" "time" @@ -977,13 +978,14 @@ func (s *Suite) TestIngestBulkHasMetadata() { } } for _, o := range test.Calls { - _, err := b.IngestBulkHasMetadata(ctx, o.Sub, o.Match, o.HM) + bhm, err := b.IngestBulkHasMetadata(ctx, o.Sub, o.Match, o.HM) if (err != nil) != test.ExpIngestErr { t.Fatalf("did not get expected ingest error, want: %v, got: %v", test.ExpIngestErr, err) } if err != nil { return } + fmt.Println("bhm", bhm) } got, err := b.HasMetadata(ctx, test.Query) if (err != nil) != test.ExpQueryErr {