blob: 89d5db83d8c727ef34f8d16ac6d86ee444345ad8 (
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
|
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
init_tests \
setup_hostname_usage \
setup_hostname_invalid_hostname
setup_hostname_usage_body() {
test_usage setup-hostname
}
setup_hostname_invalid_hostname_body() {
init_env
atf_check -s exit:1 \
-o empty \
-e match:"must only contain letters" \
setup-hostname -- 'asdf_'
a=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# verify that string is 64 chars
atf_check_equal $(printf "$a" | wc -c) 64
atf_check -s exit:1 \
-o empty \
-e match:"is too long" \
setup-hostname -- "$a$a$a$a"
atf_check -s exit:1 \
-o empty \
-e match:"must not start with" \
setup-hostname -- '-asdf'
atf_check -s exit:1 \
-o empty \
-e match:"must not start with" \
setup-hostname -- '.asdf'
}
|