Skip to content

Commit

Permalink
fix(dbrpv2): reflect match count correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
gavincabbage committed May 25, 2020
1 parent d5b3ccb commit 36ee87c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dbrp/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilte
}
}

return ms, len(ms), s.store.View(ctx, func(tx kv.Tx) error {
err := s.store.View(ctx, func(tx kv.Tx) error {
// Optimized path, use index.
if orgID := filter.OrgID; orgID != nil {
// The index performs a prefix search.
Expand Down Expand Up @@ -338,6 +338,8 @@ func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilte
}
return nil
})

return ms, len(ms), err
}

// Create creates a new mapping.
Expand Down
5 changes: 4 additions & 1 deletion testing/dbrp_mapping_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,13 @@ func CreateDBRPMappingV2(
}
}

dbrpMappings, _, err := s.FindMany(ctx, influxdb.DBRPMappingFilterV2{})
dbrpMappings, n, err := s.FindMany(ctx, influxdb.DBRPMappingFilterV2{})
if err != nil {
t.Fatalf("failed to retrieve dbrps: %v", err)
}
if n != len(tt.wants.dbrpMappings) {
t.Errorf("want dbrpMappings count of %d, got %d", len(tt.wants.dbrpMappings), n)
}
if diff := cmp.Diff(tt.wants.dbrpMappings, dbrpMappings, DBRPMappingCmpOptionsV2...); diff != "" {
t.Errorf("dbrpMappings are different -want/+got\ndiff %s", diff)
}
Expand Down

0 comments on commit 36ee87c

Please sign in to comment.