@@ -23,7 +23,6 @@ import (
23
23
"testing"
24
24
"time"
25
25
26
- "github.com/evergreen-ci/poplar"
27
26
"github.com/stretchr/testify/require"
28
27
"go.mongodb.org/mongo-driver/v2/bson"
29
28
"go.mongodb.org/mongo-driver/v2/mongo"
@@ -496,8 +495,8 @@ func BenchmarkMultiInsertLargeDocument(b *testing.B) {
496
495
benchmarkMultiInsert (b , largeData )
497
496
}
498
497
499
- func runBenchmark (name string , fn func (* testing.B )) (poplar. Test , error ) {
500
- test := poplar. Test {
498
+ func runBenchmark (name string , fn func (* testing.B )) (poplarTest , error ) {
499
+ test := poplarTest {
501
500
ID : fmt .Sprintf ("%d" , time .Now ().UnixMilli ()),
502
501
CreatedAt : time .Now (),
503
502
}
@@ -510,7 +509,7 @@ func runBenchmark(name string, fn func(*testing.B)) (poplar.Test, error) {
510
509
511
510
test .CompletedAt = test .CreatedAt .Add (result .T )
512
511
513
- test .Metrics = []poplar. TestMetrics {
512
+ test .Metrics = []poplarTestMetrics {
514
513
{Name : "total_time_seconds" , Type : "SUM" , Value : result .T .Seconds ()},
515
514
{Name : "iterations" , Type : "SUM" , Value : result .N },
516
515
{Name : "allocated_bytes_per_op" , Type : "MEAN" , Value : result .AllocedBytesPerOp ()},
@@ -525,25 +524,25 @@ func runBenchmark(name string, fn func(*testing.B)) (poplar.Test, error) {
525
524
megaBytesPerOp := (float64 (result .Bytes ) / 1024 / 1024 ) / float64 (result .NsPerOp ()) * 1e9
526
525
527
526
test .Metrics = append (test .Metrics ,
528
- poplar. TestMetrics {Name : "megabytes_per_second" , Type : "THROUGHPUT" , Value : megaBytesPerOp })
527
+ poplarTestMetrics {Name : "megabytes_per_second" , Type : "THROUGHPUT" , Value : megaBytesPerOp })
529
528
}
530
529
531
530
if opsPerSecondMin := result .Extra [opsPerSecondMinName ]; opsPerSecondMin != 0 {
532
531
test .Metrics = append (test .Metrics ,
533
- poplar. TestMetrics {Name : opsPerSecondMinName , Type : "THROUGHPUT" , Value : opsPerSecondMin })
532
+ poplarTestMetrics {Name : opsPerSecondMinName , Type : "THROUGHPUT" , Value : opsPerSecondMin })
534
533
}
535
534
536
535
if opsPerSecondMax := result .Extra [opsPerSecondMaxName ]; opsPerSecondMax != 0 {
537
536
test .Metrics = append (test .Metrics ,
538
- poplar. TestMetrics {Name : opsPerSecondMaxName , Type : "THROUGHPUT" , Value : opsPerSecondMax })
537
+ poplarTestMetrics {Name : opsPerSecondMaxName , Type : "THROUGHPUT" , Value : opsPerSecondMax })
539
538
}
540
539
541
540
if opsPerSecondMed := result .Extra [opsPerSecondMedName ]; opsPerSecondMed != 0 {
542
541
test .Metrics = append (test .Metrics ,
543
- poplar. TestMetrics {Name : opsPerSecondMedName , Type : "THROUGHPUT" , Value : opsPerSecondMed })
542
+ poplarTestMetrics {Name : opsPerSecondMedName , Type : "THROUGHPUT" , Value : opsPerSecondMed })
544
543
}
545
544
546
- test .Info = poplar. TestInfo {
545
+ test .Info = poplarTestInfo {
547
546
TestName : name ,
548
547
}
549
548
@@ -586,7 +585,7 @@ func TestRunAllBenchmarks(t *testing.T) {
586
585
{name : "BenchmarkMultiInsertLargeDocument" , benchmark : BenchmarkMultiInsertLargeDocument },
587
586
}
588
587
589
- results := make ([]poplar. Test , len (cases ))
588
+ results := make ([]poplarTest , len (cases ))
590
589
for i := range cases {
591
590
t .Run (cases [i ].name , func (t * testing.T ) {
592
591
var err error
@@ -610,3 +609,62 @@ func TestRunAllBenchmarks(t *testing.T) {
610
609
err = os .WriteFile (filepath .Join (filepath .Dir (testdataDir (t )), defaultOutputFileName ), evgOutput , 0644 )
611
610
require .NoError (t , err , "failed to write results" )
612
611
}
612
+
613
+ // poplarTest was copied from
614
+ // https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L38
615
+ type poplarTest struct {
616
+ ID string `bson:"_id" json:"id" yaml:"id"`
617
+ Info poplarTestInfo `bson:"info" json:"info" yaml:"info"`
618
+ CreatedAt time.Time `bson:"created_at" json:"created_at" yaml:"created_at"`
619
+ CompletedAt time.Time `bson:"completed_at" json:"completed_at" yaml:"completed_at"`
620
+ Artifacts []poplarTestArtifact `bson:"artifacts" json:"artifacts" yaml:"artifacts"`
621
+ Metrics []poplarTestMetrics `bson:"metrics" json:"metrics" yaml:"metrics"`
622
+ SubTests []poplarTest `bson:"sub_tests" json:"sub_tests" yaml:"sub_tests"`
623
+ }
624
+
625
+ // poplarTestInfo was copied from
626
+ // https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L52
627
+ type poplarTestInfo struct {
628
+ TestName string `bson:"test_name" json:"test_name" yaml:"test_name"`
629
+ Trial int `bson:"trial" json:"trial" yaml:"trial"`
630
+ Parent string `bson:"parent" json:"parent" yaml:"parent"`
631
+ Tags []string `bson:"tags" json:"tags" yaml:"tags"`
632
+ Arguments map [string ]int32 `bson:"args" json:"args" yaml:"args"`
633
+ }
634
+
635
+ // poplarTestArtifact was copied from
636
+ // https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L62
637
+ type poplarTestArtifact struct {
638
+ Bucket string `bson:"bucket" json:"bucket" yaml:"bucket"`
639
+ Prefix string `bson:"prefix" json:"prefix" yaml:"prefix"`
640
+ Permissions string `bson:"permissions" json:"permissions" yaml:"permissions"`
641
+ Path string `bson:"path" json:"path" yaml:"path"`
642
+ Tags []string `bson:"tags" json:"tags" yaml:"tags"`
643
+ CreatedAt time.Time `bson:"created_at" json:"created_at" yaml:"created_at"`
644
+ LocalFile string `bson:"local_path,omitempty" json:"local_path,omitempty" yaml:"local_path,omitempty"`
645
+ PayloadTEXT bool `bson:"is_text,omitempty" json:"is_text,omitempty" yaml:"is_text,omitempty"`
646
+ PayloadFTDC bool `bson:"is_ftdc,omitempty" json:"is_ftdc,omitempty" yaml:"is_ftdc,omitempty"`
647
+ PayloadBSON bool `bson:"is_bson,omitempty" json:"is_bson,omitempty" yaml:"is_bson,omitempty"`
648
+ PayloadJSON bool `bson:"is_json,omitempty" json:"is_json,omitempty" yaml:"is_json,omitempty"`
649
+ PayloadCSV bool `bson:"is_csv,omitempty" json:"is_csv,omitempty" yaml:"is_csv,omitempty"`
650
+ DataUncompressed bool `bson:"is_uncompressed" json:"is_uncompressed" yaml:"is_uncompressed"`
651
+ DataGzipped bool `bson:"is_gzip,omitempty" json:"is_gzip,omitempty" yaml:"is_gzip,omitempty"`
652
+ DataTarball bool `bson:"is_tarball,omitempty" json:"is_tarball,omitempty" yaml:"is_tarball,omitempty"`
653
+ EventsRaw bool `bson:"events_raw,omitempty" json:"events_raw,omitempty" yaml:"events_raw,omitempty"`
654
+ EventsHistogram bool `bson:"events_histogram,omitempty" json:"events_histogram,omitempty" yaml:"events_histogram,omitempty"`
655
+ EventsIntervalSummary bool `bson:"events_interval_summary,omitempty" json:"events_interval_summary,omitempty" yaml:"events_interval_summary,omitempty"`
656
+ EventsCollapsed bool `bson:"events_collapsed,omitempty" json:"events_collapsed,omitempty" yaml:"events_collapsed,omitempty"`
657
+ ConvertGzip bool `bson:"convert_gzip,omitempty" json:"convert_gzip,omitempty" yaml:"convert_gzip,omitempty"`
658
+ ConvertBSON2FTDC bool `bson:"convert_bson_to_ftdc,omitempty" json:"convert_bson_to_ftdc,omitempty" yaml:"convert_bson_to_ftdc,omitempty"`
659
+ ConvertJSON2FTDC bool `bson:"convert_json_to_ftdc" json:"convert_json_to_ftdc" yaml:"convert_json_to_ftdc"`
660
+ ConvertCSV2FTDC bool `bson:"convert_csv_to_ftdc" json:"convert_csv_to_ftdc" yaml:"convert_csv_to_ftdc"`
661
+ }
662
+
663
+ // poplarTestMetrics was copied from
664
+ // https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L124
665
+ type poplarTestMetrics struct {
666
+ Name string `bson:"name" json:"name" yaml:"name"`
667
+ Version int `bson:"version,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
668
+ Type string `bson:"type" json:"type" yaml:"type"`
669
+ Value interface {} `bson:"value" json:"value" yaml:"value"`
670
+ }
0 commit comments