Skip to content
Permalink
Browse files

Fix Winlogbeat test by checking full hostname (elastic#3942)

The `computer_name` field in events is the full hostname, but the `win32api.GetComputerName` was returning the shortened netbios name. So the test fail on machines with longer hostnames.
(cherry picked from commit 5c6e623)
  • Loading branch information...
andrewkroh committed Apr 6, 2017
1 parent 3442d5b commit 8c7e4600479aaf78a2a4f0d222faa9ec1efb73b3
Showing with 3 additions and 1 deletion.
  1. +3 −1 winlogbeat/tests/system/winlogbeat.py
@@ -1,3 +1,5 @@
import os
import platform
import sys

if sys.platform.startswith("win"):
@@ -93,7 +95,7 @@ def read_events(self, config=None, expected_events=1):

def assert_common_fields(self, evt, msg=None, eventID=10, sid=None,
level="Information", extra=None):
assert evt["computer_name"].lower() == win32api.GetComputerName().lower()
assert evt["computer_name"].lower() == platform.node().lower()
assert "record_number" in evt
self.assertDictContainsSubset({
"event_id": eventID,

0 comments on commit 8c7e460

Please sign in to comment.
You can’t perform that action at this time.