-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy pathbeats_tests.sh
executable file
·77 lines (54 loc) · 2.14 KB
/
beats_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
set -euo pipefail
#=========================
# NOTE: This entire script is a temporary hack until we have buildkite set up on the beats repo.
# until then, we need some kind of serverless integration tests, hence this script, which just clones the beats repo,
# and runs the serverless integration suite against different beats
# After buildkite is set up on beats, this file/PR should be reverted.
#==========================
source .buildkite/scripts/common.sh
STACK_PROVISIONER="${1:-"serverless"}"
run_test_for_beat(){
export GOFLAGS='-buildvcs=false'
local beat_name=$1
#build
export WORKSPACE="/tmp/beats-build/beats/x-pack/${beat_name}"
pushd $WORKSPACE
whoami
ls -la
SNAPSHOT=true PLATFORMS=linux/amd64 PACKAGES=tar.gz,zip mage package
popd
#run
export AGENT_BUILD_DIR="/tmp/beats-build/beats/x-pack/${beat_name}/build/distributions"
export WORKSPACE=$(pwd)
set +e
TEST_INTEG_CLEAN_ON_EXIT=true TEST_PLATFORMS="linux/amd64" STACK_PROVISIONER="$STACK_PROVISIONER" SNAPSHOT=true mage integration:testBeatServerless $beat_name
TESTS_EXIT_STATUS=$?
set -e
return $TESTS_EXIT_STATUS
}
#run mage before setup, since this will install go and mage
#the setup scripts will do a few things that assume we're running out of elastic-agent and will break things for beats, so run before we do actual setup
mage -l
# mkdir -p build
# cd build
mkdir -p /tmp/beats-build
pushd /tmp/beats-build
git clone --depth=1 [email protected]:elastic/beats.git
popd
# export WORKSPACE=beats/x-pack/metricbeat
# SNAPSHOT=true PLATFORMS=linux/amd64,windows/amd64 PACKAGES=tar.gz,zip mage package
# cd ..
# export AGENT_BUILD_DIR=build/beats/x-pack/metricbeat/build/distributions
# export WORKSPACE=$(pwd)
# set +e
# TEST_INTEG_CLEAN_ON_EXIT=true TEST_PLATFORMS="linux/amd64" STACK_PROVISIONER="$STACK_PROVISIONER" SNAPSHOT=true mage integration:testBeatServerless metricbeat
# TESTS_EXIT_STATUS=$?
# set -e
# exit $TESTS_EXIT_STATUS
echo "testing metricbeat..."
run_test_for_beat metricbeat
echo "testing filebeat..."
run_test_for_beat filebeat
echo "testing auditbeat..."
run_test_for_beat auditbeat