Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

h1alexbel/cdit

Repository files navigation

logo

Managed By Self XDSD

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn maven central javadoc codecov

Hits-of-Code Lines-of-Code PDD status License

Project architect: @h1alexbel

A Collection of Pre-Configured Docker Containers for your Integration Tests.

Motivation. We are not happy with configuring Testcontainers again and again the same way, so we create a "hosted" home and fill it with common pre-configured Docker containers for integration testing.

Principles. These are the design principles behind cdit.

How to use. All you need is this (get the latest version here):

Maven:

<dependency>
  <groupId>io.github.h1alexbel</groupId>
  <artifactId>cdit</artifactId>
  <scope>test</scope>
</dependency>

Gradle:

dependencies {
    testCompile 'io.github.h1alexbel:cdit:<version>'
}

Running Containers

To create Docker container, for instance PostgreSQL, you can use

import org.cdit.containers.Postgres;
import org.cdit.containers.Env;

new Postgres(
  "latest",
  new Env("POSTGRES_USER", "user"),
  new Env("POSTGRES_PASSWORD", "AAAA...CCCC")
).run();

Now Docker container is up and running.

Creating Custom Containers

If you want to create your own container, you can extend ContainerEnvelope this way

import org.cdit.ContainerEnvelope;

public final class MyPrivateContainer extends ContainerEnvelope {
  public MyPrivateContainer(final String tag, final Env... vars) {
    super("ecr.io/myprivate:%s".formatted(tag), vars);
  }
}

now, you can run it

new MyPrivateContainer("0.0.1", new Env("test", "true")).run();

If you need more flexible configuration, it can be achieved by implementing Container

import org.cdit.Container;
import org.testcontainers.containers.GenericContainer;

public final class MyPrivateContainer implements Container {

  @Override
  public GenericContainer<?> run() {
    // your code
  }
}

How to Contribute

Fork repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

$ mvn clean install -Pinvoker

You will need Maven 3.8.7+ Java 17+, and Docker.

Our rultor image for CI/CD.

About

A Collection of Pre-Configured Docker Containers for your Integration Tests

Topics

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published