Skip to content

Commit

Permalink
[Tests] use libtester for detectTestDockerAgent
Browse files Browse the repository at this point in the history
Issue Resolved:
#1758

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla committed Mar 17, 2022
1 parent 446eac5 commit bffdc7a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/jenkins/TestDetectTestDockerAgent.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class TestDetectTestDockerAgent extends BuildPipelineTest {

@Test
public void test() {
this.registerLibTester(new DetectTestDockerAgentLibTester(
'tests/jenkins/data/opensearch-1.3.0-test.yml'
))
super.testPipeline("tests/jenkins/jobs/DetectTestDockerAgent_Jenkinsfile")
}
}
28 changes: 28 additions & 0 deletions tests/jenkins/lib-testers/DetectTestDockerAgentLibTester.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import static org.hamcrest.CoreMatchers.notNullValue
import static org.hamcrest.MatcherAssert.assertThat


class DetectTestDockerAgentLibTester extends LibFunctionTester {

private String testManifest

public DetectTestDockerAgentLibTester(testManifest){
this.testManifest = testManifest
}

void configure(helper, binding) {
// N/A
}

void parameterInvariantsAssertions(call) {
assertThat(call.args.testManifest.first(), notNullValue())
}

boolean expectedParametersMatcher(call) {
return call.args.testManifest.first().toString().equals(this.testManifest)
}

String libFunctionName() {
return 'detectTestDockerAgent'
}
}

0 comments on commit bffdc7a

Please sign in to comment.