Skip to content

Commit 09fd19e

Browse files
committed
Make setNow private.
1 parent 2e982f2 commit 09fd19e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cmd/outline-ss-server/metrics_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ type fakeAddr string
3838
func (a fakeAddr) String() string { return string(a) }
3939
func (a fakeAddr) Network() string { return "" }
4040

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) {
4343
Now = func() time.Time {
4444
return t
4545
}
@@ -95,7 +95,7 @@ func TestIPKeyActivityPerKeyDoesNotReportUnlessAllConnectionsClosed(t *testing.T
9595
}
9696

9797
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))
9999
reg := prometheus.NewPedanticRegistry()
100100
ssMetrics := newPrometheusOutlineMetrics(nil, reg)
101101
ipInfo := ipinfo.IPInfo{CountryCode: "US", ASN: 100}
@@ -106,7 +106,7 @@ func TestIPKeyActivityPerKey(t *testing.T) {
106106

107107
ssMetrics.AddAuthenticatedTCPConnection(ipInfo, fakeAddr("127.0.0.1:9"), accessKey)
108108
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))
110110
ssMetrics.AddClosedTCPConnection(ipInfo, fakeAddr("127.0.0.1:9"), accessKey, status, data, duration)
111111
ssMetrics.AddClosedTCPConnection(ipInfo, fakeAddr("127.0.0.1:1"), accessKey, status, data, duration)
112112

@@ -124,15 +124,15 @@ func TestIPKeyActivityPerKey(t *testing.T) {
124124
}
125125

126126
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))
128128
reg := prometheus.NewPedanticRegistry()
129129
ssMetrics := newPrometheusOutlineMetrics(&noopMap{}, reg)
130130
ipInfo := ipinfo.IPInfo{CountryCode: "US", ASN: 100}
131131
addr := fakeAddr("127.0.0.1:9")
132132
accessKey := "key-1"
133133

134134
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))
136136
ssMetrics.AddClosedTCPConnection(ipInfo, addr, accessKey, "OK", metrics.ProxyMetrics{}, time.Minute)
137137

138138
expected := strings.NewReader(`

0 commit comments

Comments
 (0)