#!/bin/bash

set -eux

# ensure no etcd server is running (ignore errors to support running without systemd)
service etcd stop || :

# convince the etcd go library to run on all architectures
DEB_HOST_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
case $DEB_HOST_ARCH in
    arm64|s390x) export ETCD_UNSUPPORTED_ARCH=$DEB_HOST_ARCH ;;
    armel|armhf) export ETCD_UNSUPPORTED_ARCH=arm ;;
    i386) export ETCD_UNSUPPORTED_ARCH=386 ;;
esac

# run the actual test script
test/$1.sh
