Skip to content

Commit

Permalink
Merge pull request #138 from k1LoW/not-shrinking-report
Browse files Browse the repository at this point in the history
Not shrinking report data in some datastores
  • Loading branch information
k1LoW authored Feb 7, 2022
2 parents 2f61600 + 1a7a426 commit 02aecea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,30 @@ var rootCmd = &cobra.Command{
}
addPaths = append(addPaths, rp)
}
for _, s := range c.Report.Datastores {
if datastore.NeedToShrink(s) {
continue
}
d, err := datastore.New(ctx, s, c.Root())
if err != nil {
return err
}
log.Printf("Storing report to %s", s)
if err := d.StoreReport(ctx, r); err != nil {
return err
}
}
log.Println("Shrink report data")
if r.Coverage != nil {
r.Coverage.DeleteBlockCoverages()
}
if r.CodeToTestRatio != nil {
r.CodeToTestRatio.DeleteFiles()
}
for _, s := range c.Report.Datastores {
if !datastore.NeedToShrink(s) {
continue
}
d, err := datastore.New(ctx, s, c.Root())
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions datastore/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,7 @@ func parse(u, configRoot string) (datastore string, args []string, err error) {
return "local", []string{root}, nil
}
}

func NeedToShrink(u string) bool {
return strings.HasPrefix(u, "bq://")
}

0 comments on commit 02aecea

Please sign in to comment.