Skip to content

Commit 08ef3b6

Browse files
committed
test that data dir/config dir match up
1 parent 79a4af6 commit 08ef3b6

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

test/edgedb-cli/_default.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ source dev-container-features-test-lib
1111
# check that the command is available
1212
check "help" bash -c "edgedb --help | grep 'Usage'"
1313

14+
# make sure edgedb directories match up with our expectations
15+
check "edgedb cli data dir" bash -c "test \"$(edgedb info --get data-dir)\" = $HOME/.local/share/edgedb/data/"
16+
check "edgedb cli config dir" bash -c "test \"$(edgedb info --get config-dir)\" = $HOME/.config/edgedb/"
17+
1418
# check that data directories exist
1519
check "~/.local/share/edgedb exists" bash -c "ls -la ~/.local/share | grep 'edgedb'"
1620
check "/dc/edgedb-cli/data exists" bash -c "ls -la /dc/edgedb-cli | grep 'data'"
@@ -21,13 +25,14 @@ check "/dc/edgedb-cli exists" bash -c "ls -la /dc/edgedb-cli | grep 'config'"
2125

2226
# check that the folders are owned by the user
2327
# https://askubuntu.com/a/175060
24-
echo "Checking ownership of ~/.local/share/edgedb/data and /dc/edgedb-cli/data (ensure it is owned by $USER)"
28+
# $USER is empty when running as root, so we use $(whoami)
29+
echo "Checking ownership of ~/.local/share/edgedb/data and /dc/edgedb-cli/data (ensure it is owned by $(whoami))"
2530

26-
check "~/.local/share/edgedb owned by user" bash -c "test \"$(stat -c "%U" ~/.local/share/edgedb)\" = $USER"
27-
check "/dc/edgedb-cli/data owned by user" bash -c "test \"$(stat -c "%U" /dc/edgedb-cli/data)\" = $USER"
31+
check "~/.local/share/edgedb owned by user" bash -c "test \"$(stat -c "%U" ~/.local/share/edgedb)\" = $(whoami)"
32+
check "/dc/edgedb-cli/data owned by user" bash -c "test \"$(stat -c "%U" /dc/edgedb-cli/data)\" = $(whoami)"
2833

29-
check "~/.config/edgedb owned by user" bash -c "test \"$(stat -c "%U" ~/.config/edgedb)\" = $USER"
30-
check "/dc/edgedb-cli/config owned by user" bash -c "test \"$(stat -c "%U" /dc/edgedb-cli/config)\" = $USER"
34+
check "~/.config/edgedb owned by user" bash -c "test \"$(stat -c "%U" ~/.config/edgedb)\" = $(whoami)"
35+
check "/dc/edgedb-cli/config owned by user" bash -c "test \"$(stat -c "%U" /dc/edgedb-cli/config)\" = $(whoami)"
3136

3237
# Report result
3338
reportResults

test/edgedb-cli/test.sh

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ source dev-container-features-test-lib
77

88
# NOTE: this is an "auto-generated" test, which means it will be
99
# executed against an auto-generated devcontainer.json that
10-
# includes the 'gcloud-cli-persistence' Feature with no options.
11-
#
12-
# https://github.com/devcontainers/cli/blob/main/docs/features/test.md
13-
#
14-
# From my tests, this means the `gcloud` CLI will not be installed:
15-
# Thus, here, I only check basic directory existence
10+
# includes the feature with no options
1611

17-
# check that `~/.config/gcloud` and `/dc/gcloud-cli` exist`
18-
check "config" bash -c "ls -la ~/.local/share/ | grep 'edgedb'"
19-
check "dc" bash -c "ls -la /dc | grep 'edgedb-cli'"
20-
21-
# check that `~/.config/gcloud` is a symlink
22-
# https://unix.stackexchange.com/a/96910
23-
check "~/.local/share/edgedb is a symlink" bash -c "test -L ~/.local/share/edgedb && test -d ~/.local/share/edgedb"
24-
25-
# Report result
26-
reportResults
12+
./_default.sh

0 commit comments

Comments
 (0)