summaryrefslogtreecommitdiff
path: root/tests/setup_timezone_test
blob: 93eb13728a4eb7ea7e2426f82a442d03302ea0d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env atf-sh

. $(atf_get_srcdir)/test_env.sh
init_tests \
	setup_timezone_usage \
	setup_timezone_copy \
	setup_timezone_install \
	setup_timezone_z_compat \
	setup_timezone_none \

setup_timezone_usage_body() {
	test_usage setup-timezone
}

setup_timezone_copy_body() {
	init_env
	mkdir -p usr/share/zoneinfo/Europe
	touch usr/share/zoneinfo/Europe/Oslo
	atf_check -s exit:0 \
		-o match:"apk add .*tzdata" \
		-o match:"apk del" \
		-e empty \
		setup-timezone Europe/Oslo
}

setup_timezone_install_body() {
	init_env
	mkdir -p usr/share/zoneinfo/Europe
	touch usr/share/zoneinfo/Europe/Oslo
	atf_check -s exit:0 \
		-o match:"apk add .*tzdata" \
		-o not-match:"apk add.*--virtual" \
		-o not-match:"apk del" \
		-e empty \
		setup-timezone -i Europe/Oslo
}

setup_timezone_z_compat_body() {
	init_env
	mkdir -p usr/share/zoneinfo/Europe
	touch usr/share/zoneinfo/Europe/Oslo
	atf_check -s exit:0 \
		-o match:"apk add .*tzdata" \
		-o match:"apk del" \
		-e empty \
		setup-timezone -z Europe/Oslo
}

setup_timezone_none_body() {
	init_env
	atf_check -s exit:0 \
		-o empty \
		-e empty \
		setup-timezone none
}