forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LibFunctionTester.groovy
34 lines (25 loc) · 958 Bytes
/
LibFunctionTester.groovy
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
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
import jenkins.tests.BuildPipelineTest
abstract class LibFunctionTester extends BuildPipelineTest {
// Used for testing the library function
abstract String libFunctionName()
abstract void parameterInvariantsAssertions(call)
abstract boolean expectedParametersMatcher(call)
// used to setup the variable values for the library
abstract void configure(helper, binding)
void verifyParams(helper){
def callList = helper.callStack.findAll { call ->
call.methodName == libFunctionName()
}
assert callList.size() > 0
callList.each ( this.¶meterInvariantsAssertions )
assert callList.any( this.&expectedParametersMatcher )
}
}