Remove wait group for onboarding complete code (#19580)

* remove wait group for onboarding complete code
Этот коммит содержится в:
Nathaniel Allred
2022-02-17 10:05:37 -06:00
коммит произвёл GitHub
родитель 59a34bfc53
Коммит a3c1507563
2 изменённых файлов: 23 добавлений и 14 удалений

Просмотреть файл

@@ -869,17 +869,32 @@ func TestCompleteOnboarding(t *testing.T) {
CheckOKStatus(t, resp)
})
installedPlugins, resp, err := th.SystemAdminClient.GetPlugins()
require.NoError(t, err)
CheckOKStatus(t, resp)
received := make(chan struct{})
found := false
for _, p := range installedPlugins.Active {
if p.Id == "testplugin2" {
found = true
go func() {
for {
installedPlugins, resp, err := th.SystemAdminClient.GetPlugins()
if err != nil || resp.StatusCode != http.StatusOK {
time.Sleep(500 * time.Millisecond)
continue
}
for _, p := range installedPlugins.Active {
if p.Id == "testplugin2" {
received <- struct{}{}
return
}
}
time.Sleep(500 * time.Millisecond)
}
}()
select {
case <-received:
break
case <-time.After(15 * time.Second):
require.Fail(t, "timed out waiting testplugin2 to be installed and enabled ")
}
require.True(t, found, "testplugin2 should have been installed and enabled")
})
}