Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions report/src/components/BenchmarkRunDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ interface ProvidedProps {
}

const BenchmarkRunDetails = ({ benchmarkRuns }: ProvidedProps) => {
if (benchmarkRuns.length === 0) {
return null;
}

return (
<div className="flex flex-col gap-4 mb-8">
<h1 className="text-2xl font-bold">{benchmarkRuns[0].testName}</h1>
Expand Down
2 changes: 0 additions & 2 deletions report/src/pages/RunComparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useTestMetadata, useMultipleDataSeries } from "../utils/useDataSeries";
import { DataSeries } from "../types";
import { useParams } from "react-router-dom";
import Navbar from "../components/Navbar";
import BenchmarkRunDetails from "../components/BenchmarkRunDetails";

function RunComparison() {
let { benchmarkRunId } = useParams();
Expand Down Expand Up @@ -74,7 +73,6 @@ function RunComparison() {
<Navbar urlPrefix="/run-comparison" />
<div className="flex flex-col w-full flex-grow">
<div className="p-8">
<BenchmarkRunDetails benchmarkRuns={benchmarkRuns.runs} />
<ChartSelector
onChangeDataQuery={setSelection}
benchmarkRuns={benchmarkRuns}
Expand Down
2 changes: 0 additions & 2 deletions report/src/pages/RunIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { groupBy } from "lodash";
import RunListFilter from "../components/RunListFilter";
import { useParams } from "react-router-dom";
import Navbar from "../components/Navbar";
import BenchmarkRunDetails from "../components/BenchmarkRunDetails";

const RunIndexInner = ({ benchmarkRuns }: { benchmarkRuns: BenchmarkRuns }) => {
const { benchmarkRunId } = useParams();
Expand Down Expand Up @@ -124,7 +123,6 @@ const RunIndexInner = ({ benchmarkRuns }: { benchmarkRuns: BenchmarkRuns }) => {
<Navbar />
<div className="flex flex-col w-full flex-grow">
<div className="overflow-x-auto p-8 pb-0 flex flex-col">
<BenchmarkRunDetails benchmarkRuns={benchmarkRuns.runs} />
<RunListFilter
benchmarkRunId={benchmarkRunId}
filterOptions={filterOptions}
Expand Down
11 changes: 7 additions & 4 deletions runner/benchmark/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type TestPlan struct {
Thresholds *ThresholdConfig
}

func NewTestPlanFromConfig(c TestDefinition, testFileName string) (*TestPlan, error) {
testRuns, err := ResolveTestRunsFromMatrix(c, testFileName)
func NewTestPlanFromConfig(c TestDefinition, testFileName string, config *BenchmarkConfig) (*TestPlan, error) {
testRuns, err := ResolveTestRunsFromMatrix(c, testFileName, config)
if err != nil {
return nil, err
}
Expand All @@ -44,7 +44,7 @@ func NewTestPlanFromConfig(c TestDefinition, testFileName string) (*TestPlan, er
}

// ResolveTestRunsFromMatrix constructs a new ParamsMatrix from a config.
func ResolveTestRunsFromMatrix(c TestDefinition, testFileName string) ([]TestRun, error) {
func ResolveTestRunsFromMatrix(c TestDefinition, testFileName string, config *BenchmarkConfig) ([]TestRun, error) {
seenParams := make(map[string]bool)

// Multiple payloads can run in a single benchmark.
Expand Down Expand Up @@ -105,7 +105,10 @@ func ResolveTestRunsFromMatrix(c TestDefinition, testFileName string) ([]TestRun
return nil, err
}

params.BenchmarkRunID = id
params.Name = config.Name
if config.Description != nil {
params.Description = *config.Description
}

if c.Tags != nil {
params.Tags = *c.Tags
Expand Down
15 changes: 14 additions & 1 deletion runner/benchmark/matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,14 @@ func TestResolveTestRunsFromMatrix(t *testing.T) {
},
}

config := &benchmark.BenchmarkConfig{
Name: "test",
Description: stringPtr("test"),
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := benchmark.ResolveTestRunsFromMatrix(tt.config, "")
got, err := benchmark.ResolveTestRunsFromMatrix(tt.config, "", config)

if tt.wantErr {
require.Error(t, err)
Expand All @@ -134,11 +139,19 @@ func TestResolveTestRunsFromMatrix(t *testing.T) {
tt.want[i].OutputDir = ""
tt.want[i].Params.BenchmarkRunID = ""
tt.want[i].ID = ""
tt.want[i].Name = "test"
tt.want[i].Description = "test"
tt.want[i].Params.Name = "test"
tt.want[i].Params.Description = "test"
}
for i := range got {
got[i].OutputDir = ""
got[i].Params.BenchmarkRunID = ""
got[i].ID = ""
got[i].Name = "test"
got[i].Description = "test"
got[i].Params.Name = "test"
got[i].Params.Description = "test"
}
require.ElementsMatch(t, tt.want, got)
})
Expand Down
2 changes: 1 addition & 1 deletion runner/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ func (s *service) Run(ctx context.Context) error {
var testPlans []benchmark.TestPlan

for _, c := range config.Benchmarks {
testPlan, err := benchmark.NewTestPlanFromConfig(c, s.config.ConfigPath())
testPlan, err := benchmark.NewTestPlanFromConfig(c, s.config.ConfigPath(), config)
if err != nil {
return errors.Wrap(err, "failed to create params matrix")
}
Expand Down