Skip to content

Commit c8a5794

Browse files
remove peek
1 parent 9ba7eb7 commit c8a5794

File tree

1 file changed

+13
-32
lines changed

1 file changed

+13
-32
lines changed

t/stream/xrpc/downstream.t

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,7 @@ timeout
5555

5656

5757

58-
=== TEST 3: read with peek (peeked data > read)
59-
--- stream_server_config
60-
preread_by_lua_block {
61-
local ffi = require("ffi")
62-
local sk = require("resty.apisix.stream.xrpc.socket").downstream.socket()
63-
sk:settimeout(5)
64-
sk:peek(11)
65-
local p = assert(sk:read(9))
66-
ngx.say(ffi.string(p, 9))
67-
ngx.exit(200)
68-
}
69-
proxy_pass 127.0.0.1:1990;
70-
--- stream_request
71-
hello world
72-
--- stream_response
73-
hello wor
74-
75-
76-
77-
=== TEST 4: read over buffer
58+
=== TEST 3: read over buffer
7859
--- stream_server_config
7960
content_by_lua_block {
8061
local ffi = require("ffi")
@@ -91,7 +72,7 @@ hello wor
9172

9273

9374

94-
=== TEST 5: read over buffer in the middle
75+
=== TEST 4: read over buffer in the middle
9576
--- stream_server_config
9677
content_by_lua_block {
9778
local ffi = require("ffi")
@@ -124,7 +105,7 @@ stream lua tcp socket allocate new new buf of size 4608
124105

125106

126107

127-
=== TEST 6: read & move
108+
=== TEST 5: read & move
128109
--- stream_config
129110
server {
130111
listen 1995;
@@ -167,7 +148,7 @@ hello world
167148

168149

169150

170-
=== TEST 7: multiple moves
151+
=== TEST 6: multiple moves
171152
--- stream_config
172153
server {
173154
listen 1995;
@@ -200,7 +181,7 @@ hello world
200181

201182

202183

203-
=== TEST 8: multiple moves + read over buffer in the middle
184+
=== TEST 7: multiple moves + read over buffer in the middle
204185
--- stream_config
205186
server {
206187
listen 1995;
@@ -240,7 +221,7 @@ stream lua tcp socket allocate new new buf of size 144
240221

241222

242223

243-
=== TEST 9: drain & move
224+
=== TEST 8: drain & move
244225
--- stream_config
245226
server {
246227
listen 1995;
@@ -283,7 +264,7 @@ hello world
283264

284265

285266

286-
=== TEST 10: read & drain & move & reset_read_buf
267+
=== TEST 9: read & drain & move & reset_read_buf
287268
--- stream_config
288269
server {
289270
listen 1995;
@@ -318,7 +299,7 @@ hello world
318299

319300

320301

321-
=== TEST 11: move & reset_read_buf + read over buffer in the middle
302+
=== TEST 10: move & reset_read_buf + read over buffer in the middle
322303
--- stream_config
323304
server {
324305
listen 1995;
@@ -356,7 +337,7 @@ hello world
356337

357338

358339

359-
=== TEST 12: read_line
340+
=== TEST 11: read_line
360341
--- stream_server_config
361342
content_by_lua_block {
362343
local ffi = require("ffi")
@@ -379,7 +360,7 @@ hello world
379360

380361

381362

382-
=== TEST 13: read_line, bad `\r\n`
363+
=== TEST 12: read_line, bad `\r\n`
383364
--- stream_server_config
384365
content_by_lua_block {
385366
local ffi = require("ffi")
@@ -402,7 +383,7 @@ hello world
402383

403384

404385

405-
=== TEST 14: read_line, no `\r\n`
386+
=== TEST 13: read_line, no `\r\n`
406387
--- stream_server_config
407388
content_by_lua_block {
408389
local ffi = require("ffi")
@@ -427,7 +408,7 @@ socket read timed out
427408

428409

429410

430-
=== TEST 15: read_line within len
411+
=== TEST 14: read_line within len
431412
--- stream_server_config
432413
content_by_lua_block {
433414
local ffi = require("ffi")
@@ -450,7 +431,7 @@ socket read timed out
450431

451432

452433

453-
=== TEST 16: read_line within len, no `\r\n`
434+
=== TEST 15: read_line within len, no `\r\n`
454435
--- stream_server_config
455436
content_by_lua_block {
456437
local ffi = require("ffi")

0 commit comments

Comments
 (0)