-
Notifications
You must be signed in to change notification settings - Fork 3
/
runOperatorTestWithImage.groovy
executable file
·48 lines (41 loc) · 1.57 KB
/
runOperatorTestWithImage.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env groovy
// Run e2e test with operator-sdk with specified image and namespace
def call(Map params) {
final String containerImageName = params.containerImageName
final String namespace = params.namespace ?: sh(script: "oc project -q", returnStdout: true).trim()
final Boolean namespacedManifest = params.namespacedManifest ?: false
final Boolean globalManifest = params.globalManifest ?: false
String namespacedManifestFilename = "''"
String globalManifestFilename = "''"
if (namespacedManifest) {
namespacedManifestFilename = "namespaced_manifest.yaml"
sh """
for file in \$(find deploy -name "*" -not -path 'deploy/**/*' | grep -E 'service|role|operator');
do
echo '---' >> ${namespacedManifestFilename}
cat \$file >> ${namespacedManifestFilename}
done
"""
}
if (globalManifest) {
globalManifestFilename = "global_manifest.yaml"
sh """
for file in \$(find deploy -name "*_crd*");
do
echo '---' >> ${globalManifestFilename}
cat \$file >> ${globalManifestFilename}
done
"""
}
List<String> e2eTestCommand = [
"operator-sdk test local ./test/e2e",
"--namespace ${namespace}",
"--namespaced-manifest ${namespacedManifestFilename}",
"--global-manifest ${globalManifestFilename}",
"--go-test-flags '-v'"
]
if (containerImageName && containerImageName != "") {
e2eTestCommand.add("--image ${containerImageName}")
}
sh e2eTestCommand.join(" ")
}