Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Totaltests bugfix #104

Merged
merged 6 commits into from
Mar 30, 2022
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
1 change: 1 addition & 0 deletions pkg/core/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ type TestSuitePayload struct {
Duration int `json:"duration"`
Status string `json:"status"`
Stats []TestProcessStats `json:"stats"`
TotalTests int `json:"totalTests"`
}

// TestProcessStats process stats associated with each test
Expand Down
28 changes: 15 additions & 13 deletions pkg/service/teststats/teststats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,27 +246,29 @@ func TestProcStats_appendStatsToTestSuites(t *testing.T) {
}{
{"Test appendStatsToTests",
args{[]core.TestSuitePayload{
{SuiteID: "testSuite1", StartTime: timeMap["tpast1"], EndTime: timeMap["tfuture1"]},
{SuiteID: "testSuite1", StartTime: timeMap["tpast1"], EndTime: timeMap["tfuture1"], TotalTests: 2},
},
[]*procfs.Stats{}},
"[{SuiteID:testSuite1 SuiteName: ParentSuiteID: BlocklistSource: Blocklisted:false StartTime:2021-02-22 16:23:01 +0000 UTC EndTime:2021-02-22 16:23:01 +0000 UTC Duration:0 Status: Stats:[]}]",
"[{SuiteID:testSuite1 SuiteName: ParentSuiteID: BlocklistSource: Blocklisted:false StartTime:2021-02-22 16:23:01 +0000 UTC EndTime:2021-02-22 16:23:01 +0000 UTC Duration:0 Status: Stats:[] TotalTests:2}]", // nolint
},

{"Test appendStatsToTests",
args{[]core.TestSuitePayload{
{
SuiteID: "testSuite2",
StartTime: timeMap["tpast1"],
Duration: 100,
EndTime: timeMap["tfuture1"],
Stats: []core.TestProcessStats{},
SuiteID: "testSuite2",
StartTime: timeMap["tpast1"],
Duration: 100,
EndTime: timeMap["tfuture1"],
Stats: []core.TestProcessStats{},
TotalTests: 3,
},
{
SuiteID: "testSuite3",
StartTime: timeMap["tpast2"],
Duration: 200,
EndTime: timeMap["tfuture2"],
Stats: []core.TestProcessStats{{Memory: 100, CPU: 25.4, Storage: 250, RecordTime: timeMap["tpast2"]}},
SuiteID: "testSuite3",
StartTime: timeMap["tpast2"],
Duration: 200,
EndTime: timeMap["tfuture2"],
Stats: []core.TestProcessStats{{Memory: 100, CPU: 25.4, Storage: 250, RecordTime: timeMap["tpast2"]}},
TotalTests: 5,
},
},
[]*procfs.Stats{
Expand Down Expand Up @@ -296,7 +298,7 @@ func TestProcStats_appendStatsToTestSuites(t *testing.T) {
},
},
},
"[{SuiteID:testSuite2 SuiteName: ParentSuiteID: BlocklistSource: Blocklisted:false StartTime:2021-02-22 16:23:01 +0000 UTC EndTime:2021-02-22 16:23:01.1 +0000 UTC Duration:100 Status: Stats:[{Memory:131 CPU:1.2 Storage:0 RecordTime:2021-02-22 16:23:01 +0000 UTC}]} {SuiteID:testSuite3 SuiteName: ParentSuiteID: BlocklistSource: Blocklisted:false StartTime:2021-02-22 16:22:05 +0000 UTC EndTime:2021-02-22 16:22:05.2 +0000 UTC Duration:200 Status: Stats:[{Memory:100 CPU:25.4 Storage:250 RecordTime:2021-02-22 16:22:05 +0000 UTC}]}]",
"[{SuiteID:testSuite2 SuiteName: ParentSuiteID: BlocklistSource: Blocklisted:false StartTime:2021-02-22 16:23:01 +0000 UTC EndTime:2021-02-22 16:23:01.1 +0000 UTC Duration:100 Status: Stats:[{Memory:131 CPU:1.2 Storage:0 RecordTime:2021-02-22 16:23:01 +0000 UTC}] TotalTests:3} {SuiteID:testSuite3 SuiteName: ParentSuiteID: BlocklistSource: Blocklisted:false StartTime:2021-02-22 16:22:05 +0000 UTC EndTime:2021-02-22 16:22:05.2 +0000 UTC Duration:200 Status: Stats:[{Memory:100 CPU:25.4 Storage:250 RecordTime:2021-02-22 16:22:05 +0000 UTC}] TotalTests:5}]", //nolint
},
}
for _, tt := range tests {
Expand Down