@@ -5,6 +5,14 @@ import (
5
5
"time"
6
6
)
7
7
8
+ func future () time.Time {
9
+ return time .Now ().Add (1 * time .Hour )
10
+ }
11
+
12
+ func past () time.Time {
13
+ return time .Now ().Add (- 1 * time .Hour )
14
+ }
15
+
8
16
func TestNewClusterAgeFilter (t * testing.T ) {
9
17
type testCase struct {
10
18
chB time.Time
@@ -15,7 +23,16 @@ func TestNewClusterAgeFilter(t *testing.T) {
15
23
}
16
24
17
25
testCases := []testCase {
18
- testCase {chB : time .Now (), chA : time .Now (), crB : time .Now ().Add (1 * time .Hour ), crA : time .Now (), err : true },
26
+ // checked in time test cases
27
+ testCase {chB : time .Now (), chA : time .Now (), crB : future (), crA : time .Now (), err : true },
28
+ testCase {chB : time .Now (), chA : future (), crB : future (), crA : time .Now (), err : true },
29
+ testCase {chB : past (), chA : time .Now (), crB : future (), crA : time .Now (), err : true },
30
+ testCase {chB : future (), chA : time .Now (), crB : future (), crA : time .Now (), err : false },
31
+ // create time test cases
32
+ testCase {chB : future (), chA : time .Now (), crB : time .Now (), crA : time .Now (), err : true },
33
+ testCase {chB : future (), chA : time .Now (), crB : time .Now (), crA : future (), err : true },
34
+ testCase {chB : future (), chA : time .Now (), crB : past (), crA : time .Now (), err : true },
35
+ testCase {chB : future (), chA : time .Now (), crB : time .Now (), crA : past (), err : false },
19
36
}
20
37
21
38
for i , testCase := range testCases {
0 commit comments