From 10bc2aa15b7d598f299fd32524a6393eb8d381cb Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 2 Jun 2025 16:42:58 -0600 Subject: [PATCH] lua/streaming: update tests for changes to output streaming Handle the stream data passed as arguments to the log function. --- tests/lua-output-streaming/streaming-http.lua | 6 +++--- tests/lua-output-streaming/streaming-tcp.lua | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/lua-output-streaming/streaming-http.lua b/tests/lua-output-streaming/streaming-http.lua index f105df39a..e998a7f8e 100644 --- a/tests/lua-output-streaming/streaming-http.lua +++ b/tests/lua-output-streaming/streaming-http.lua @@ -17,8 +17,8 @@ function log(args) f = flow.get() ts = f:timestring_legacy() ipver, srcip, dstip, proto, sp, dp = f:tuple() - data, data_open, data_close = SCStreamingBuffer() - logger.notice("called with data_open " .. tostring(data_open) .. " data_close " .. tostring(data_close)); + local stream = args["stream"] + logger.notice("called with data_open " .. tostring(stream["open"]) .. " data_close " .. tostring(stream["close"]) .. " to_server " .. tostring(stream["to_server"]) .. " to_client " .. tostring(stream["to_client"])); filename = filepath .. "/http-" .. proto .. "-" .. srcip .. "-" .. dstip .. "-" .. sp .. "-" .. dp file_mode = "a" @@ -27,7 +27,7 @@ function log(args) end file = assert(io.open(filename, file_mode)) - file:write (data) + file:write (stream["data"]) file:flush() file.close(file) end diff --git a/tests/lua-output-streaming/streaming-tcp.lua b/tests/lua-output-streaming/streaming-tcp.lua index 3cae85a0f..11ef65bac 100644 --- a/tests/lua-output-streaming/streaming-tcp.lua +++ b/tests/lua-output-streaming/streaming-tcp.lua @@ -17,16 +17,16 @@ function log(args) f = flow.get() ts = f:timestring_legacy() ipver, srcip, dstip, proto, sp, dp = f:tuple() - data, data_open, data_close = SCStreamingBuffer() + local stream = args["stream"] filename = filepath .. "/" .. proto .. "-" .. srcip .. "-" .. dstip .. "-" .. sp .. "-" .. dp file_mode = "a" - if (data_open == true) then + if (stream["open"] == true) then file_mode = "w" end file = assert(io.open(filename, file_mode)) - file:write (data) + file:write (stream["data"]) file:flush() file.close(file) end -- 2.47.2