aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/sso-setup/start-dc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/tests/sso-setup/start-dc.sh')
-rwxr-xr-xapps/files_external/tests/sso-setup/start-dc.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/apps/files_external/tests/sso-setup/start-dc.sh b/apps/files_external/tests/sso-setup/start-dc.sh
new file mode 100755
index 00000000000..c08b49477b3
--- /dev/null
+++ b/apps/files_external/tests/sso-setup/start-dc.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+#
+# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+# SPDX-License-Identifier: AGPL-3.0-or-later
+#
+
+set -e
+
+function getContainerHealth {
+ docker inspect --format "{{.State.Health.Status}}" $1
+}
+
+function waitContainer {
+ while STATUS=$(getContainerHealth $1); [ $STATUS != "healthy" ]; do
+ if [ $STATUS == "unhealthy" ]; then
+ echo "Failed!" 1>&2
+ exit -1
+ fi
+ printf . 1>&2
+ lf=$'\n'
+ sleep 1
+ done
+ printf "$lf" 1>&2
+}
+
+docker rm -f dc 2>/dev/null > /dev/null
+
+mkdir -p /tmp/shared
+
+# start the dc
+docker run -dit --name dc -v /tmp/shared:/shared --hostname krb.domain.test --cap-add SYS_ADMIN icewind1991/samba-krb-test-dc 1>&2
+
+waitContainer dc
+
+docker inspect dc --format '{{.NetworkSettings.IPAddress}}'