|
9 | 9 | "github.com/stretchr/testify/require" |
10 | 10 | "go.uber.org/atomic" |
11 | 11 |
|
12 | | - "github.com/cortexproject/cortex/pkg/util/api" |
13 | 12 | "github.com/cortexproject/cortex/pkg/util/test" |
14 | 13 | ) |
15 | 14 |
|
@@ -58,56 +57,6 @@ func TestDurationWithPositiveJitter_ZeroInputDuration(t *testing.T) { |
58 | 57 | assert.Equal(t, time.Duration(0), DurationWithPositiveJitter(time.Duration(0), 0.5)) |
59 | 58 | } |
60 | 59 |
|
61 | | -func TestParseTime(t *testing.T) { |
62 | | - var tests = []struct { |
63 | | - input string |
64 | | - fail bool |
65 | | - result time.Time |
66 | | - }{ |
67 | | - { |
68 | | - input: "", |
69 | | - fail: true, |
70 | | - }, { |
71 | | - input: "abc", |
72 | | - fail: true, |
73 | | - }, { |
74 | | - input: "30s", |
75 | | - fail: true, |
76 | | - }, { |
77 | | - input: "123", |
78 | | - result: time.Unix(123, 0), |
79 | | - }, { |
80 | | - input: "123.123", |
81 | | - result: time.Unix(123, 123000000), |
82 | | - }, { |
83 | | - input: "2015-06-03T13:21:58.555Z", |
84 | | - result: time.Unix(1433337718, 555*time.Millisecond.Nanoseconds()), |
85 | | - }, { |
86 | | - input: "2015-06-03T14:21:58.555+01:00", |
87 | | - result: time.Unix(1433337718, 555*time.Millisecond.Nanoseconds()), |
88 | | - }, { |
89 | | - // Test nanosecond rounding. |
90 | | - input: "2015-06-03T13:21:58.56789Z", |
91 | | - result: time.Unix(1433337718, 567*1e6), |
92 | | - }, { |
93 | | - // Test float rounding. |
94 | | - input: "1543578564.705", |
95 | | - result: time.Unix(1543578564, 705*1e6), |
96 | | - }, |
97 | | - } |
98 | | - |
99 | | - for _, test := range tests { |
100 | | - ts, err := api.ParseTime(test.input) |
101 | | - if test.fail { |
102 | | - require.Error(t, err) |
103 | | - continue |
104 | | - } |
105 | | - |
106 | | - require.NoError(t, err) |
107 | | - assert.Equal(t, TimeToMillis(test.result), ts) |
108 | | - } |
109 | | -} |
110 | | - |
111 | 60 | func TestNewDisableableTicker_Enabled(t *testing.T) { |
112 | 61 | stop, ch := NewDisableableTicker(10 * time.Millisecond) |
113 | 62 | defer stop() |
|
0 commit comments