Skip to content

Commit 5a50a57

Browse files
committed
CpsScriptTest.methodTooLargeExceptionRealistic(): decouple maxStagesMethods (class complexity) from maxTryCatch (nesting depth)
Signed-off-by: Jim Klimov <[email protected]>
1 parent 74a125c commit 5a50a57

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

plugin/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScriptTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,22 @@ public void evaluateShallSandbox() throws Exception {
117117
// * Up to 255 stages allowed
118118
// FIXME? Tune the value per platform and/or dynamically
119119
// based on stack overflow mention in build log?
120-
int i, max = 200;
120+
int i, maxStagesMethods = 250, maxTryCatch = 127;
121121

122-
for (i = 0; i < max; i++) {
122+
for (i = 0; i < maxStagesMethods; i++) {
123123
sbStages.append("stage('Stage " + i + "') { steps { method" + i + "(); } }\n");
124124
}
125125

126-
for (i = 0; i < max; i++) {
126+
for (i = 0; i < maxStagesMethods; i++) {
127127
sbMethods.append("def method" + i + "() { echo 'i = " + i + "'; }\n");
128128
}
129129

130130
sbMethods.append("def method() {\n");
131-
for (i = 0; i < max; i++) {
131+
for (i = 0; i < maxTryCatch; i++) {
132132
sbMethods.append("try { // " + i + "\n");
133133
}
134134
sbMethods.append(" Integer x = 'zzz'; // incur conversion exception\n");
135-
for (i = 0; i < max; i++) {
135+
for (i = 0; i < maxTryCatch; i++) {
136136
sbMethods.append("} catch (Throwable t) { // " + i + "\n method" + i + "(); throw t; }\n");
137137
}
138138
sbMethods.append("}\n");

0 commit comments

Comments
 (0)