(t *testing.T)
| 88 | } |
| 89 | |
| 90 | func TestConnectionLargeWrite(t *testing.T) { |
| 91 | // ci machine don't have 4GB memory, so skip test |
| 92 | t.Skipf("skip large write test for ci job") |
| 93 | totalSize := 1024 * 1024 * 1024 * 4 |
| 94 | var wg sync.WaitGroup |
| 95 | wg.Add(1) |
| 96 | opts := &options{} |
| 97 | opts.onRequest = func(ctx context.Context, connection Connection) error { |
| 98 | if connection.Reader().Len() < totalSize { |
| 99 | return nil |
| 100 | } |
| 101 | _, err := connection.Reader().Next(totalSize) |
| 102 | MustNil(t, err) |
| 103 | err = connection.Reader().Release() |
| 104 | MustNil(t, err) |
| 105 | wg.Done() |
| 106 | return nil |
| 107 | } |
| 108 | |
| 109 | r, w := GetSysFdPairs() |
| 110 | rconn, wconn := &connection{}, &connection{} |
| 111 | rconn.init(&netFD{fd: r}, opts) |
| 112 | wconn.init(&netFD{fd: w}, opts) |
| 113 | |
| 114 | msg := make([]byte, totalSize/4) |
| 115 | for i := 0; i < 4; i++ { |
| 116 | _, err := wconn.Writer().WriteBinary(msg) |
| 117 | MustNil(t, err) |
| 118 | } |
| 119 | wg.Wait() |
| 120 | |
| 121 | rconn.Close() |
| 122 | } |
| 123 | |
| 124 | func TestConnectionRead(t *testing.T) { |
| 125 | r, w := GetSysFdPairs() |
nothing calls this directly
no test coverage detected
searching dependent graphs…