mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-28028] api4/channel_test: increase timeout fir the case if event is not recieved in time (#15344)
* api4/channel_test: skip if event is not recieved in time * api4/channel: TestConvertChannelToPrivate increase timeout Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
c8c7fe0f4f
commit
ed2cd0e552
@@ -1714,27 +1714,19 @@ func TestConvertChannelToPrivate(t *testing.T) {
|
||||
CheckOKStatus(t, resp)
|
||||
require.Equal(t, model.CHANNEL_PRIVATE, rchannel.Type, "channel should be converted from public to private")
|
||||
|
||||
stop := make(chan bool)
|
||||
eventHit := false
|
||||
timeout := time.After(10 * time.Second)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case resp := <-WebSocketClient.EventChannel:
|
||||
if resp.EventType() == model.WEBSOCKET_EVENT_CHANNEL_CONVERTED && resp.GetData()["channel_id"].(string) == publicChannel2.Id {
|
||||
eventHit = true
|
||||
}
|
||||
case <-stop:
|
||||
for {
|
||||
select {
|
||||
case resp := <-WebSocketClient.EventChannel:
|
||||
if resp.EventType() == model.WEBSOCKET_EVENT_CHANNEL_CONVERTED && resp.GetData()["channel_id"].(string) == publicChannel2.Id {
|
||||
return
|
||||
}
|
||||
case <-timeout:
|
||||
require.Fail(t, "timed out waiting for channel_converted event")
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
time.Sleep(400 * time.Millisecond)
|
||||
|
||||
stop <- true
|
||||
|
||||
require.True(t, eventHit, "did not receive channel_converted event")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateChannelPrivacy(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user