Skip to content

Commit

Permalink
CI: 2 Analyzer 1 Agent
Browse files Browse the repository at this point in the history
  • Loading branch information
nplanel committed Mar 30, 2019
1 parent 3042e09 commit 00d2fcf
Showing 1 changed file with 52 additions and 8 deletions.
60 changes: 52 additions & 8 deletions scripts/ci/run-vagrant-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fi

cd contrib/vagrant

export ANALYZER_COUNT=1
export ANALYZER_COUNT=2
export AGENT_COUNT=1
export SKYDIVE_RELEASE=master

Expand All @@ -54,6 +54,7 @@ function run_functional_tests {
rsync -av -e 'ssh -F vagrant-ssh-config' $root/tests/pcaptraces agent1:
AGENT1_IP=$(vagrant ssh-config agent1 | grep HostName | awk '{print $2}')
ANALYZER1_IP=$(vagrant ssh-config analyzer1 | grep HostName | awk '{print $2}')
ANALYZER2_IP=$(vagrant ssh-config analyzer2 | grep HostName | awk '{print $2}')

vagrant ssh agent1 -c 'for i in $(find /proc/sys/net/bridge/ -type f) ; do echo 0 | sudo tee $i ; done'
vagrant ssh agent1 -c 'sudo iptables -F ; sudo iptables -P FORWARD ACCEPT'
Expand All @@ -62,10 +63,10 @@ function run_functional_tests {
OPT="-nooftests"
fi

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"
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"

if [ "$mode" = "package" ]; then
for a in analyzer1 agent1; do
for a in analyzer1 analyzer2 agent1; do
echo "===== ausearch AVC on $a ======"
vagrant ssh $a -c 'sudo ausearch -m avc -r' || true
done
Expand Down Expand Up @@ -102,17 +103,47 @@ do
install_skydive_selinux_enforcing agent1
fi

vagrant ssh analyzer1 -- sudo ntpdate fr.pool.ntp.org
vagrant ssh agent1 -- sudo ntpdate fr.pool.ntp.org
for a in analyzer1 analyzer2 agent1; do
echo "$a"
vagrant ssh $a -- sudo ntpdate fr.pool.ntp.org
done

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

vagrant ssh analyzer1 -- sudo cat /etc/skydive/skydive.yml
for a in analyzer1 analyzer2 agent1; do
echo "$a"
vagrant ssh $a -- sudo cat /etc/skydive/skydive.yml
done

vagrant ssh analyzer1 -- sudo journalctl -n 100 -u skydive-analyzer
vagrant ssh analyzer2 -- sudo journalctl -n 100 -u skydive-analyzer
vagrant ssh agent1 -- sudo journalctl -n 100 -u skydive-agent

for a in analyzer1 analyzer2; do
echo "api/status $a"
vagrant ssh $a -- curl http://localhost:8082/api/status
done
echo "api/status agent1"
out=$(mktemp)
n=0
count=10
while [ "$n" -ne 2 ]; do
vagrant ssh agent1 -- curl http://localhost:8081/api/status | tee "$out"
n=$(cat "$out" | jq ".Analyzers | length")
count=$[count-1]
if [ $count -eq 0 ]; then
exit 1
fi
sleep 0.5
done
rm -f "$out"

if [ "$mode" = "container" ]; then
install_skydive_from_docker_image analyzer1
install_skydive_from_docker_image agent1
for a in analyzer1 analyzer2 agent1; do
echo "$a"
install_skydive_from_docker_image $a
done
fi

vagrant ssh analyzer1 -- sudo journalctl -n 200 -u skydive-analyzer
Expand All @@ -124,6 +155,19 @@ do
vagrant ssh analyzer1 -- sudo journalctl -n 200 -u skydive-analyzer
vagrant ssh agent1 -- sudo journalctl -n 200 -u skydive-agent

if [ "$mode" = "package" ]; then
for a in analyzer1 analyzer2 agent1; do
echo "$a"
install_skydive_selinux_enforcing $a
done
fi

echo "================== gremlin test ==============================="
for a in analyzer1 analyzer2; do
echo "$a"
vagrant ssh $a -c 'set -e; skydive client query "g.V()"'
done

if [ "$mode" != "container" ]; then
sleep 10
echo "================== functional test suite ==============================="
Expand Down

0 comments on commit 00d2fcf

Please sign in to comment.