Make TelemetryService testable (#276)

* Make TelemetryService testable

Timer is extracted for better testability of telemetryservice.

Divided TelemetryService to internal part that:
- contains business logic
- does not contain timer
- and therefore testable

and external part that:
- does not contain business logic
- contains timer to send analytics every 10 seconds for all participants.
- does not need tests

* Add Test_AnalyticsSentWhenParticipantLeaves

* Fix test
This commit is contained in:
Artur Shellunts
2021-12-28 12:54:56 +01:00
committed by GitHub
parent 3108ef22ad
commit 2209edce20
6 changed files with 229 additions and 123 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/pion/rtcp"
)
func (t *telemetryService) NewStatsInterceptorFactory(participantID, identity string) *StatsInterceptorFactory {
func (t *telemetryServiceInternal) NewStatsInterceptorFactory(participantID, identity string) *StatsInterceptorFactory {
return &StatsInterceptorFactory{
t: t,
participantID: participantID,