[MM-53195] services/telemetry: regen client config right after assigning diagnostic ID to platform (#23773)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
58a7679daa
Коммит
0904be43f8
@@ -381,6 +381,13 @@ func (ps *PlatformService) ShutdownConfig() error {
|
||||
|
||||
func (ps *PlatformService) SetTelemetryId(id string) {
|
||||
ps.telemetryId = id
|
||||
|
||||
ps.PostTelemetryIdHook()
|
||||
}
|
||||
|
||||
// PostTelemetryIdHook triggers necessary events to propagate telemtery ID
|
||||
func (ps *PlatformService) PostTelemetryIdHook() {
|
||||
ps.regenerateClientConfig()
|
||||
}
|
||||
|
||||
func (ps *PlatformService) SetLogger(logger *mlog.Logger) {
|
||||
|
||||
@@ -168,3 +168,19 @@ func TestShutdown(t *testing.T) {
|
||||
require.Zero(t, atomic.LoadInt32(&th.Service.goroutineCount))
|
||||
})
|
||||
}
|
||||
|
||||
func TestSetTelemetryId(t *testing.T) {
|
||||
t.Run("ensure client config is regenerated after setting the telemetry id", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
clientConfig := th.Service.LimitedClientConfig()
|
||||
require.Empty(t, clientConfig["DiagnosticId"])
|
||||
|
||||
id := model.NewId()
|
||||
th.Service.SetTelemetryId(id)
|
||||
|
||||
clientConfig = th.Service.LimitedClientConfig()
|
||||
require.Equal(t, clientConfig["DiagnosticId"], id)
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user