Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testcontainers failure with kafka using latest testcontainer version #51

Closed
Ckram opened this issue Sep 22, 2023 · 2 comments
Closed

Testcontainers failure with kafka using latest testcontainer version #51

Ckram opened this issue Sep 22, 2023 · 2 comments
Labels
bug Something isn't working kafka

Comments

@Ckram
Copy link

Ckram commented Sep 22, 2023

Since testcontainer testcontainers/testcontainers-java#7333

Advertised listeners are added with container hostname in

    protected String brokerAdvertisedListener(InspectContainerResponse containerInfo) {
        return String.format("BROKER://%s:%s", containerInfo.getConfig().getHostName(), "9092");
    }

However kubedock is not returning hostname information for call /containers/{id}/json

in json path $.Config.Hostname

{
    "Config": {
        "Cmd": [
            "-c",
            "while [ ! -f /testcontainers_start.sh ]; do sleep 0.1; done; /testcontainers_start.sh"
        ],
        "Env": [
            "KAFKA_LOG_FLUSH_INTERVAL_MESSAGES=9223372036854775807",
            "KAFKA_BROKER_ID=1",
            "KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=1",
            "KAFKA_ZOOKEEPER_CONNECT=localhost:2181",
            "KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS=1",
            "KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=1",
            "KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1",
            "KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9093,BROKER://0.0.0.0:9092",
            "KAFKA_INTER_BROKER_LISTENER_NAME=BROKER",
            "KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0",
            "KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=BROKER:PLAINTEXT,PLAINTEXT:PLAINTEXT"
        ],
        "Image": "confluentinc/cp-kafka:7.2.2",
        "Labels": {
            "com.joyrex2001.kubedock.pull-policy": "ifnotpresent",
            "com.joyrex2001.kubedock.runas-user": "0",
            "com.joyrex2001.kubedock.service-account": "default",
            "org.testcontainers": "true",
            "org.testcontainers.lang": "java",
            "org.testcontainers.sessionId": "61f69934-1293-47a7-8a83-c34d45477150",
            "org.testcontainers.version": "1.19.0"
        },
        "Tty": false
    },
    "Created": "2023-09-22T08:27:19Z",
    "HostConfig": {
        "LogConfig": {
            "Config": {},
            "Type": "json-file"
        },
        "NetworkMode": "bridge"
    },
    "Id": "30539bcf9ea636c91c42b9fc88c6cc7e911f75e3da93dc02b723025c8d1cd27b",
    "Image": "confluentinc/cp-kafka:7.2.2",
    "Name": "/",
    "Names": [
        "/30539bcf9ea636c91c42b9fc88c6cc7e911f75e3da93dc02b723025c8d1cd27b",
        "/30539bcf9ea6"
    ],
    "NetworkSettings": {
        "IPAddress": "127.0.0.1",
        "Networks": {
            "bridge": {
                "Aliases": null,
                "IPAddress": "127.0.0.1",
                "NetworkID": "0418b65c2fbf92590ee4ccb1ac52ca2f6c69a865a7d8352d4c634734e77e1061"
            }
        },
        "Ports": {
            "2181/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "63606"
                }
            ],
            "9093/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "63605"
                }
            ]
        }
    },
    "State": {
        "Dead": false,
        "Error": "",
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Health": {
            "Status": "healthy"
        },
        "OOMKilled": false,
        "Paused": false,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2023-09-22T08:27:19Z",
        "Status": "Up"
    }
}%

Issue similar to #43

@joyrex2001 joyrex2001 added bug Something isn't working kafka labels Sep 22, 2023
@joyrex2001
Copy link
Owner

Good find, added the Hostname in the container details.

@joyrex2001
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working kafka
Projects
None yet
Development

No branches or pull requests

2 participants