Skip to content

Temporary launch properties file is left behind when test preparation fails #7372

Description

@wborn

Description

When running openHAB integration tests with bnd-testing-maven-plugin 7.3.0, a temporary launch*.properties file can be left behind when the test fails while preparing the OSGi runtime, for example because the required bundles cannot be resolved.

We ran into this in openHAB here:

https://github.com/openhab/openhab-addons/actions/runs/31677377310/job/94374812202

openHAB currently uses bnd 7.3.0:

https://github.com/openhab/openhab-addons/blob/main/pom.xml

After the failed integration test, a generated launch*.properties file remains in the test module instead of being cleaned up. Since it is a temporary launcher artifact, it would be preferable for it to be removed on failure as well as on a normal test run.

Expected behavior

Temporary launcher files are cleaned up even if test preparation or bundle resolution fails before the OSGi framework is launched.

Actual behavior

If preparation fails, the temporary launch*.properties file remains on disk.

Possible cause

ProjectLauncherImpl creates the temporary launch properties file in its constructor and removes it from cleanup().

The testing path appears to have failure paths before the cleanup protected by ProjectLauncher.launch() is reached. In particular, ProjectTesterImpl.test() calls prepare() before calling getProjectLauncher().launch(), and ProjectLauncherImpl.launch() also calls prepare() before delegating to super.launch().

So if prepare() throws, for example due to a bundle resolution/preparation problem, cleanup() may never be called.

Looking at current master, this control flow appears to still be present, so this may not be specific to bnd 7.3.0.

Related issue

This looks similar to #326, where temporary launch*.properties files were left behind. That issue was fixed by calling cleanup() for the export path, so this may be an equivalent cleanup gap in the testing/preparation path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions