-
Notifications
You must be signed in to change notification settings - Fork 123
/
test.sh
executable file
·116 lines (96 loc) · 5.69 KB
/
test.sh
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
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
rlPhaseStartSetup
if [ "$EXPLICIT_ROOT" = "yes" ]; then
tmt="tmt --root data"
else
tmt="tmt"
rlRun "pushd data"
fi
rlPhaseEnd
rlPhaseStartTest "Good"
rlRun -s "$tmt plan lint good"
rlAssertGrep "/good" $rlRun_LOG
rlAssertNotGrep 'warn ' $rlRun_LOG
rlRun "rm $rlRun_LOG"
rlRun -s "$tmt plan lint valid_fmf"
rlAssertGrep "pass P005 remote fmf id in \"default-0\" is valid" $rlRun_LOG
rlAssertNotGrep 'warn ' $rlRun_LOG
rlRun "rm $rlRun_LOG"
rlRun -s "$tmt plan lint multi_execute"
rlAssertGrep "/multi_execute" $rlRun_LOG
rlAssertNotGrep 'fail ' $rlRun_LOG
rlRun "rm $rlRun_LOG"
rlPhaseEnd
rlPhaseStartTest "Bad"
rlRun -s "$tmt plan lint bad" 1
rlAssertGrep "warn C000 fmf node failed schema validation" $rlRun_LOG
rlAssertGrep "warn C001 summary key is missing" $rlRun_LOG
rlAssertGrep "fail P002 execute step must be defined with \"how\"" $rlRun_LOG
rlRun -s "$tmt plan lint duplicate_names" 1
rlAssertGrep "fail P006 duplicate phase name 'duplicate' in step 'discover'" $rlRun_LOG
rlAssertGrep "fail P006 duplicate phase name 'duplicate' in step 'prepare'" $rlRun_LOG
rlRun -s "$tmt plan lint invalid_how" 1
rlAssertGrep "warn C000 value of \"how\" is not \"shell\"" $rlRun_LOG
rlAssertGrep "warn C000 value of \"how\" is not \"fmf\"" $rlRun_LOG
rlAssertGrep "warn C000 value of \"how\" is not \"tmt\"" $rlRun_LOG
rlAssertGrep "warn C000 key \"name\" not recognized by schema /schemas/execute/upgrade" $rlRun_LOG
rlAssertGrep "warn C000 value of \"how\" is not \"upgrade\"" $rlRun_LOG
rlAssertGrep "warn C000 fmf node failed schema validation" $rlRun_LOG
rlAssertGrep "fail P003 unknown execute method \"somehow\" in \"default-0\"" $rlRun_LOG
rlAssertGrep "fail P004 unknown discover method \"somehow\" in \"default-0\"" $rlRun_LOG
rlRun -s "$tmt plan lint invalid_url" 1
rlAssertGrep "fail P005 remote fmf id in \"default-0\" is invalid, repo 'http://invalid-url' cannot be cloned" $rlRun_LOG
rlRun -s "$tmt plan lint invalid_ref" 1
rlAssertGrep "fail P005 remote fmf id in \"default-0\" is invalid, git ref 'invalid-ref-123456' is invalid" $rlRun_LOG
rlRun -s "$tmt plan lint invalid_path" 1
rlAssertGrep "fail P005 remote fmf id in \"default-0\" is invalid, path '/invalid-path-123456' is invalid" $rlRun_LOG
rlRun -s "$tmt plan lint multi_discover" 1
rlAssertGrep "pass P005 remote fmf id in \"a\" is valid" $rlRun_LOG
rlAssertGrep "fail P005 remote fmf id in \"b\" is invalid, repo 'http://invalid-url' cannot be cloned" $rlRun_LOG
rlRun -s "$tmt plan lint invalid_attr" 1
rlAssertGrep "warn C000 fmf node failed schema validation" $rlRun_LOG
rlAssertGrep "warn C001 summary key is missing" $rlRun_LOG
rlAssertGrep "fail P001 unknown key \"discove\" is used" $rlRun_LOG
rlAssertGrep "fail P001 unknown key \"environmen\" is used" $rlRun_LOG
rlAssertGrep "fail P001 unknown key \"summaryABCDEF\" is used" $rlRun_LOG
rlRun -s "$tmt plan lint invalid-plugin-key" 0
rlAssertGrep 'warn C000 key "wrong" not recognized by schema$' $rlRun_LOG
rlAssertGrep 'warn C000 key "wrong" not recognized by schema /schemas/prepare/feature' $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest "P007: step phases require existing guests and roles"
rlRun -s "$tmt plan lint --list-checks"
rlAssertGrep "P007: step phases require existing guests and roles" $rlRun_LOG
rlRun -s "$tmt plan lint /where-guest-role-mismatch" 1
rlAssertGrep "fail P007 prepare phase 'default-0' needs guest or role 'client-1', guests 'server-1', 'server-2' and roles 'server' were found" $rlRun_LOG
rlAssertGrep "pass P007 prepare phase 'default-1' shall run on guest 'server-1'" $rlRun_LOG
rlAssertGrep "pass P007 prepare phase 'default-2' shall run on role 'server'" $rlRun_LOG
rlAssertGrep "fail P007 execute phase 'default-0' needs guest or role 'client-1', guests 'server-1', 'server-2' and roles 'server' were found" $rlRun_LOG
rlAssertGrep "pass P007 execute phase 'default-1' shall run on guest 'server-1'" $rlRun_LOG
rlAssertGrep "pass P007 execute phase 'default-2' shall run on role 'server'" $rlRun_LOG
rlAssertGrep "fail P007 finish phase 'default-0' needs guest or role 'client-2', guests 'server-1', 'server-2' and roles 'server' were found" $rlRun_LOG
rlAssertGrep "pass P007 finish phase 'default-1' shall run on guest 'server-2'" $rlRun_LOG
rlAssertGrep "pass P007 finish phase 'default-2' shall run on role 'server'" $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest "Lint of duplicate ids"
if [ "$EXPLICIT_ROOT" = "yes" ]; then
tmt="tmt --root data_duplicate_ids"
else
# From data
rlRun "popd"
rlRun "pushd data_duplicate_ids"
fi
lint_cmd="$tmt plan lint"
rlRun -s "$lint_cmd /no_duplicates"
rlAssertGrep "pass G001 no duplicate ids detected" "$rlRun_LOG"
rlRun -s "$lint_cmd /duplicates" 1
rlAssertGrep "fail G001 duplicate id \"5cf92c54-e073-475c-970f-b8e090ec4da2\" in \"/duplicates/duplicate_one\"" "$rlRun_LOG"
rlAssertGrep "fail G001 duplicate id \"5cf92c54-e073-475c-970f-b8e090ec4da2\" in \"/duplicates/duplicate_two\"" "$rlRun_LOG"
rlPhaseEnd
rlPhaseStartCleanup
if [ "$EXPLICIT_ROOT" != "yes" ]; then
rlRun "popd"
fi
rlPhaseEnd
rlJournalEnd