Skip to content

Commit

Permalink
[Auditbeat] Cherry-pick #9750 to 6.x: Fix/Skip Windows x-pack/auditbe…
Browse files Browse the repository at this point in the history
…at tests (#9755)

Cherry-pick of PR #9750 to 6.x branch. Original message: 

Addresses #9748 by skipping the `process` unit test on Windows, and changing the inheritance of `AuditbeatXPackTest` for system tests.
  • Loading branch information
Christoph Wurm authored Dec 21, 2018
1 parent e2701ba commit 93fd7b3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion metricbeat/tests/system/metricbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
import os

sys.path.append(os.path.join(os.path.dirname(__file__), '../../../libbeat/tests/system'))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../libbeat/tests/system')))

from beat.beat import TestCase

Expand Down
4 changes: 4 additions & 0 deletions x-pack/auditbeat/module/system/process/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
package process

import (
"runtime"
"testing"

"github.com/elastic/beats/auditbeat/core"
mbtest "github.com/elastic/beats/metricbeat/mb/testing"
)

func TestData(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("Fails on Windows - https://github.com/elastic/beats/issues/9748")
}
f := mbtest.NewReportingMetricSetV2(t, getConfig())
events, errs := mbtest.ReportingFetchV2(f)
if len(errs) > 0 {
Expand Down
11 changes: 7 additions & 4 deletions x-pack/auditbeat/tests/system/auditbeat_xpack.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import jinja2
import os
import sys

from auditbeat import BaseTest as AuditbeatTest
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../metricbeat/tests/system')))

from metricbeat import BaseTest as MetricbeatTest

class AuditbeatXPackTest(AuditbeatTest):

class AuditbeatXPackTest(MetricbeatTest):

@classmethod
def setUpClass(self):
self.beat_name = "auditbeat"
self.beat_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), "../../"))

super(AuditbeatTest, self).setUpClass()
super(MetricbeatTest, self).setUpClass()

def setUp(self):
super(AuditbeatTest, self).setUp()
super(MetricbeatTest, self).setUp()

# Hack to make jinja2 have the right paths
self.template_env = jinja2.Environment(
Expand Down
3 changes: 1 addition & 2 deletions x-pack/auditbeat/tests/system/test_metricsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import time
import unittest

sys.path.append(os.path.join(os.path.dirname(__file__), '../../../../auditbeat/tests/system'))

from auditbeat_xpack import *

COMMON_FIELDS = ["@timestamp", "host.name", "event.module", "event.dataset"]
Expand All @@ -24,6 +22,7 @@ def test_metricset_host(self):
self.check_metricset("system", "host", COMMON_FIELDS + fields, warnings_allowed=True)

@unittest.skipIf(sys.platform == "darwin" and os.geteuid != 0, "Requires root on macOS")
@unittest.skipIf(sys.platform == "win32", "Fails on Windows - https://github.com/elastic/beats/issues/9748")
def test_metricset_process(self):
"""
process metricset collects information about processes running on a system.
Expand Down

0 comments on commit 93fd7b3

Please sign in to comment.