apache / apache/maven-shade-plugin

[MSHADE-342] Many integration tests fail when run in isolation

Open
#346 10 comments 0 reactions 0 assignees View on GitHub
bug priority:minor
Dominant language
Java
Stars
188
Forks
103
Avg merge
16h 39m
Merged PRs (30d)
4

Description

**[Peter De Maeyer](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=peterdm)** opened **[MSHADE-342](https://issues.apache.org/jira/browse/MSHADE-342?redirect=false)** and commented

Maven invoker plugin supports running ITs in isolation, but many ITs fail when run in isolation.
One example (there are many others):

```bash
mvn -Prun-its clean verify -Dinvoker.test=MSHADE-258_module_relocation
```

They fail because of a missing `target/it/setup-parent/pom.xml`.
The failure is logged in `target/it/setup-parent/build.log`.

The reason is that there is a missing parent dependency, which is apparently required for _any_ IT in this project.
When you run all the ITs together, it works by accident because the missing directory is created by some other test in the beginning of the IT test run, and then all subsequent tests work as well.

### Potential solution

A fix is to identify the broken ITs by running all of them in isolation and add the following to all of the broken ones:

```xml

org.apache.maven.plugins.shade.its
shade-parent
1.0
../setup-parent

```

It should be documented somewhere (maybe it is but I overlooked it?) that, when writing an IT, this _must_ be the parent.

The acceptance criteria for the fix should be:
1. `mvn -Run-its clean verify -Dinvoker.test=` must run the IT in isolation.
2. Optional, but nice if it works: after running the IT (or all ITs) once, it must be possible to debug the Maven project by doing `cd target/it/; mvnDebug install`.

(+) It satisfies both acceptance criteria.
(-) Every individual IT's `pom.xml` needs to be updated with a parent dependency it has no business with.
(-) It excludes writing an IT for a root project (that has no parent).

Maybe we can find a solution that doesn't involve updating all IT projects.
I'll need to investigate a bit more, first I'll need to figure out where the `setup-parent` project comes from.

---

**Affects:** 3.2.2

1 votes, 4 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Run `mvn -Prun-its clean verify -Dinvoker.test=MSHADE-258_module_relocation` and inspect `target/it/setup-parent/build.log` and the missing `target/it/setup-parent/pom.xml`. Review the affected integration-test `pom.xml` files and determine how `setup-parent` is provided. Done means an arbitrary IT runs in isolation, with `mvnDebug install` from its `target/it/` directory working if possible.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.