mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Updated tests to check new stats
Updated the tests to pass with our new snowflake-ips-total stat
This commit is contained in:
parent
8f2dc3563b
commit
908cf3fc64
1 changed files with 7 additions and 7 deletions
|
@ -419,7 +419,7 @@ func TestMetrics(t *testing.T) {
|
||||||
<-done
|
<-done
|
||||||
|
|
||||||
ctx.metrics.printMetrics()
|
ctx.metrics.printMetrics()
|
||||||
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips CA=1\nsnowflake-idle-count 8\nclient-denied-count 0\nclient-snowflake-match-count 0\n")
|
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips CA=1\nsnowflake-ips-total 1\nsnowflake-idle-count 8\nclient-denied-count 0\nclient-snowflake-match-count 0\n")
|
||||||
})
|
})
|
||||||
|
|
||||||
//Test addition of client failures
|
//Test addition of client failures
|
||||||
|
@ -432,13 +432,13 @@ func TestMetrics(t *testing.T) {
|
||||||
clientOffers(ctx, w, r)
|
clientOffers(ctx, w, r)
|
||||||
|
|
||||||
ctx.metrics.printMetrics()
|
ctx.metrics.printMetrics()
|
||||||
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-idle-count 0\nclient-denied-count 8\nclient-snowflake-match-count 0\n")
|
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-ips-total 0\nsnowflake-idle-count 0\nclient-denied-count 8\nclient-snowflake-match-count 0\n")
|
||||||
|
|
||||||
// Test reset
|
// Test reset
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
ctx.metrics.zeroMetrics()
|
ctx.metrics.zeroMetrics()
|
||||||
ctx.metrics.printMetrics()
|
ctx.metrics.printMetrics()
|
||||||
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-idle-count 0\nclient-denied-count 0\nclient-snowflake-match-count 0\n")
|
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-ips-total 0\nsnowflake-idle-count 0\nclient-denied-count 0\nclient-snowflake-match-count 0\n")
|
||||||
})
|
})
|
||||||
//Test addition of client matches
|
//Test addition of client matches
|
||||||
Convey("for client-proxy match", func() {
|
Convey("for client-proxy match", func() {
|
||||||
|
@ -459,7 +459,7 @@ func TestMetrics(t *testing.T) {
|
||||||
<-done
|
<-done
|
||||||
|
|
||||||
ctx.metrics.printMetrics()
|
ctx.metrics.printMetrics()
|
||||||
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-idle-count 0\nclient-denied-count 0\nclient-snowflake-match-count 8\n")
|
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-ips-total 0\nsnowflake-idle-count 0\nclient-denied-count 0\nclient-snowflake-match-count 8\n")
|
||||||
})
|
})
|
||||||
//Test rounding boundary
|
//Test rounding boundary
|
||||||
Convey("binning boundary", func() {
|
Convey("binning boundary", func() {
|
||||||
|
@ -478,12 +478,12 @@ func TestMetrics(t *testing.T) {
|
||||||
clientOffers(ctx, w, r)
|
clientOffers(ctx, w, r)
|
||||||
|
|
||||||
ctx.metrics.printMetrics()
|
ctx.metrics.printMetrics()
|
||||||
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-idle-count 0\nclient-denied-count 8\nclient-snowflake-match-count 0\n")
|
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-ips-total 0\nsnowflake-idle-count 0\nclient-denied-count 8\nclient-snowflake-match-count 0\n")
|
||||||
|
|
||||||
clientOffers(ctx, w, r)
|
clientOffers(ctx, w, r)
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
ctx.metrics.printMetrics()
|
ctx.metrics.printMetrics()
|
||||||
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-idle-count 0\nclient-denied-count 16\nclient-snowflake-match-count 0\n")
|
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips \nsnowflake-ips-total 0\nsnowflake-idle-count 0\nclient-denied-count 16\nclient-snowflake-match-count 0\n")
|
||||||
})
|
})
|
||||||
|
|
||||||
//Test unique ip
|
//Test unique ip
|
||||||
|
@ -515,7 +515,7 @@ func TestMetrics(t *testing.T) {
|
||||||
<-done
|
<-done
|
||||||
|
|
||||||
ctx.metrics.printMetrics()
|
ctx.metrics.printMetrics()
|
||||||
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips CA=1\nsnowflake-idle-count 8\nclient-denied-count 0\nclient-snowflake-match-count 0\n")
|
So(buf.String(), ShouldResemble, "snowflake-stats-end "+time.Now().UTC().Format("2006-01-02 15:04:05")+" (86400 s)\nsnowflake-ips CA=1\nsnowflake-ips-total 1\nsnowflake-idle-count 8\nclient-denied-count 0\nclient-snowflake-match-count 0\n")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue