Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: 2 Analyzer 1 Agent #1223

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
CI: 2 Analyzer 1 Agent
nplanel committed Oct 10, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit baa8759f00a36cff67d666f3b153d00f7be5b1ce
92 changes: 85 additions & 7 deletions scripts/ci/run-vagrant-tests.sh
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ fi

cd contrib/vagrant

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

@@ -46,6 +46,32 @@ function vagrant_cleanup {
}
[ "$KEEP_RESOURCES" = "true" ] || trap vagrant_cleanup EXIT

function run_functional_tests {
vagrant ssh-config > vagrant-ssh-config
scp -F vagrant-ssh-config $root/tests/functionals agent1:
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 $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 analyzer2 agent1; do
echo "===== ausearch AVC on $a ======"
vagrant ssh $a -c 'sudo ausearch -m avc -r' || true
done
fi
rm -f vagrant-ssh-config
}

function install_skydive_selinux_enforcing {
cat <<'EOF' | vagrant ssh $1 -- bash -
sudo setenforce 1
@@ -75,20 +101,72 @@ do
install_skydive_selinux_enforcing agent1
fi

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

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 $ANALYZER_COUNT ]; 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

echo "================== external functional test suite ==============================="
$root/scripts/test.sh -a 192.168.50.10:8082 -e `expr $AGENT_COUNT + $ANALYZER_COUNT` -c -i
$root/scripts/test.sh -a 192.168.50.10:8082 -e $AGENT_COUNT -c -i

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 ==============================="
run_functional_tests
fi

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