#!/bin/bash

# Run standalone unit tests in the same manner done by upstream.

set -eux

sed -i 's/# enable-debug-command no/enable-debug-command local/' /etc/valkey/valkey.conf
sed -i 's/# enable-module-command no/enable-module-command local/' /etc/valkey/valkey.conf
sed -i 's/mymaster/valkey-py-test/g' /etc/valkey/sentinel.conf

systemctl restart valkey-server
systemctl restart valkey-sentinel

./util/wait-for-it.sh localhost:6379

for py in $(py3versions --supported)
do
    ${py} -m pytest -W always -m 'onlynoncluster' --sentinels 'localhost:26379'
done
