summaryrefslogtreecommitdiff
path: root/tests/lbu_test
blob: 6236faac3ed4202fe8fd43739552aaee8bc5f15e (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env atf-sh

. $(atf_get_srcdir)/test_env.sh
init_tests \
	lbu_usage \
	lbu_include_usage \
	lbu_inc_usage \
	lbu_add_usage \
	lbu_add_delete \
	lbu_commit_usage \
	lbu_ci_usage \
	lbu_exclude_usage \
	lbu_ex_usage \
	lbu_delete_usage \
	lbu_diff_usage \
	lbu_list_usage \
	lbu_ls_usage \
	lbu_list_backup_usage \
	lbu_lb_usage \
	lbu_package_usage \
	lbu_pkg_usage

lbu_usage_body() {
	test_usage lbu
}

lbu_include_usage_body() {
	test_usage "lbu include"
}

lbu_inc_usage_body() {
	test_usage "lbu inc"
}

lbu_add_usage_body() {
	init_env
	atf_check -s exit:0 \
		-o match:"usage: lbu include" \
		-e empty \
		lbu add -h
}

lbu_add_delete_body() {
	init_env
	mkdir -p root/.ssh
	atf_check -s exit:0 \
		-o match:"Adding root/.ssh to" \
		-e empty \
		lbu add -v root/.ssh

	atf_check -s exit:0 \
		-o match:"root/.ssh" \
		cat etc/apk/protected_paths.d/lbu.list

	atf_check -s exit:0 \
		-o match:"Removing root/.ssh from" \
		-e empty \
		lbu delete -v root/.ssh

	grep 'root/.ssh' etc/apk/protected_paths.d/lbu.list \
		|| atf_fail "root/.ssh was not removed"
}

lbu_commit_usage_body() {
	test_usage "lbu commit"
}

lbu_ci_usage_body() {
	init_env
	atf_check -s exit:0 \
		-o match:"usage: lbu commit" \
		-e empty \
		lbu ci -h
}

lbu_exclude_usage_body() {
	test_usage "lbu exclude"
}

lbu_ex_usage_body() {
	test_usage "lbu ex"
}

lbu_delete_usage_body() {
	init_env
	atf_check -s exit:0 \
		-o match:"usage: lbu exclude" \
		-e empty \
		lbu delete -h
}

lbu_diff_usage_body() {
	test_usage "lbu diff"
}

lbu_list_usage_body() {
	test_usage "lbu list"
}

lbu_ls_usage_body() {
	init_env
	atf_check -s exit:0 \
		-o match:"usage: lbu list" \
		-e empty \
		lbu ls -h
}

lbu_list_backup_usage_body() {
	test_usage "lbu list-backup"
}

lbu_lb_usage_body() {
	init_env
	atf_check -s exit:0 \
		-o match:"usage: lbu list-backup" \
		-e empty \
		lbu lb -h
}

lbu_package_usage_body() {
	test_usage "lbu package"
}

lbu_pkg_usage_body() {
	init_env
	atf_check -s exit:0 \
		-o match:"usage: lbu package" \
		-e empty \
		lbu pkg -h
}