`testcontainers-ignition`: a Java library for testing with Ignition Docker containers

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

This project is a Testcontainers implementation for Ignition.
Developing a module and want to automatically start a gateway, load your module, and test against it? This library is for you!

Example

Java, using try-with-resources:

void createIgnitionGateway() throws FileNotFoundException {
    try (IgnitionContainer ignition = new IgnitionContainer("inductiveautomation/ignition:8.1.33")
            .withCredentials("myUsername", "myPassword")
            .withEdition(GatewayEdition.STANDARD)
            .withModules(GatewayModule.PERSPECTIVE)
            .withGatewayBackup("./path/to/backup.gwbk")
            .withThirdPartyModules("./path/to/module.modl")
            .acceptLicense()) {
        ignition.start();
        String url = ignition.getGatewayUrl();
        // ... do something with your gateway!
    }
}

Gradle

dependencies {
    testImplementation("com.mussonindustrial:testcontainers-ignition:0.1.0")
}

Maven

<dependency>
    <groupId>com.mussonindustrial</groupId>
    <artifactId>testcontainers-ignition</artifactId>
    <version>0.3.0</version>
</dependency>

Future work:

  1. Version 1.0.0 after more testing.
  2. Might eventually combine this with my Node.js version and try to submit it as a proper testcontainers community module. Unless IA wants to help make it official… :eyes:
  3. 8.3 support. Right now there's an only small amount of configuration you can reasonably apply to a gateway (without jumping through multiple hoops), but that's going to change with 8.3.

Sources

Sponsorship

If you benefit from this library for commercial use, we ask you to consider sponsoring our efforts through GitHub sponsors . Your support will allow us to continue development of open-source modules and tools that benefit the entire community (plus there are some bonuses for sponsors :slightly_smiling_face:).

Neat, I was just exploring/researching this idea the other week.

I submitted a couple PRs to your repo, one cosmetic, and one with a change that allows additional exposed ports to be configured.

Thanks for bump, I didn’t have any notifications on. :see_no_evil:

Version 0.2.0 is released, now with:

  • Checks for missing gateway backup/third-party module files.
  • Changes to mapped port methods.
  • Better testing.
  • Closer alignment to testcontainers conventions.
  • Javadocs

FYI, all releases before 1.0.0 should be considered unstable.

Version 0.3.0 is out!

Changes from 0.2.X:

  • Users must accept the EULA themselves through .acceptLicense().
  • Added support for additional JVM/Wrapper/Gateway arguments.
  • Refactored Modules into an interface, for when IA releases modules that are not known by this library.
  • Better regression tests.
  • Listed in the testcontainers community registry!

Release Notice, v0.5.0

This release adds 8.3 support, and preps the library for future capabilities/Docker image changes.

New things:

  • Better health check.
  • Full third-party module support for 8.3.
    • Third-party module certificates and licenses are automatically accepted.
    • Third-party modules dependencies are automatically included (i.e. if a module depends on Perspective, Perspective will automatically be included).
  • Added withAllowUnsignedModules, to enable unsigned module support.
  • Added dedicated "profiles" for 8.1 and 8.3, allowing the library to support both existing versions + future versions.
    • Profiles have their own set of supported container capabilities.
    • Warnings are thrown if you try to use a capability that is not supported by the Ignition container version (i.e. trying to use withQuickStart on < 8.1.23).

Thanks to @Kevin.Herron for health check and module.xml parsing ideas!