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

Format code, change tests/system to avoid breakage #4459

Merged
merged 1 commit into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 8 additions & 8 deletions beater/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,33 +448,33 @@ func TestTLSSettings(t *testing.T) {
"ConfiguredToRequired": {
config: map[string]interface{}{"ssl": map[string]interface{}{
"client_authentication": "required",
"key": "../../testdata/tls/key.pem",
"certificate": "../../testdata/tls/certificate.pem",
"key": "../../testdata/tls/key.pem",
"certificate": "../../testdata/tls/certificate.pem",
}},
tls: &tlscommon.ServerConfig{ClientAuth: 4, Certificate: testdataCertificateConfig},
},
"ConfiguredToOptional": {
config: map[string]interface{}{"ssl": map[string]interface{}{
"client_authentication": "optional",
"key": "../../testdata/tls/key.pem",
"certificate": "../../testdata/tls/certificate.pem",
"key": "../../testdata/tls/key.pem",
"certificate": "../../testdata/tls/certificate.pem",
}},
tls: &tlscommon.ServerConfig{ClientAuth: 3, Certificate: testdataCertificateConfig},
},
"DefaultRequiredByCA": {
config: map[string]interface{}{"ssl": map[string]interface{}{
"certificate_authorities": []string{"../../testdata/tls/ca.crt.pem"},
"key": "../../testdata/tls/key.pem",
"certificate": "../../testdata/tls/certificate.pem",
"key": "../../testdata/tls/key.pem",
"certificate": "../../testdata/tls/certificate.pem",
}},
tls: &tlscommon.ServerConfig{ClientAuth: 4, Certificate: testdataCertificateConfig},
},
"ConfiguredWithCA": {
config: map[string]interface{}{"ssl": map[string]interface{}{
"client_authentication": "none",
"certificate_authorities": []string{"../../testdata/tls/ca.crt.pem"},
"key": "../../testdata/tls/key.pem",
"certificate": "../../testdata/tls/certificate.pem",
"key": "../../testdata/tls/key.pem",
"certificate": "../../testdata/tls/certificate.pem",
}},
tls: &tlscommon.ServerConfig{ClientAuth: 0, Certificate: testdataCertificateConfig},
},
Expand Down
3 changes: 2 additions & 1 deletion model/modeldecoder/generator/jsonschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import (
"reflect"
"testing"

"github.com/elastic/apm-server/model/modeldecoder/generator/generatortest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/xeipuuv/gojsonschema"

"github.com/elastic/apm-server/model/modeldecoder/generator/generatortest"
)

type testcase struct {
Expand Down
13 changes: 7 additions & 6 deletions script/generate_notice.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

# Additional third-party, non-source code dependencies, to add to the CSV output.
additional_third_party_deps = [{
"name": "Red Hat Universal Base Image minimal",
"version": "8",
"url": "https://catalog.redhat.com/software/containers/ubi8/ubi-minimal/5c359a62bed8bd75a2c3fba8",
"license": "Custom;https://www.redhat.com/licenses/EULA_Red_Hat_Universal_Base_Image_English_20190422.pdf",
"sourceURL": "https://oss-dependencies.elastic.co/redhat/ubi/ubi-minimal-8-source.tar.gz",
"name": "Red Hat Universal Base Image minimal",
"version": "8",
"url": "https://catalog.redhat.com/software/containers/ubi8/ubi-minimal/5c359a62bed8bd75a2c3fba8",
"license": "Custom;https://www.redhat.com/licenses/EULA_Red_Hat_Universal_Base_Image_English_20190422.pdf",
"sourceURL": "https://oss-dependencies.elastic.co/redhat/ubi/ubi-minimal-8-source.tar.gz",
}]


def read_file(filename):
if not os.path.isfile(filename):
print("File not found {}".format(filename))
Expand Down Expand Up @@ -206,7 +207,7 @@ def get_url(modpath):
module.get("Version", ""),
module.get("Revision", ""),
license["license_summary"],
"" # source URL
"" # source URL
])

for dep in additional_third_party_deps:
Expand Down
7 changes: 1 addition & 6 deletions tests/system/apmserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
from elasticsearch import Elasticsearch, NotFoundError
import requests

# Add libbeat/tests/system to the import path.
output = subprocess.check_output(["go", "list", "-m", "-f", "{{.Path}} {{.Dir}}", "all"]).decode("utf-8")
beats_line = [line for line in output.splitlines() if line.startswith("github.com/elastic/beats/")][0]
beats_dir = beats_line.split(" ", 2)[1]
sys.path.append(os.path.join(beats_dir, 'libbeat', 'tests', 'system'))

import libbeat_paths
from beat.beat import INTEGRATION_TESTS, TestCase, TimeoutError
from helper import wait_until
from es_helper import cleanup, default_pipelines
Expand Down
9 changes: 9 additions & 0 deletions tests/system/libbeat_paths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os.path
import subprocess
import sys

# Add libbeat/tests/system to the import path.
output = subprocess.check_output(["go", "list", "-m", "-f", "{{.Path}} {{.Dir}}", "all"]).decode("utf-8")
beats_line = [line for line in output.splitlines() if line.startswith("github.com/elastic/beats/")][0]
beats_dir = beats_line.split(" ", 2)[1]
sys.path.append(os.path.join(beats_dir, 'libbeat', 'tests', 'system'))
3 changes: 1 addition & 2 deletions tests/system/test_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
import socket
import pytest
from requests.packages.urllib3.exceptions import SubjectAltNameWarning
requests.packages.urllib3.disable_warnings(SubjectAltNameWarning)

from apmserver import ServerBaseTest
from apmserver import TimeoutError, integration_test

INTEGRATION_TESTS = os.environ.get('INTEGRATION_TESTS', False)

requests.packages.urllib3.disable_warnings(SubjectAltNameWarning)

@integration_test
class TestSecureServerBaseTest(ServerBaseTest):
Expand Down
4 changes: 2 additions & 2 deletions x-pack/apm-server/aggregation/txmetrics/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestProcessTransformablesOverflow(t *testing.T) {
MaxTransactionGroups: 2,
MetricsInterval: time.Microsecond,
HDRHistogramSignificantFigures: 1,
Logger: logger,
Logger: logger,
})
require.NoError(t, err)

Expand Down Expand Up @@ -214,7 +214,7 @@ func TestAggregatorRunPublishErrors(t *testing.T) {
MaxTransactionGroups: 2,
MetricsInterval: 10 * time.Millisecond,
HDRHistogramSignificantFigures: 1,
Logger: logger,
Logger: logger,
})
require.NoError(t, err)

Expand Down