(t *testing.T)
| 912 | } |
| 913 | |
| 914 | func TestWebsocket_SetReadDeadline(t *testing.T) { |
| 915 | type args struct { |
| 916 | wsConn WebsocketConn |
| 917 | } |
| 918 | cases := []struct { |
| 919 | name string |
| 920 | args args |
| 921 | result chainResult |
| 922 | }{ |
| 923 | { |
| 924 | name: "success", |
| 925 | args: args{ |
| 926 | wsConn: &mockWebsocketConn{}, |
| 927 | }, |
| 928 | result: success, |
| 929 | }, |
| 930 | { |
| 931 | name: "conn.SetReadDeadline error", |
| 932 | args: args{ |
| 933 | wsConn: &mockWebsocketConn{ |
| 934 | readDlError: errors.New("Failed to set read deadline"), |
| 935 | }, |
| 936 | }, |
| 937 | result: failure, |
| 938 | }, |
| 939 | } |
| 940 | for _, tc := range cases { |
| 941 | t.Run(tc.name, func(t *testing.T) { |
| 942 | reporter := newMockReporter(t) |
| 943 | chain := newChainWithDefaults("test", reporter) |
| 944 | config := newMockConfig(reporter) |
| 945 | |
| 946 | ws := newWebsocket(chain, config, tc.args.wsConn). |
| 947 | WithReadTimeout(time.Second) |
| 948 | |
| 949 | opChain := ws.chain.enter("test") |
| 950 | ws.setReadDeadline(opChain) |
| 951 | opChain.leave() |
| 952 | |
| 953 | ws.chain.assert(t, tc.result) |
| 954 | }) |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | func TestWebsocket_SetWriteDeadline(t *testing.T) { |
| 959 | type args struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…