(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func TestWasmDialTimeout(t *testing.T) { |
| 41 | t.Parallel() |
| 42 | |
| 43 | ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) |
| 44 | defer cancel() |
| 45 | |
| 46 | beforeDial := time.Now() |
| 47 | _, _, err := websocket.Dial(ctx, "ws://example.com:9893", &websocket.DialOptions{ |
| 48 | Subprotocols: []string{"echo"}, |
| 49 | }) |
| 50 | assert.Error(t, err) |
| 51 | if time.Since(beforeDial) >= time.Second { |
| 52 | t.Fatal("wasm context dial timeout is not working", time.Since(beforeDial)) |
| 53 | } |
| 54 | } |