Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup python paths in test runner configuration #20832

Merged
merged 6 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions auditbeat/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '../libbeat/tests/system'))
sys.path.append(os.path.join(os.path.dirname(__file__), '../metricbeat/tests/system'))
2 changes: 0 additions & 2 deletions auditbeat/tests/system/auditbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import sys
import tempfile

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

if os.name == "nt":
import win32file

Expand Down
4 changes: 4 additions & 0 deletions filebeat/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '../libbeat/tests/system'))
3 changes: 0 additions & 3 deletions filebeat/tests/system/filebeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import stat
import sys

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

from beat.beat import TestCase, TimeoutError, REGEXP_TYPE

default_registry_path = 'registry/filebeat'
Expand Down
1 change: 0 additions & 1 deletion generator/_templates/beat/{beat}/tests/system/{beat}.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import sys
sys.path.append('../../vendor/github.com/elastic/beats/libbeat/tests/system')
from beat.beat import TestCase


Expand Down
4 changes: 4 additions & 0 deletions heartbeat/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '../libbeat/tests/system'))
4 changes: 0 additions & 4 deletions heartbeat/tests/system/heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
import sys
import http.server
import threading

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

from beat.beat import TestCase
from time import sleep

Expand Down
4 changes: 4 additions & 0 deletions journalbeat/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '../libbeat/tests/system'))
1 change: 0 additions & 1 deletion journalbeat/tests/system/journalbeat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../../../libbeat/tests/system'))
from beat.beat import TestCase


Expand Down
5 changes: 5 additions & 0 deletions metricbeat/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '../libbeat/tests/system'))
sys.path.append(os.path.join(os.path.dirname(__file__), './tests/system'))
4 changes: 1 addition & 3 deletions metricbeat/module/aerospike/test_aerospike.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


class Test(metricbeat.BaseTest):

Expand Down
14 changes: 6 additions & 8 deletions metricbeat/module/apache/test_apache.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import metricbeat
import os
import unittest
import urllib.request
import urllib.error
import urllib.parse
import pytest
import time
import semver
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '../../tests/system'))
import metricbeat
import time
import unittest
import urllib.error
import urllib.parse
import urllib.request

APACHE_FIELDS = metricbeat.COMMON_FIELDS + ["apache"]

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/ceph/test_ceph.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import metricbeat
import os
import requests
import sys
import time
import unittest
from parameterized import parameterized

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


@metricbeat.parameterized_with_supported_versions
class Test(metricbeat.BaseTest):
Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/consul/test_consul.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import metricbeat
import os
import pytest
import sys
import unittest

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


CONSUL_FIELDS = metricbeat.COMMON_FIELDS + ["consul"]

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/couchbase/test_couchbase.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import metricbeat
import os
import sys
import unittest
from parameterized import parameterized

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


class Test(metricbeat.BaseTest):

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/couchdb/test_couchdb.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


class Test(metricbeat.BaseTest):

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/docker/test_docker.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


class Test(metricbeat.BaseTest):

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/dropwizard/test_dropwizard.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


@metricbeat.parameterized_with_supported_versions
class Test(metricbeat.BaseTest):
Expand Down
13 changes: 5 additions & 8 deletions metricbeat/module/elasticsearch/test_elasticsearch.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import json
import metricbeat
import os
import re
import semver
import sys
import os
import unittest
import urllib.request
import urllib.error
import urllib.parse
import json
import semver
import urllib.request
from elasticsearch import Elasticsearch, TransportError, client
from parameterized import parameterized

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

import metricbeat


class Test(metricbeat.BaseTest):

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/envoyproxy/test_envoyproxy.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


@metricbeat.parameterized_with_supported_versions
class Test(metricbeat.BaseTest):
Expand Down
7 changes: 2 additions & 5 deletions metricbeat/module/etcd/test_etcd.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import metricbeat
import os
import sys
import unittest
import time
import unittest
from parameterized import parameterized

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

import metricbeat


@metricbeat.parameterized_with_supported_versions
class Test(metricbeat.BaseTest):
Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/golang/test_golang.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


GOLANG_FIELDS = metricbeat.COMMON_FIELDS + ["golang"]

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/haproxy/test_haproxy.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


HAPROXY_FIELDS = metricbeat.COMMON_FIELDS + ["haproxy"]

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/http/test_http.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import metricbeat
import os
import requests
import sys
import time
import unittest

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


HTTP_FIELDS = metricbeat.COMMON_FIELDS + ["http"]

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/jolokia/test_jolokia.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import metricbeat
import os
import sys
import unittest
from parameterized import parameterized

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


class Test(metricbeat.BaseTest):

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/kafka/test_kafka.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import metricbeat
import os
import sys
import unittest
from parameterized import parameterized

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


@metricbeat.parameterized_with_supported_versions
class KafkaTest(metricbeat.BaseTest):
Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/kibana/test_kibana.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import metricbeat
import os
import semver
import sys
Expand All @@ -7,9 +8,6 @@
import urllib.parse
import urllib.request

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


class Test(metricbeat.BaseTest):

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/logstash/test_logstash.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import metricbeat
import os
import semver
import sys
Expand All @@ -8,9 +9,6 @@
import urllib.parse
import urllib.request

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


class Test(metricbeat.BaseTest):

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/memcached/test_memcached.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


class Test(metricbeat.BaseTest):

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/mongodb/test_mongodb.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import metricbeat
import os
import pytest
import sys
import unittest

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


MONGODB_FIELDS = metricbeat.COMMON_FIELDS + ["mongodb"]

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/munin/test_munin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


class Test(metricbeat.BaseTest):

Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/mysql/test_mysql.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import metricbeat
import os
import pytest
import sys
import unittest

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

MYSQL_FIELDS = metricbeat.COMMON_FIELDS + ["mysql"]

MYSQL_STATUS_FIELDS = ["clients", "cluster", "cpu", "keyspace", "memory",
Expand Down
5 changes: 1 addition & 4 deletions metricbeat/module/nats/test_nats.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import metricbeat
import os
import sys
import unittest

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


NATS_FIELDS = metricbeat.COMMON_FIELDS + ["nats"]


Expand Down
Loading