diff --git a/dev-tools/mage/fields.go b/dev-tools/mage/fields.go index a625465f52b..83158fbd0a4 100644 --- a/dev-tools/mage/fields.go +++ b/dev-tools/mage/fields.go @@ -18,6 +18,7 @@ package mage import ( + "os" "path/filepath" "github.com/magefile/mage/sh" @@ -40,7 +41,11 @@ func OSSBeatDir(path ...string) string { // Check if we need to correct ossDir because it's in x-pack. if parentDir := filepath.Base(filepath.Dir(ossDir)); parentDir == "x-pack" { - ossDir = filepath.Join(ossDir, "../..", BeatName) + // If the OSS version of the beat exists. + tmp := filepath.Join(ossDir, "../..", BeatName) + if _, err := os.Stat(tmp); !os.IsNotExist(err) { + ossDir = tmp + } } return filepath.Join(append([]string{ossDir}, path...)...) diff --git a/libbeat/scripts/Makefile b/libbeat/scripts/Makefile index 74f623fd32e..599c87c171c 100755 --- a/libbeat/scripts/Makefile +++ b/libbeat/scripts/Makefile @@ -213,7 +213,7 @@ system-tests-environment: prepare-tests build-image ${DOCKER_COMPOSE} run -e INTEGRATION_TESTS=1 -e TESTING_ENVIRONMENT=${TESTING_ENVIRONMENT} -e DOCKER_COMPOSE_PROJECT_NAME=${DOCKER_COMPOSE_PROJECT_NAME} beat make system-tests #This is a hack to run x-pack/filebeat module tests @XPACKBEAT="${ES_BEATS}/x-pack/${BEAT_NAME}" ; \ - if [ -e "$$XPACKBEAT/tests/system" ] ; then \ + if [ -e "$$XPACKBEAT/tests/system" ] && [ $(XPACK_ONLY) = false ]; then \ $(MAKE) -C ../x-pack/${BEAT_NAME} fields; \ ${DOCKER_COMPOSE} run -e INTEGRATION_TESTS=1 -e MODULES_PATH="../../x-pack/${BEAT_NAME}/module" -e TESTING_ENVIRONMENT=${TESTING_ENVIRONMENT} -e DOCKER_COMPOSE_PROJECT_NAME=${DOCKER_COMPOSE_PROJECT_NAME} beat make -C "$$XPACKBEAT" ${BEAT_NAME}.test system-tests ; \ $(MAKE) -C ../x-pack/${BEAT_NAME} fix-permissions; \