-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfunctionalTest.groovy
More file actions
executable file
·131 lines (120 loc) · 5.28 KB
/
Copy pathfunctionalTest.groovy
File metadata and controls
executable file
·131 lines (120 loc) · 5.28 KB
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
/* groovylint-disable VariableName */
// vars/functionalTest.groovy
/*
* Copyright 2020-2024 Intel Corporation
* Copyright 2025 Hewlett Packard Enterprise Development LP
*/
/**
* functionalTest step method
*
* @param config Map of parameters passed
*
* config['context'] Context name for SCM to identify the specific
* stage to update status for.
* Default is 'test/' + env.STAGE_NAME.
*
* Important:
* The SCM status checking for passing may expect a specific name.
*
* Matrix stages must override this setting to include matrix axes
* names to ensure a unique name is generated.
*
* Or the default name has to be changed in a way that is compatible
* with a future Matrix implementation.
*
* config['description'] Description to report for SCM status.
* Default env.STAGE_NAME.
*
* config['failure_artifacts'] Failure artifacts to return.
* Default env.STAGE_NAME.
*
* config['ignore_failure'] Ignore test failures. Default false.
* config['inst_repos'] Additional repositories to use. Optional.
*
* config['inst_rpms'] Additional rpms to install. Optional
*
* config['junit_files'] Junit files to return. Optional.
*
* config['NODELIST'] NODELIST of nodes to run tests on.
* Default env.NODELIST
*
* config['node_count'] Count of nodes that will actually be used
* the test. Default will be based on the
* environment variables for the stage.
*
* config['stashes'] List of stashes to use. Default will be
* based on the environment variables for the
* stage.
*
* config['target'] Target distribution, such as 'centos7',
* 'el8', 'leap15'. Default based on parsing
* environment variables for the stage.
*
* config['test_rpms'] Set to true to test RPMs being built.
* Default env.TEST_RPMS.
*
* config['test_tag'] Avocado tag to test.
* Default determined by parseStageInfo().
*
* config['ftest_arg'] Functional test launch.py arguments.
* Default determined by parseStageInfo().
*/
Map call(Map config = [:]) {
long startDate = System.currentTimeMillis()
String nodelist = config.get('NODELIST', env.NODELIST)
String context = config.get('context', 'test/' + env.STAGE_NAME)
String description = config.get('description', env.STAGE_NAME)
Map stage_info = parseStageInfo(config)
String image_version = config.get('image_version') ?:
(stage_info['ci_target'] =~ /([a-z]+)(.*)/)[0][1] + stage_info['distro_version']
// Install any additional rpms required for this stage
String stage_inst_rpms = config.get('inst_rpms', '')
if (stage_info['stage_rpms']) {
stage_inst_rpms = stage_info['stage_rpms'] + ' ' + stage_inst_rpms
}
// Check for a mis-configured cluster
String[] nodes = nodelist.split(',')
if (nodes.size() < stage_info['node_count']) {
String message = "CI Cluster needs ${stage_info['node_count']} only has ${nodes.size()}"
buildAgentControl(action: 'offline',
message: message,
subject: 'CI Test failure - CI Configuration test issue.')
}
echo "Running provisionNodes() on ${nodelist} with the ${image_version} image"
Map runData = provisionNodes(
NODELIST: nodelist,
node_count: stage_info['node_count'],
distro: image_version,
inst_repos: config.get('inst_repos', ''),
inst_rpms: stage_inst_rpms)
String test_rpms = config.get('test_rpms', env.TEST_RPMS)
if (test_rpms == 'false') {
if (config['stashes'] == null) {
config['stashes'] = []
}
if (config['stashes'].isEmpty()) {
config['stashes'].add("${stage_info['target']}-${stage_info['compiler']}-install")
config['stashes'].add("${stage_info['target']}-${stage_info['compiler']}-build-vars")
}
}
Map run_test_config = [:]
run_test_config['stashes'] = config.get('stashes', [])
run_test_config['test_rpms'] = test_rpms
run_test_config['pragma_suffix'] = stage_info['pragma_suffix']
run_test_config['test_tag'] = config.get('test_tag', stage_info['test_tag'])
run_test_config['node_count'] = stage_info['node_count']
run_test_config['ftest_arg'] = config.get('ftest_arg', stage_info['ftest_arg'])
run_test_config['context'] = context
run_test_config['description'] = description
Map runtestData = [:]
if (config.get('test_function', 'runTestFunctional') ==
'runTestFunctionalV2') {
runtestData = runTestFunctionalV2 run_test_config
} else {
runtestData = runTestFunctional run_test_config
}
runtestData.each { resultKey, data -> runData[resultKey] = data }
int runTime = durationSeconds(startDate)
runData['funtionaltest_time'] = runTime
return runData
}