From 6a677a5989237c80105156e879720fe867e137a3 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 4 Jan 2025 18:30:17 +0300 Subject: [PATCH] fixup time tests Signed-off-by: Vasiliy Tolstov --- util/time/duration_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/util/time/duration_test.go b/util/time/duration_test.go index af5f1434..97b3997e 100644 --- a/util/time/duration_test.go +++ b/util/time/duration_test.go @@ -35,11 +35,11 @@ func TestUnmarshalYAML(t *testing.T) { t.Fatalf("invalid duration %v != 10000000", v.TTL) } - err = yaml.Unmarshal([]byte(`{"ttl":"1y"}`), v) + err = yaml.Unmarshal([]byte(`{"ttl":"1d"}`), v) if err != nil { t.Fatal(err) - } else if *(v.TTL) != 31622400000000000 { - t.Fatalf("invalid duration %v != 31622400000000000", v.TTL) + } else if *(v.TTL) != 86400000000000 { + t.Fatalf("invalid duration %v != 86400000000000", *v.TTL) } } @@ -68,11 +68,11 @@ func TestUnmarshalJSON(t *testing.T) { t.Fatalf("invalid duration %v != 10000000", v.TTL) } - err = json.Unmarshal([]byte(`{"ttl":"1y"}`), v) + err = json.Unmarshal([]byte(`{"ttl":"1d"}`), v) if err != nil { t.Fatal(err) - } else if v.TTL != 31622400000000000 { - t.Fatalf("invalid duration %v != 31622400000000000", v.TTL) + } else if v.TTL != 86400000000000 { + t.Fatalf("invalid duration %v != 86400000000000", v.TTL) } } @@ -87,11 +87,11 @@ func TestParseDuration(t *testing.T) { if td.String() != "340h0m0s" { t.Fatalf("ParseDuration 14d != 340h0m0s : %s", td.String()) } - td, err = ParseDuration("1y") + td, err = ParseDuration("1d") if err != nil { t.Fatalf("ParseDuration error: %v", err) } - if td.String() != "8784h0m0s" { - t.Fatalf("ParseDuration 1y != 8784h0m0s : %s", td.String()) + if td.String() != "24h0m0s" { + t.Fatalf("ParseDuration 1d != 24h0m0s : %s", td.String()) } }