Skip to content

Enable test-resources for integration tests, disable it for unit tests #766

@cfooks-mns

Description

@cfooks-mns

Feature description

Not sure if this is for test-resources or the Gradle plugin, but like @yibo-long's comment on #185, I would like to be able to disable test-resources entirely for unit tests and only enable it for integration tests.

As it stands, I have:

plugins {
    id("io.micronaut.application") version "4.4.2"
    id 'io.micronaut.test-resources' version '4.4.2'
    ...
}

micronaut {
    ...
    testResources {
        enabled.set(false)
    }
}

tasks.register('integrationTest', Test) {
    micronaut {
        testResources {
            enabled.set(true)
        }
    }
    ...
}

But this doesn't actually disable it …

Unfortunately, some third-party developers on our team are unable to run Docker but, when the plugin is used, Docker is checked and the build fails with:

[test-resources-service] 18:53:24.924 [pool-1-thread-1] ERROR o.t.d.DockerClientProviderStrategy - Could not find a valid Docker environment.

I'm going to investigate moving the integration tests into a submodule to see if I can only enable it in the submodule, but it'd be nice if I didn't need to work around it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: improvementA minor improvement to an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions