Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AB-xdev committed May 7, 2024
1 parent a6ccc28 commit f357fb4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# 1.0.1
* Improved demo

# 1.0.0
_Initial release_
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Basis Module for XDEV's Testcontainer Infrastructure Framework
| [Tracing](./tci-base/src/main/java/software/xdev/tci/tracing/) | Makes finding bottlenecks and similar problems easier |

## Usage
Checkout the [advanced demo](./tci-advanced-demo/) - as this is a reference implementation of the features - to get a feeling how this can be done.
Take a look at the [minimalistic demo](./tci-base-demo/) that showcases the components individually.

You may also checkout the [advanced demo](./tci-advanced-demo/) - a reference implementation of all features in a realistic project - to get a better feeling how this can be done.

> [!TIP]
> More detailed documentation is usually available in the corresponding [JavaDocs](https://javadoc.io/doc/software.xdev/tci-base).
Expand Down
5 changes: 5 additions & 0 deletions tci-base-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Minimalistic demo

This demo contains [test classes](./src/test/java/software/xdev/tci/) for the individual components.

Simply run the corresponding test from within your IDE.
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package software.xdev.tci.leak;

import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import software.xdev.tci.dummyinfra.DummyTCI;
import software.xdev.tci.dummyinfra.factory.DummyTCIFactory;


class LeakTest
{
private static final Logger LOG = LoggerFactory.getLogger(LeakTest.class);

static final DummyTCIFactory DUMMY_FACTORY = new DummyTCIFactory();

@SuppressWarnings({"java:S2699"})
Expand All @@ -17,6 +21,7 @@ void createLeak()
final DummyTCI tci = DUMMY_FACTORY.getNew(null);

// Imagine doing some testing here
LOG.info("ContainerId: {}", tci.getContainer().getContainerId());

// Forget to close/stop tci -> After the test is finished a warning will be visible in the logs!
// It can be fixed by commenting in the following code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void networkComparison(final Supplier<Network> networkSupplier) throws Exception
printAllNetworks();
}

@SuppressWarnings("resource")
static void printAllNetworks()
{
LOG.info("== ALL NETWORKS ===");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.Network;

Expand All @@ -17,7 +19,9 @@

class PortFixationLiveTest
{
@SuppressWarnings({"java:S2699", "java:S2925"})
private static final Logger LOG = LoggerFactory.getLogger(PortFixationLiveTest.class);

@SuppressWarnings({"resource", "java:S2699", "java:S2925"})
@ParameterizedTest
@ValueSource(booleans = {false, true})
void showCase(final boolean withFixation)
Expand Down Expand Up @@ -65,6 +69,8 @@ void showCase(final boolean withFixation)
.mapToInt(i -> i)
.anyMatch(port -> Objects.equals(port, expectedPort));

LOG.info("Can container be reached from host? - {}", containsExpectedPort);

// Only when fixation is active the port is exposed after connect!
Assertions.assertEquals(withFixation, containsExpectedPort);
}
Expand Down

0 comments on commit f357fb4

Please sign in to comment.