blob: a03b01d2fd57e14da855bef2771e511901fbef1b [file] [log] [blame]
Peter Pentchevd00519f2021-11-08 01:17:13 +02001#!/bin/sh
2
3set -e
4set -x
5
6tempd="$(mktemp -d)"
7trap "rm -rf -- '$tempd'" EXIT HUP INT TERM QUIT
8
9conffile="$tempd/sp-ostack-random.conf"
10
11rm -rf -- "$tempd"
12test ! -e "$tempd"
13test ! -h "$tempd"
14
15sp_rand_init -d "$tempd" -N
16sp_rand_init -d "$tempd" -N | grep -Fqxe "$conffile"
17sp_rand_init -d "$tempd" -N | grep -Eqe '^osci-1-date-[0-9]{8}-[0-9]{4}-[0-9]{4}-$'
18
19mkdir -- "$tempd"
20test -d "$tempd"
21test ! -e "$conffile"
22test ! -h "$conffile"
23
24sp_rand_init -d "$tempd" -N
25test ! -e "$conffile"
26test ! -h "$conffile"
27
28sp_rand_init -d "$tempd"
29test -f "$conffile"
30
31cat -- "$conffile"
32grep -Eqe '^SP_OPENSTACK_VOLUME_PREFIX=osci-1-date-[0-9]{8}-[0-9]{4}-[0-9]{4}-$' -- "$conffile"
33
34sp_rand_cleanup -d "$tempd" --skip-api yes -N
35test -f "$conffile"
36
37sp_rand_cleanup -d "$tempd" --skip-api yes
38test ! -e "$conffile"
39test ! -h "$conffile"
40
41rmdir -- "$tempd"