Skip to content

Commit 69ff654

Browse files
committed
test fix
1 parent 6a284c9 commit 69ff654

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/test/java/org/scm4j/releaser/WorkflowPatchesTest.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ public void testPatchDONEIfAllReleaseBranchCommitsIgnored() {
166166
ExtendedStatus status = statusBuilder.getAndCachePatchStatus(compVersioned, new CachedStatuses());
167167
assertEquals(BuildStatus.DONE, status.getStatus());
168168
}
169-
169+
170170
@Test
171171
public void testMinorUpgradeDowngradeException() {
172172
forkAndBuild(compUnTill);
173173

174174
// release next 2.60 unTillDb minor
175175
env.generateFeatureCommit(env.getUnTillDbVCS(), repoUnTillDb.getDevelopBranch(), "feature added");
176176
forkAndBuild(compUnTillDb, 2);
177-
177+
178178
// make unTill use new 2.60.0 version of unTillDb
179179
ReleaseBranchCurrent crbUnTill = ReleaseBranchFactory.getCRB(repoUnTill);
180180
ReleaseBranchCurrent crbUBL = ReleaseBranchFactory.getCRB(repoUBL);
@@ -186,10 +186,25 @@ public void testMinorUpgradeDowngradeException() {
186186
}
187187
}
188188
env.getUnTillVCS().setFileContent(crbUnTill.getName(), Constants.MDEPS_FILE_NAME, mdf.toFileContent(), "unTillDb version is changed manually");
189-
189+
190190
// unTill still have old untillDb version. untillDb for unTill is processed first and cached 2.60.0.
191191
// The UBL have unTillDb 2.59.0 but 2.60.0 is cached -> UBL status would be ACTUALIZE_PATCHES but EMinorUpgradeDowngrade should be thrown
192-
checkEMinorUpgradeDowngrade(crbUBL);
192+
try {
193+
execAndGetActionBuild(compUnTill.clone(env.getUnTillVer().toRelease()));
194+
fail();
195+
} catch (EMinorUpgradeDowngrade e) {
196+
if (e.getRootComp().equals(compUBL.clone(crbUBL.getVersion().toPreviousPatch()))) {
197+
// on >1-core systems
198+
assertEquals(compUnTillDb.clone("2.59.0"), e.getProblematicMDep());
199+
assertEquals(new Version("2.60.0"), e.getChangeToVersion());
200+
} else if (e.getRootComp().equals(compUnTill.clone(env.getUnTillVer().toRelease()))) {
201+
// on 1-core systems
202+
assertEquals(compUnTillDb.clone("2.60.0"), e.getProblematicMDep());
203+
assertEquals(new Version("2.59.0"), e.getChangeToVersion());
204+
} else {
205+
fail();
206+
}
207+
}
193208
}
194209

195210
@Test
@@ -207,10 +222,6 @@ public void testPatchDowngradeException() {
207222

208223
// unTill still have 2.59.0 untillDb version. untillDb for unTill is processed first and cached 2.59.0.
209224
// The UBL have unTillDb 2.59.1 but 2.59.0 cached -> UBL status would be ACTUALIZE_PATCHES but EMinorUpgradeDowngrade should be thrown
210-
checkEMinorUpgradeDowngrade(crbUBL);
211-
}
212-
213-
private void checkEMinorUpgradeDowngrade(ReleaseBranchCurrent crbUBL) {
214225
try {
215226
execAndGetActionBuild(compUnTill.clone(env.getUnTillVer().toRelease()));
216227
fail();

0 commit comments

Comments
 (0)