Skip to content

Commit 384e4f4

Browse files
committed
CI: 2 Analyzer 1 Agent
1 parent 6628f9f commit 384e4f4

File tree

1 file changed

+43
-13
lines changed

1 file changed

+43
-13
lines changed

scripts/ci/run-vagrant-tests.sh

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fi
3434

3535
cd contrib/vagrant
3636

37-
export ANALYZER_COUNT=1
37+
export ANALYZER_COUNT=2
3838
export AGENT_COUNT=1
3939
export SKYDIVE_RELEASE=master
4040

@@ -54,17 +54,18 @@ function run_functional_tests {
5454
rsync -av -e 'ssh -F vagrant-ssh-config' $root/tests/pcaptraces agent1:
5555
AGENT1_IP=$(vagrant ssh-config agent1 | grep HostName | awk '{print $2}')
5656
ANALYZER1_IP=$(vagrant ssh-config analyzer1 | grep HostName | awk '{print $2}')
57+
ANALYZER2_IP=$(vagrant ssh-config analyzer2 | grep HostName | awk '{print $2}')
5758

5859
vagrant ssh agent1 -c 'for i in $(find /proc/sys/net/bridge/ -type f) ; do echo 0 | sudo tee $i ; done'
5960
vagrant ssh agent1 -c 'sudo iptables -F ; sudo iptables -P FORWARD ACCEPT'
6061

6162
if [ "$mode" = "container" ]; then
6263
OPT="-nooftests"
6364
fi
64-
vagrant ssh agent1 -c "AGENT1_IP=$AGENT1_IP SKYDIVE_ANALYZERS=\"$ANALYZER1_IP:8082\" sudo -E ./functionals -agenttestsonly -test.v $OPT"
65+
vagrant ssh agent1 -c "AGENT1_IP=$AGENT1_IP SKYDIVE_ANALYZERS=\"$ANALYZER1_IP:8082 $ANALYZER2_IP:8082\" sudo -E ./functionals -agenttestsonly -test.v $OPT"
6566

6667
if [ "$mode" = "package" ]; then
67-
for a in analyzer1 agent1; do
68+
for a in analyzer1 analyzer2 agent1; do
6869
echo "===== ausearch AVC on $a ======"
6970
vagrant ssh $a -c 'sudo ausearch -m avc -r' || true
7071
done
@@ -97,29 +98,58 @@ do
9798
DEPLOYMENT_MODE=$mode vagrant up --provision-with common
9899
DEPLOYMENT_MODE=$mode vagrant provision
99100

100-
vagrant ssh analyzer1 -- sudo ntpdate fr.pool.ntp.org
101-
vagrant ssh agent1 -- sudo ntpdate fr.pool.ntp.org
101+
for a in analyzer1 analyzer2 agent1; do
102+
echo "$a"
103+
vagrant ssh $a -- sudo ntpdate fr.pool.ntp.org
104+
done
102105

103-
vagrant ssh analyzer1 -- sudo cat /etc/skydive/skydive.yml
106+
for a in analyzer1 analyzer2 agent1; do
107+
echo "$a"
108+
vagrant ssh $a -- sudo cat /etc/skydive/skydive.yml
109+
done
104110

105111
vagrant ssh analyzer1 -- sudo journalctl -n 100 -u skydive-analyzer
112+
vagrant ssh analyzer2 -- sudo journalctl -n 100 -u skydive-analyzer
106113
vagrant ssh agent1 -- sudo journalctl -n 100 -u skydive-agent
107114

108-
echo "================== curl test ==============================="
109-
vagrant ssh analyzer1 -- curl http://localhost:8082
115+
for a in analyzer1 analyzer2; do
116+
echo "api/status $a"
117+
vagrant ssh $a -- curl http://localhost:8082/api/status
118+
done
119+
echo "api/status agent1"
120+
out=$(mktemp)
121+
n=0
122+
count=10
123+
while [ "$n" -ne 2 ]; do
124+
vagrant ssh agent1 -- curl http://localhost:8081/api/status | tee "$out"
125+
n=$(cat "$out" | jq ".Analyzers | length")
126+
count=$[count-1]
127+
if [ $count -eq 0 ]; then
128+
exit 1
129+
fi
130+
sleep 0.5
131+
done
132+
rm -f "$out"
110133

111134
if [ "$mode" = "container" ]; then
112-
install_skydive_from_docker_image analyzer1
113-
install_skydive_from_docker_image agent1
135+
for a in analyzer1 analyzer2 agent1; do
136+
echo "$a"
137+
install_skydive_from_docker_image $a
138+
done
114139
fi
115140

116141
if [ "$mode" = "package" ]; then
117-
install_skydive_selinux_enforcing analyzer1
118-
install_skydive_selinux_enforcing agent1
142+
for a in analyzer1 analyzer2 agent1; do
143+
echo "$a"
144+
install_skydive_selinux_enforcing $a
145+
done
119146
fi
120147

121148
echo "================== gremlin test ==============================="
122-
vagrant ssh analyzer1 -c 'set -e; skydive client query "g.V()"'
149+
for a in analyzer1 analyzer2; do
150+
echo "$a"
151+
vagrant ssh $a -c 'set -e; skydive client query "g.V()"'
152+
done
123153

124154
if [ "$mode" != "container" ]; then
125155
sleep 10

0 commit comments

Comments
 (0)