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 Aug 2, 2018
1 parent b18f2d9 commit 041a469
Showing 1 changed file with 43 additions and 13 deletions.
56 changes: 43 additions & 13 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,17 +54,18 @@ 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'

if [ "$mode" = "container" ]; then
OPT="-nooftests"
fi
vagrant ssh agent1 -c "AGENT1_IP=$AGENT1_IP SKYDIVE_ANALYZERS=\"$ANALYZER1_IP:8082\" sudo -E ./functionals -agenttestsonly -test.v $OPT"
vagrant ssh agent1 -c "AGENT1_IP=$AGENT1_IP SKYDIVE_ANALYZERS=\"$ANALYZER1_IP:8082 $ANALYZER2_IP:8082\" sudo -E ./functionals -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 @@ -97,29 +98,58 @@ do
DEPLOYMENT_MODE=$mode vagrant up --provision-with common
DEPLOYMENT_MODE=$mode vagrant provision

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

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

echo "================== curl test ==============================="
vagrant ssh analyzer1 -- curl http://localhost:8082
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

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

echo "================== gremlin test ==============================="
vagrant ssh analyzer1 -c 'set -e; skydive client query "g.V()"'
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
Expand Down

0 comments on commit 041a469

Please sign in to comment.