Skip to content

Commit

Permalink
Fix environment variable passing to system environment tests (elastic…
Browse files Browse the repository at this point in the history
…#3235)

Currently system tests with environment were still skipped.

* Fix flaky filebeat tests
* Fix flaky module tests
* Always rebuild dashboards. Reason is that during tests it is possible that it was previously built for a different architecture.
  • Loading branch information
ruflin authored and Steffen Siering committed Dec 23, 2016
1 parent 605ae3e commit 452787d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ BUILD_DIR=build
COVERAGE_DIR=${BUILD_DIR}/coverage
BEATS=packetbeat filebeat winlogbeat metricbeat heartbeat
PROJECTS=libbeat ${BEATS}
PROJECTS_ENV=libbeat metricbeat
PROJECTS_ENV=libbeat filebeat metricbeat
SNAPSHOT?=yes

# Runs complete testsuites (unit, system, integration) for all beats with coverage and race detection.
Expand Down
7 changes: 7 additions & 0 deletions filebeat/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ services:
- ${PWD}/..:/go/src/github.com/elastic/beats/
command: make
entrypoint: /go/src/github.com/elastic/beats/filebeat/docker-entrypoint.sh

# Overload Kibana and Logstash as not needed here
kibana:
image: alpine:latest

logstash:
image: alpine:latest
3 changes: 3 additions & 0 deletions filebeat/tests/system/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def run_on_file(self, module, fileset, test_file):
stderr=subprocess.STDOUT,
bufsize=0).wait()

# Make sure index exists
self.wait_until(lambda: self.es.indices.exists(index_name))

self.es.indices.refresh(index=index_name)
res = self.es.search(index=index_name,
body={"query": {"match_all": {}}})
Expand Down
4 changes: 2 additions & 2 deletions filebeat/tests/system/test_registrar.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,12 @@ def test_clean_inactive(self):
# Wait until states are removed from prospectors
self.wait_until(
lambda: self.log_contains_count(
"State removed for") == 4,
"State removed for") >= 3,
max_timeout=15)

filebeat.check_kill_and_wait()

# Check that the first to files were removed from the registry
# Check that the first two files were removed from the registry
data = self.get_registry()
assert len(data) == 1

Expand Down
2 changes: 1 addition & 1 deletion libbeat/dashboards/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

BEAT?=

import_dasboards: import_dashboards.go
import_dashboards:
go build -ldflags "-X main.beat=${BEAT}" -o import_dashboards
4 changes: 2 additions & 2 deletions libbeat/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ system-tests: ${BEATNAME}.test prepare-tests python-env ${ES_BEATS}/libbeat/dash
# Runs the system tests
.PHONY: system-tests-environment
system-tests-environment: prepare-tests build-image
INTEGRATION_TESTS=1 ${DOCKER_COMPOSE} run beat make system-tests
${DOCKER_COMPOSE} run -e INTEGRATION_TESTS=1 beat make system-tests

# Runs system tests without coverage reports and in parallel
.PHONY: fast-system-tests
Expand Down Expand Up @@ -291,7 +291,7 @@ export-dashboards: python-env update
. ${PYTHON_ENV}/bin/activate && python ${ES_BEATS}/dev-tools/export_dashboards.py --url ${ES_URL} --dir $(shell pwd)/_meta/kibana --regex ${BEATNAME}-*

${ES_BEATS}/libbeat/dashboards/import_dashboards:
$(MAKE) -C ${ES_BEATS}/libbeat/dashboards import_dasboards
$(MAKE) -C ${ES_BEATS}/libbeat/dashboards import_dashboards

.PHONY: import-dashboards
import-dashboards: update ${ES_BEATS}/libbeat/dashboards/import_dashboards
Expand Down

0 comments on commit 452787d

Please sign in to comment.