#!/bin/bash

set -e

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

# set ETCD_ARCH for ETCD_UNSUPPORTED_ARCH 
# see https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/supported-platform.md#current-support 
ETCD_ARCH= 
DEB_HOST_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH) 
case $DEB_HOST_ARCH in 
	arm64|s390x)
		ETCD_ARCH=$DEB_HOST_ARCH
		;; 
	armel|armhf)
		ETCD_ARCH=arm 
		;; 
	i386) 
		ETCD_ARCH=386 
		;; 
esac 

ETCD_UNSUPPORTED_ARCH=$ETCD_ARCH ./test/behaviour_test.sh
exit $?
