Skip to content

Commit a9848e8

Browse files
committed
CI: 2 Analyzer 1 Agent
1 parent c2ae62a commit a9848e8

File tree

1 file changed

+52
-8
lines changed

1 file changed

+52
-8
lines changed

scripts/ci/run-vagrant-tests.sh

Lines changed: 52 additions & 8 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,6 +54,7 @@ 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'
@@ -62,10 +63,10 @@ function run_functional_tests {
6263
OPT="-nooftests"
6364
fi
6465

65-
vagrant ssh agent1 -c "AGENT1_IP=$AGENT1_IP SKYDIVE_ANALYZERS=\"$ANALYZER1_IP:8082\" sudo -E ./functionals -analyzer.listen $ANALYZER1_IP:8082 -agenttestsonly -test.v $OPT"
66+
vagrant ssh agent1 -c "AGENT1_IP=$AGENT1_IP SKYDIVE_ANALYZERS=\"$ANALYZER1_IP:8082 $ANALYZER2_IP:8082\" sudo -E ./functionals -analyzer.listen 0.0.0.0:8082 -agenttestsonly -test.v $OPT"
6667

6768
if [ "$mode" = "package" ]; then
68-
for a in analyzer1 agent1; do
69+
for a in analyzer1 analyzer2 agent1; do
6970
echo "===== ausearch AVC on $a ======"
7071
vagrant ssh $a -c 'sudo ausearch -m avc -r' || true
7172
done
@@ -102,17 +103,47 @@ do
102103
install_skydive_selinux_enforcing agent1
103104
fi
104105

105-
vagrant ssh analyzer1 -- sudo ntpdate fr.pool.ntp.org
106-
vagrant ssh agent1 -- sudo ntpdate fr.pool.ntp.org
106+
for a in analyzer1 analyzer2 agent1; do
107+
echo "$a"
108+
vagrant ssh $a -- sudo ntpdate fr.pool.ntp.org
109+
done
107110

108111
export ANSIBLE_EXTRA_CONFIG='{"agent":{"metadata":{"mydict":{"value":123},"myarrays":{"integers":[1,2,3],"bools":[true,true],"strings":["dog","cat","frog"]}}}}'
109112
DEPLOYMENT_MODE=$mode vagrant provision
110113

111-
vagrant ssh analyzer1 -- sudo cat /etc/skydive/skydive.yml
114+
for a in analyzer1 analyzer2 agent1; do
115+
echo "$a"
116+
vagrant ssh $a -- sudo cat /etc/skydive/skydive.yml
117+
done
118+
119+
vagrant ssh analyzer1 -- sudo journalctl -n 100 -u skydive-analyzer
120+
vagrant ssh analyzer2 -- sudo journalctl -n 100 -u skydive-analyzer
121+
vagrant ssh agent1 -- sudo journalctl -n 100 -u skydive-agent
122+
123+
for a in analyzer1 analyzer2; do
124+
echo "api/status $a"
125+
vagrant ssh $a -- curl http://localhost:8082/api/status
126+
done
127+
echo "api/status agent1"
128+
out=$(mktemp)
129+
n=0
130+
count=10
131+
while [ "$n" -ne 2 ]; do
132+
vagrant ssh agent1 -- curl http://localhost:8081/api/status | tee "$out"
133+
n=$(cat "$out" | jq ".Analyzers | length")
134+
count=$[count-1]
135+
if [ $count -eq 0 ]; then
136+
exit 1
137+
fi
138+
sleep 0.5
139+
done
140+
rm -f "$out"
112141

113142
if [ "$mode" = "container" ]; then
114-
install_skydive_from_docker_image analyzer1
115-
install_skydive_from_docker_image agent1
143+
for a in analyzer1 analyzer2 agent1; do
144+
echo "$a"
145+
install_skydive_from_docker_image $a
146+
done
116147
fi
117148

118149
vagrant ssh analyzer1 -- sudo journalctl -n 200 -u skydive-analyzer
@@ -124,6 +155,19 @@ do
124155
vagrant ssh analyzer1 -- sudo journalctl -n 200 -u skydive-analyzer
125156
vagrant ssh agent1 -- sudo journalctl -n 200 -u skydive-agent
126157

158+
if [ "$mode" = "package" ]; then
159+
for a in analyzer1 analyzer2 agent1; do
160+
echo "$a"
161+
install_skydive_selinux_enforcing $a
162+
done
163+
fi
164+
165+
echo "================== gremlin test ==============================="
166+
for a in analyzer1 analyzer2; do
167+
echo "$a"
168+
vagrant ssh $a -c 'set -e; skydive client query "g.V()"'
169+
done
170+
127171
if [ "$mode" != "container" ]; then
128172
sleep 10
129173
echo "================== functional test suite ==============================="

0 commit comments

Comments
 (0)