Skip to content

Commit 4e1fb53

Browse files
committed
Fix macOs recognition
1 parent 97866b5 commit 4e1fb53

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

docker-lifecycle-listener.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ running_as_root() {
2323
}
2424

2525
os_is_macOS() {
26-
test "$(uname -a)" = 'Darwin'
26+
test "$(uname -s)" = 'Darwin'
2727
}
2828

2929
owner_of() {

test/docker-lifecycle-listener.bats

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,37 @@ teardown() {
3333
run is_valid_command "whatever"
3434
test "$status" -ne 0
3535
}
36+
37+
@test "group_other_permissions returns correct values" {
38+
local a_file; a_file=$(mktemp)
39+
chmod g=rw,o=rx "$a_file"
40+
41+
run group_other_permissions "$a_file"
42+
43+
test "$output" = 'rw-r-x'
44+
}
45+
46+
@test "only_owner_can_write_to succeeds if only owner can write" {
47+
local a_file; a_file=$(mktemp)
48+
chmod u=rwx,g=rx,o=rx "$a_file"
49+
50+
only_owner_can_write_to "$a_file"
51+
}
52+
53+
@test "only_owner_can_write_to fails if group can write" {
54+
local a_file; a_file=$(mktemp)
55+
chmod u=rwx,g=rwx,o=rx "$a_file"
56+
57+
run only_owner_can_write_to "$a_file"
58+
59+
test "$status" -ne 0
60+
}
61+
62+
@test "only_owner_can_write_to fails if other can write" {
63+
local a_file; a_file=$(mktemp)
64+
chmod u=rwx,g=rx,o=rwx "$a_file"
65+
66+
run only_owner_can_write_to "$a_file"
67+
68+
test "$status" -ne 0
69+
}

0 commit comments

Comments
 (0)