Skip to content

Commit

Permalink
rpk: Add self-test start/end times to status
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Blafford committed Jun 5, 2024
1 parent c28ca49 commit 979ea1e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/go/rpk/pkg/adminapi/api_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type SelfTestNodeResult struct {
TestName string `json:"name"`
TestInfo string `json:"info"`
TestType string `json:"test_type"`
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
Duration uint `json:"duration"`
Warning *string `json:"warning,omitempty"`
Error *string `json:"error,omitempty"`
Expand Down
18 changes: 15 additions & 3 deletions src/go/rpk/pkg/cli/cluster/selftest/selftest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ func TestSelfTestResults(t *testing.T) {
"name": "unittesting",
"info": "golang unit tests",
"test_type": "disk",
"start_time": 1717615532,
"end_time": 1717615693,
"duration": 50000,
"warning": "Mild transient issue detected"
}
Expand All @@ -167,6 +169,8 @@ func TestSelfTestResults(t *testing.T) {
"name": "unittesting",
"info": "golang unit tests",
"test_type": "disk",
"start_time": 1717615532,
"end_time": 1717615693,
"duration": 50000,
"error": "Unexpected exception detected"
}
Expand All @@ -182,6 +186,8 @@ func TestSelfTestResults(t *testing.T) {
"name": "unittesting",
"info": "golang unit tests",
"test_type": "disk",
"start_time": 1717615532,
"end_time": 1717615693,
"duration": 50000,
"error": "Unexpected exception detected"
}
Expand All @@ -200,7 +206,9 @@ func TestSelfTestResults(t *testing.T) {
{"TYPE", "disk"},
{"TEST ID", "8272-3843-38c8-381f"},
{"TIMEOUTS", "1"},
{"DURATION", "50000ms"},
{"START TIME", "Wed Jun 5 15:25:32 2024"},
{"END TIME", "Wed Jun 5 15:28:13 2024"},
{"AVG DURATION", "50000ms"},
{"IOPS", "2222 req/sec"},
{"THROUGHPUT", "907.5KiB/sec"},
{"WARNING", "Mild transient issue detected"},
Expand All @@ -214,7 +222,9 @@ func TestSelfTestResults(t *testing.T) {
[]string{"TYPE", "disk"},
[]string{"TEST ID", "8272-3843-38c8-381f"},
[]string{"TIMEOUTS", "55"},
[]string{"DURATION", "50000ms"},
[]string{"START TIME", "Wed Jun 5 15:25:32 2024"},
[]string{"END TIME", "Wed Jun 5 15:28:13 2024"},
[]string{"AVG DURATION", "50000ms"},
[]string{"ERROR", "Unexpected exception detected"},
[]string{""},
},
Expand All @@ -224,7 +234,9 @@ func TestSelfTestResults(t *testing.T) {
[]string{"TYPE", "disk"},
[]string{"TEST ID", "8272-3843-38c8-381f"},
[]string{"TIMEOUTS", "78"},
[]string{"DURATION", "50000ms"},
[]string{"START TIME", "Wed Jun 5 15:25:32 2024"},
[]string{"END TIME", "Wed Jun 5 15:28:13 2024"},
[]string{"AVG DURATION", "50000ms"},
[]string{"ERROR", "Unexpected exception detected"},
[]string{""},
},
Expand Down
5 changes: 4 additions & 1 deletion src/go/rpk/pkg/cli/cluster/selftest/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"fmt"
"sort"
"strings"
"time"

"github.com/redpanda-data/redpanda/src/go/rpk/pkg/adminapi"
"github.com/redpanda-data/redpanda/src/go/rpk/pkg/config"
Expand Down Expand Up @@ -155,7 +156,9 @@ func makeReportTable(report adminapi.SelfTestNodeReport) [][]string {
table = append(table, []string{"TYPE", sr.TestType})
table = append(table, []string{"TEST ID", sr.TestID})
table = append(table, []string{"TIMEOUTS", fmt.Sprintf("%d", sr.Timeouts)})
table = append(table, []string{"DURATION", fmt.Sprintf("%dms", sr.Duration)})
table = append(table, []string{"START TIME", time.Unix(sr.StartTime, 0).Format(time.ANSIC)})
table = append(table, []string{"END TIME", time.Unix(sr.EndTime, 0).Format(time.ANSIC)})
table = append(table, []string{"AVG DURATION", fmt.Sprintf("%dms", sr.Duration)})
if sr.Warning != nil {
table = append(table, []string{"WARNING", *sr.Warning})
}
Expand Down

0 comments on commit 979ea1e

Please sign in to comment.