Skip to content

Commit 2a90559

Browse files
authored
✨ feat: Add logging when starting integration tests (#1450)
1 parent ca99ed8 commit 2a90559

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

maven_plugin/src/test/java/it/IntegrationTestsIT.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class IntegrationTestsIT {
3434
@MavenTest
3535
public void simpleProject(MavenExecutionResult result) throws Exception {
3636
// contract: an empty project should generate an empty lock file
37+
System.out.println("Running 'simpleProject' integration test.");
3738
assertThat(result).isSuccessful();
3839
Path lockFilePath = findFile(result, "lockfile.json");
3940
assertThat(lockFilePath).exists();
@@ -44,6 +45,7 @@ public void simpleProject(MavenExecutionResult result) throws Exception {
4445
@MavenTest
4546
public void singleDependency(MavenExecutionResult result) throws Exception {
4647
// contract: an empty project should generate an empty lock file
48+
System.out.println("Running 'singleDependency' integration test.");
4749
assertThat(result).isSuccessful();
4850
Path lockFilePath = findFile(result, "lockfile.json");
4951
assertThat(lockFilePath).exists();
@@ -61,6 +63,7 @@ public void singleDependency(MavenExecutionResult result) throws Exception {
6163
@MavenTest
6264
public void singleDependencyCheckCorrect(MavenExecutionResult result) throws Exception {
6365
// contract: an empty project should generate an empty lock file
66+
System.out.println("Running 'singleDependencyCheckCorrect' integration test.");
6467
assertThat(result).isSuccessful();
6568
Path lockFilePath = findFile(result, "lockfile.json");
6669
assertThat(lockFilePath).exists();
@@ -78,6 +81,7 @@ public void singleDependencyCheckCorrect(MavenExecutionResult result) throws Exc
7881
public void singleDependencyCheckMustFail(MavenExecutionResult result) throws Exception {
7982
// contract: a changed dependency should fail the build.
8083
// we changed the group id of "groupId": "org.opentest4j", to "groupId": "org.opentest4j5",
84+
System.out.println("Running 'singleDependencyCheckMustFail' integration test.");
8185
assertThat(result).isFailure();
8286
}
8387

@@ -86,6 +90,7 @@ public void pluginProject(MavenExecutionResult result) throws Exception {
8690
// contract: if including maven plugins the lockfile should contain these and be able to calculate checksums for
8791
// them. Plugin dependencies should also be resolved and recorded.
8892
// Note that remote does not work as the maven-lockfile plugin with SNAPSHOT version is not available on remote.
93+
System.out.println("Running 'pluginProject' integration test.");
8994
assertThat(result).isSuccessful();
9095
Path lockFilePath = findFile(result, "lockfile.json");
9196
assertThat(lockFilePath).exists();
@@ -104,6 +109,7 @@ public void pluginProject(MavenExecutionResult result) throws Exception {
104109

105110
@MavenTest
106111
public void freezeJunit(MavenExecutionResult result) throws Exception {
112+
System.out.println("Running 'freezeJunit' integration test.");
107113
assertThat(result).isSuccessful();
108114
Path path = findFile(result, "pom.xml");
109115
var pom = Files.readString(path);
@@ -114,11 +120,13 @@ public void freezeJunit(MavenExecutionResult result) throws Exception {
114120

115121
@MavenTest
116122
public void freezeWithoutDepManagement(MavenExecutionResult result) throws Exception {
123+
System.out.println("Running 'freezeWithoutDepManagement' integration test.");
117124
checkFreeze(result);
118125
}
119126

120127
@MavenTest
121128
public void freezeWithDepManagement(MavenExecutionResult result) throws Exception {
129+
System.out.println("Running 'freezeWithDepManagement' integration test.");
122130
checkFreeze(result);
123131
}
124132

@@ -191,6 +199,7 @@ private List<String> getDependencyKeys(List<Dependency> dependencies) {
191199

192200
@MavenTest
193201
void reduceLog4jAffected(MavenExecutionResult result) throws Exception {
202+
System.out.println("Running 'reduceLog4jAffected' integration test.");
194203
assertThat(result).isSuccessful();
195204
Path lockFilePath = findFile(result, "lockfile.json");
196205
assertThat(lockFilePath).exists();
@@ -202,6 +211,7 @@ void reduceLog4jAffected(MavenExecutionResult result) throws Exception {
202211

203212
@MavenTest
204213
void reduceLog4jNotAffected(MavenExecutionResult result) throws Exception {
214+
System.out.println("Running 'reduceLog4jNotAffected' integration test.");
205215
assertThat(result).isSuccessful();
206216
Path lockFilePath = findFile(result, "lockfile.json");
207217
assertThat(lockFilePath).exists();
@@ -226,11 +236,13 @@ private void flattenDependencies(DependencyNode node, List<DependencyNode> depen
226236

227237
@MavenTest
228238
void classifierDependency(MavenExecutionResult result) throws Exception {
239+
System.out.println("Running 'classifierDependency' integration test.");
229240
classifier(result);
230241
}
231242

232243
@MavenTest
233244
void classifierDependencyCheckCorrect(MavenExecutionResult result) throws Exception {
245+
System.out.println("Running 'classifierDependencyCheckCorrect' integration test.");
234246
classifier(result);
235247
}
236248

@@ -283,6 +295,7 @@ private void classifier(MavenExecutionResult result) throws Exception {
283295
public void classifierDependencyCheckMustFail(MavenExecutionResult result) throws Exception {
284296
// contract: a changed dependency should fail the build.
285297
// we changed the classifier id of "classifier": "sources", to "classifier": "42",
298+
System.out.print("Running 'classifierDependencyCheckMustFail' integration test.");
286299
assertThat(result).isFailure();
287300
}
288301

@@ -291,6 +304,7 @@ public void singleDependencyCheckMustWarn(MavenExecutionResult result) throws Ex
291304
// contract: a changed dependency should generate a warning on the build.
292305
// if the allowValidationFailure parameter is true
293306
// we changed the group id of "groupId": "org.opentest4j", to "groupId": "org.opentest4j5",
307+
System.out.print("Running 'singleDependencyCheckMustWarn' integration test.");
294308
assertThat(result).isSuccessful();
295309

296310
String stdout = Files.readString(result.getMavenLog().getStdout());
@@ -301,6 +315,7 @@ public void singleDependencyCheckMustWarn(MavenExecutionResult result) throws Ex
301315
@MavenTest
302316
public void withEnvironment(MavenExecutionResult result) throws Exception {
303317
// contract: a null environment should be returned if include environment is false
318+
System.out.println("Running 'withEnvironment' integration test.");
304319
assertThat(result).isSuccessful();
305320
Path lockFilePath = findFile(result, "lockfile.json");
306321
assertThat(lockFilePath).exists();
@@ -312,6 +327,7 @@ public void withEnvironment(MavenExecutionResult result) throws Exception {
312327
@MavenTest
313328
public void withoutEnvironment(MavenExecutionResult result) throws Exception {
314329
// contract: a not null environment should be returned if include environment is true
330+
System.out.println("Running 'withoutEnvironment' integration test.");
315331
assertThat(result).isSuccessful();
316332
Path lockFilePath = findFile(result, "lockfile.json");
317333
assertThat(lockFilePath).exists();
@@ -323,6 +339,7 @@ public void withoutEnvironment(MavenExecutionResult result) throws Exception {
323339
@MavenTest
324340
public void withEnvironmentFromLockfile(MavenExecutionResult result) throws Exception {
325341
// contract: a not null environment should be returned if include environment is true
342+
System.out.println("Running 'withEnvironmentFromLockfile' integration test.");
326343
assertThat(result).isSuccessful();
327344
Path lockFilePath = findFile(result, "lockfile.json");
328345
assertThat(lockFilePath).exists();
@@ -334,6 +351,7 @@ public void withEnvironmentFromLockfile(MavenExecutionResult result) throws Exce
334351
@MavenTest
335352
public void withoutEnvironmentFromLockfile(MavenExecutionResult result) throws Exception {
336353
// contract: a null environment should be returned if include environment is false
354+
System.out.println("Running 'withoutEnvironmentFromLockfile' integration test.");
337355
assertThat(result).isSuccessful();
338356
Path lockFilePath = findFile(result, "lockfile.json");
339357
assertThat(lockFilePath).exists();
@@ -345,6 +363,7 @@ public void withoutEnvironmentFromLockfile(MavenExecutionResult result) throws E
345363
@MavenTest
346364
public void orderedLockfile(MavenExecutionResult result) throws Exception {
347365
// contract: the dependency list should be ordered
366+
System.out.println("Running 'orderedLockfile' integration test.");
348367
assertThat(result).isSuccessful();
349368
Path lockFilePath = findFile(result, "lockfile.json");
350369
assertThat(lockFilePath).exists();
@@ -359,6 +378,7 @@ public void orderedLockfile(MavenExecutionResult result) throws Exception {
359378
@MavenTest
360379
public void skipLockfile(MavenExecutionResult result) throws Exception {
361380
// contract: the lockfile should not be generated if skip option is true
381+
System.out.println("Running 'skipLockfile' integration test.");
362382
assertThat(result).isSuccessful();
363383
var fileExists = fileExists(result, "lockfile.json");
364384
assertThat(fileExists).isFalse();
@@ -367,6 +387,7 @@ public void skipLockfile(MavenExecutionResult result) throws Exception {
367387
@MavenTest
368388
public void differentLockfileName(MavenExecutionResult result) throws Exception {
369389
// contract: the lockfile should be generated with a different name
390+
System.out.println("Running 'differentLockfileName' integration test.");
370391
assertThat(result).isSuccessful();
371392
var lockfileExists = fileExists(result, "lockfile.json");
372393
assertThat(lockfileExists).isFalse();
@@ -378,33 +399,38 @@ public void differentLockfileName(MavenExecutionResult result) throws Exception
378399
public void differentLockfileNameFreezeShouldSucceed(MavenExecutionResult result) throws Exception {
379400
// contract: if there exists a different-name-lockfile.json and -DlockfileName="different-lockfile-name.json" is
380401
// provided, freeze should succeed
402+
System.out.println("Running 'differentLockfileNameFreeze' integration test.");
381403
assertThat(result).isSuccessful();
382404
}
383405

384406
@MavenTest
385407
public void differentLockfileNameValidateShouldFail(MavenExecutionResult result) throws Exception {
386408
// contract: if there exists a lockfile.json but -DlockfileName="different-lockfile-name.json" is provided,
387409
// validate should fail
410+
System.out.println("Running 'differentLockfileNameValidate' integration test.");
388411
assertThat(result).isFailure();
389412
}
390413

391414
@MavenTest
392415
public void differentLockfileNameValidateShouldSucceed(MavenExecutionResult result) throws Exception {
393416
// contract: if there exists a different-name-lockfile.json and -DlockfileName="different-lockfile-name.json" is
394417
// provided, validate should succeed
418+
System.out.println("Running 'differentLockfileNameValidate' integration test.");
395419
assertThat(result).isSuccessful();
396420
}
397421

398422
@MavenTest
399423
public void remoteRepositoryShouldResolve(MavenExecutionResult result) throws Exception {
400424
// contract: if the pom contains a remote repository other that maven_central, the artifact should resolve
425+
System.out.println("Running 'remoteRepository' integration test.");
401426
assertThat(result).isSuccessful();
402427
}
403428

404429
@MavenTest
405430
public void checksumModeRemote(MavenExecutionResult result) throws Exception {
406431
// contract: if checksum mode is remote, maven-lockfile should be able to download and verify SHA-256 from maven
407432
// central and if SHA-256 is not available, it should be able to .
433+
System.out.println("Running 'checksumModeRemote' integration test.");
408434
assertThat(result).isSuccessful();
409435
var lockfilePath = findFile(result, "lockfile.json");
410436
assertThat(lockfilePath).exists();
@@ -444,6 +470,7 @@ public void checksumModeRemote(MavenExecutionResult result) throws Exception {
444470
@MavenTest
445471
public void resolvedFieldShouldResolve(MavenExecutionResult result) throws Exception {
446472
// contract: resolved field should find correctly url for projects with multiple repositories
473+
System.out.println("Running 'resolvedField' integration test.");
447474
assertThat(result).isSuccessful();
448475
Path lockFilePath = findFile(result, "lockfile.json");
449476
assertThat(lockFilePath).exists();
@@ -491,6 +518,7 @@ public void resolvedFieldShouldResolve(MavenExecutionResult result) throws Excep
491518
@MavenTest
492519
public void pomCheckShouldFail(MavenExecutionResult result) throws Exception {
493520
// contract: if the pom checksum does not match is should fail with reason being pom didn't match.
521+
System.out.println("Running 'pomCheckShouldFail' integration test.");
494522
assertThat(result).isFailure();
495523
String stdout = Files.readString(result.getMavenLog().getStdout());
496524
assertThat(stdout.contains("Pom checksum mismatch.")).isTrue();
@@ -499,6 +527,7 @@ public void pomCheckShouldFail(MavenExecutionResult result) throws Exception {
499527
@MavenTest
500528
public void environmentalCheckShouldFail(MavenExecutionResult result) throws Exception {
501529
// contract: if the pom checksum does not match is should fail with reason being pom didn't match.
530+
System.out.println("Running 'environmentalCheckShouldFail' integration test.");
502531
assertThat(result).isFailure();
503532
String stdout = Files.readString(result.getMavenLog().getStdout());
504533
assertThat(stdout.contains("Failed verifying environment.")).isTrue();

0 commit comments

Comments
 (0)