forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Packetbeat, mysql proto, add \r to trim SQLs captured from app runnin… (
elastic#5572) * Packetbeat, mysql proto, add \r to trim SQLs captured from app running on Windows server. Otherwise method extracted including \r, which is problem. e.g. "SELECT\r\n\t1" * Packetbeat, test case for windows lineending * Packetbeat, changelog for windows lineending
- Loading branch information
Showing
4 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
24 changes: 24 additions & 0 deletions
24
packetbeat/tests/system/test_0064_mysql_windows_lineending.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from packetbeat import BaseTest | ||
|
||
""" | ||
Tests for MySQL messages with Windows line ending \\r\\n. | ||
""" | ||
|
||
|
||
class Test(BaseTest): | ||
|
||
def test_rn(self): | ||
""" | ||
Should get method "SELECT" instead of "SELECT\\r" | ||
""" | ||
self.render_config_template( | ||
mysql_ports=[3306], | ||
) | ||
self.run_packetbeat(pcap="mysql_windows_lineending.pcap") | ||
|
||
objs = self.read_output() | ||
assert len(objs) == 1 | ||
o = objs[0] | ||
|
||
assert o["status"] == "OK" | ||
assert o["method"] == "SELECT" |