-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix (dot/telemetry): NoTelemetry flag stops telemetry #1660
Changes from 12 commits
5b92145
6c08d7c
38b5d31
94dabef
be29889
cd69148
bd4000f
adf20bb
c1bfb11
2839806
6aa4400
d48501b
6e89d83
160bb40
a25deac
204dfe9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,39 @@ func TestListenerConcurrency(t *testing.T) { | |
} | ||
} | ||
|
||
func TestDisableInstance(t *testing.T) { | ||
const qty = 1000 | ||
var wg sync.WaitGroup | ||
wg.Add(qty) | ||
|
||
resultCh = make(chan []byte) | ||
for i := 0; i < qty; i++ { | ||
if i == qty/2 { | ||
GetInstance().Initialise(false) | ||
} | ||
go func() { | ||
bh := common.MustHexToHash("0x07b749b6e20fd5f1159153a2e790235018621dd06072a62bcd25e8576f6ff5e6") | ||
GetInstance().SendMessage(NewBlockImportTM(&bh, big.NewInt(2), "NetworkInitialSync")) | ||
wg.Done() | ||
}() | ||
} | ||
wg.Wait() | ||
counter := 0 | ||
tk := time.NewTicker(time.Second * 2) | ||
main: | ||
for { | ||
select { | ||
case <-tk.C: | ||
break main | ||
case <-resultCh: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When this case will be reached? The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TestMain starts a web server that has a HandleFunc listen which reads websocket messages and passes them to |
||
counter++ | ||
} | ||
} | ||
tk.Stop() | ||
|
||
require.LessOrEqual(t, counter, qty/2) | ||
} | ||
|
||
// TestInfiniteListener starts loop that print out data received on websocket ws://localhost:8001/ | ||
// this can be useful to see what data is sent to telemetry server | ||
func TestInfiniteListener(t *testing.T) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the private method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to control who can start the listener, this is called when the instance is created.