-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeneral.robot
139 lines (100 loc) · 3.61 KB
/
general.robot
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
132
133
134
135
136
137
138
139
*** Keywords ***
# public:
Suite Setup
Minimal Suite Setup
Log Start Message Suite Setup
Supply All Services
Sanity Checks
Close All Connections
Log End Message
Minimal Suite Setup
Initialize Logging
Resolve Variables
# No Other Robot Should Run
Open All Connections
Recreate Snapshots
${snapshot_name} = Catenate ready-for-testing-framework
Run Command for host in $(virsh list --all | grep q-test | tr -s ' ' | cut -d ' ' -f 3); do virsh destroy \${host}; virsh snapshot-delete ${snapshot_name}; virsh snapshot-create-as \${host} ${snapshot_name}; done
Suite Teardown
Log Start Message Suite Teardown
Close All Connections
Log End Message
Start Up
Log Start Message ${INITIAL_CLEANUP_LABEL}
Open All Connections
Shallow Wait For All Hosts
Log End Message
Wrap Up
Log Start Message Wrap Up
Open All Connections
Stop All Services
Prepare Log
Run Log Analyzer
Close All Connections
Log End Message
# private:
Resolve Variables
Log Start Message Resolve Variables
# Root directory
# ${Rootdir}/../.. == dt-testing-framework/
${ROOTDIR} = Unscramble Path ${CURDIR}/../..
Set Suite Variable ${ROOTDIR}
# SSH information
${SSH_KEY} = Replace Rootdir ${SSH_KEY}
Set Suite Variable ${SSH_KEY}
Log End Message
Replace Rootdir
[Arguments] ${variable}
${replaced} = Replace String ${variable} _ROOTDIR ${ROOTDIR}
[Return] ${replaced}
Unscramble Path
[Arguments] ${path}
${unscrambled_path} ${rc} = Run Command pushd ${path} &> /dev/null; pwd; popd &> /dev/null
[Return] ${unscrambled_path}
Sanity Checks
Log Start Message Sanity Checks
OperatingSystem.File Should Exist ${SSH_KEY}
Log End Message
Run Command
[Arguments] ${command}
${rc} ${output} = Run And Return Rc And Output bash -c '${command}'
Check Rc ${command} ${rc} ${output}
[Return] ${output} ${rc}
Run Command On Remote Host
[Arguments] ${command} ${host}
Switch Connection ${host}
${stdout} ${stderr} ${rc} = SSHLibrary.Execute Command bash -c '${command}' return_stdout=True return_stderr=True return_rc=True
Check Rc ${command} ${rc} ${stdout} ${stderr}
Should Be Empty ${stderr}
[Return] ${stdout} ${rc}
Run Command Ignore Errors
[Arguments] ${command}
${rc} ${output} = Run And Return Rc And Output bash -c '${command}'
[Return] ${output} ${rc}
Run Command Ignore Errors On Remote Host
[Arguments] ${command} ${host}
Switch Connection ${host}
${stdout} ${stderr} ${rc} = SSHLibrary.Execute Command bash -c '${command}' return_stdout=True return_stderr=True return_rc=True
[Return] ${stdout} ${rc}
Check Rc
[Arguments] ${command} ${rc} ${command_output}
Should Be Equal As Integers ${rc} 0 msg=${command} exited with code ${rc}.\n\Reason:\n${command_output}\n
List To CSV String
[Arguments] @{list}
${string} = Catenate ${EMPTY}
:FOR ${element} IN @{list}
\ ${string} = Catenate ${string}${element},
${string} = Get Substring ${string} 0 -1
[Return] ${string}
List To Colon Separated String
[Arguments] @{list}
${string} = Catenate ${EMPTY}
:FOR ${element} IN @{list}
\ ${string} = Catenate ${string}${element}:
${string} = Get Substring ${string} 0 -1
[Return] ${string}
Jq
[Arguments] ${command} ${file}
Run Command tmp=$(mktemp) && ${command} < ${file} > \${tmp} && mv \${tmp} ${file}
Do Nothing
Run Command true