refactor: move bytecounting conn in bytecounter pkg (#392)
* refactor: move bytecounting conn in bytecounter pkg This enables other pieces of code to request bytecounting without depending on netx or on the perverse using-the-context-to-configure- byte-counting mechanism. Also occurred when working on https://github.com/ooni/probe/issues/1687 * fix: add missing docs
This commit is contained in:
parent
23bc261464
commit
760ac905d6
4 changed files with 104 additions and 33 deletions
|
|
@ -48,9 +48,15 @@ func TestByteCounterNormalUsage(t *testing.T) {
|
|||
if err := dorequest(ctx, "http://facebook.com"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if exp.Received.Load() <= 0 {
|
||||
t.Fatal("experiment should have received some bytes")
|
||||
}
|
||||
if sess.Received.Load() <= exp.Received.Load() {
|
||||
t.Fatal("session should have received more than experiment")
|
||||
}
|
||||
if exp.Sent.Load() <= 0 {
|
||||
t.Fatal("experiment should have sent some bytes")
|
||||
}
|
||||
if sess.Sent.Load() <= exp.Sent.Load() {
|
||||
t.Fatal("session should have sent more than experiment")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue