@@ -38,8 +38,8 @@ type fakeAddr string
38
38
func (a fakeAddr ) String () string { return string (a ) }
39
39
func (a fakeAddr ) Network () string { return "" }
40
40
41
- // SetTime sets the processing clock to be t until changed.
42
- func SetNow (t time.Time ) {
41
+ // Sets the processing clock to be t until changed.
42
+ func setNow (t time.Time ) {
43
43
Now = func () time.Time {
44
44
return t
45
45
}
@@ -95,7 +95,7 @@ func TestIPKeyActivityPerKeyDoesNotReportUnlessAllConnectionsClosed(t *testing.T
95
95
}
96
96
97
97
func TestIPKeyActivityPerKey (t * testing.T ) {
98
- SetNow (time .Date (2010 , 1 , 2 , 3 , 4 , 5 , .0 , time .Local ))
98
+ setNow (time .Date (2010 , 1 , 2 , 3 , 4 , 5 , .0 , time .Local ))
99
99
reg := prometheus .NewPedanticRegistry ()
100
100
ssMetrics := newPrometheusOutlineMetrics (nil , reg )
101
101
ipInfo := ipinfo.IPInfo {CountryCode : "US" , ASN : 100 }
@@ -106,7 +106,7 @@ func TestIPKeyActivityPerKey(t *testing.T) {
106
106
107
107
ssMetrics .AddAuthenticatedTCPConnection (ipInfo , fakeAddr ("127.0.0.1:9" ), accessKey )
108
108
ssMetrics .AddAuthenticatedTCPConnection (ipInfo , fakeAddr ("127.0.0.1:1" ), accessKey )
109
- SetNow (time .Date (2010 , 1 , 2 , 3 , 4 , 20 , .0 , time .Local ))
109
+ setNow (time .Date (2010 , 1 , 2 , 3 , 4 , 20 , .0 , time .Local ))
110
110
ssMetrics .AddClosedTCPConnection (ipInfo , fakeAddr ("127.0.0.1:9" ), accessKey , status , data , duration )
111
111
ssMetrics .AddClosedTCPConnection (ipInfo , fakeAddr ("127.0.0.1:1" ), accessKey , status , data , duration )
112
112
@@ -124,15 +124,15 @@ func TestIPKeyActivityPerKey(t *testing.T) {
124
124
}
125
125
126
126
func TestIPKeyActivityPerLocation (t * testing.T ) {
127
- SetNow (time .Date (2010 , 1 , 2 , 3 , 4 , 5 , .0 , time .Local ))
127
+ setNow (time .Date (2010 , 1 , 2 , 3 , 4 , 5 , .0 , time .Local ))
128
128
reg := prometheus .NewPedanticRegistry ()
129
129
ssMetrics := newPrometheusOutlineMetrics (& noopMap {}, reg )
130
130
ipInfo := ipinfo.IPInfo {CountryCode : "US" , ASN : 100 }
131
131
addr := fakeAddr ("127.0.0.1:9" )
132
132
accessKey := "key-1"
133
133
134
134
ssMetrics .AddAuthenticatedTCPConnection (ipInfo , addr , accessKey )
135
- SetNow (time .Date (2010 , 1 , 2 , 3 , 4 , 10 , .0 , time .Local ))
135
+ setNow (time .Date (2010 , 1 , 2 , 3 , 4 , 10 , .0 , time .Local ))
136
136
ssMetrics .AddClosedTCPConnection (ipInfo , addr , accessKey , "OK" , metrics.ProxyMetrics {}, time .Minute )
137
137
138
138
expected := strings .NewReader (`
0 commit comments