Skip to content

Commit

Permalink
use timestamp string for TestTime
Browse files Browse the repository at this point in the history
  • Loading branch information
Taowyoo committed May 16, 2024
1 parent 3ca6432 commit a2a3f36
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/loadTest.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func loadTest(name string, setup setupFunc, test testFunc, cleanup cleanupFunc)
}

testSummary := &TestSummary{
TestTime: testTime,
TestTime: testTime.Format(time.RFC3339),
Config: &testConfig,
Result: &testResult,
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/load_test_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

type TestSummary struct {
TestTime time.Time `json:"test_time" yaml:"test_time"`
TestTime string `json:"test_time" yaml:"test_time"` // ISO 8601 timestamp string
Config *TestConfig `json:"config" yaml:"config"`
Result *TestResult `json:"result" yaml:"result"`
}
Expand Down Expand Up @@ -170,7 +170,7 @@ type TestSummaryPlainWriter interface {

func (ts *TestSummary) WritePlain(w io.Writer) error {
fmt.Fprintf(w, "-----BEGIN TEST SUMMARY-----\n")
fmt.Fprintf(w, "TestTime: %v\n", ts.TestTime.Format(time.RFC3339))
fmt.Fprintf(w, "TestTime: %v\n", ts.TestTime)
ts.Config.Print(w)
fmt.Fprintf(w, "\n")
ts.Result.Print(w)
Expand Down
2 changes: 1 addition & 1 deletion cmd/load_test_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestWriteTestSummaryToJson(t *testing.T) {

func newTestSummary() *TestSummary {
loadTest := &TestSummary{
TestTime: time.Unix(1715032508, 0),
TestTime: time.Now().Format(time.RFC3339),
Config: &TestConfig{
TestName: "Test1",
ServerName: "localhost",
Expand Down

0 comments on commit a2a3f36

Please sign in to comment.