From b22f224ad3da7a3e100285610318f9516e069482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20Filast=C3=B2?= Date: Wed, 5 Feb 2020 18:26:16 +0100 Subject: [PATCH] Fix bug in measurement_file_path collision We were writing to the same measurement_file_path for a given test group, because we were using a different filename only in the case of a many input test, but not in the case of many test_names inside of a given test group. --- internal/database/actions.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/database/actions.go b/internal/database/actions.go index 074c4bf..b83b3d4 100644 --- a/internal/database/actions.go +++ b/internal/database/actions.go @@ -176,7 +176,10 @@ func DeleteResult(sess sqlbuilder.Database, resultID int64) error { // CreateMeasurement writes the measurement to the database a returns a pointer // to the Measurement func CreateMeasurement(sess sqlbuilder.Database, reportID sql.NullString, testName string, measurementDir string, idx int, resultID int64, urlID sql.NullInt64) (*Measurement, error) { - msmtFilePath := filepath.Join(measurementDir, fmt.Sprintf("msmt-%d.json", idx)) + // TODO we should look into generating this file path in a more robust way. + // If there are two identical test_names in the same test group there is + // going to be a clash of test_name + msmtFilePath := filepath.Join(measurementDir, fmt.Sprintf("msmt-%s-%d.json", testName, idx)) msmt := Measurement{ ReportID: reportID, TestName: testName,