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

Add Redpanda module #743

Merged

Conversation

stfnzl
Copy link
Contributor

@stfnzl stfnzl commented Apr 1, 2024

This PR adds a Redpanda module.

Copy link

netlify bot commented Apr 1, 2024

Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit 2165b67
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-node/deploys/661272b2a7aa940008f38ea7
😎 Deploy Preview https://deploy-preview-743--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@cristianrgreco cristianrgreco added enhancement New feature or request minor Backward compatible functionality labels Apr 1, 2024
@cristianrgreco
Copy link
Collaborator

Thanks for the contribution @stfnzl. Could you have a look at the failing tests?

@stfnzl
Copy link
Contributor Author

stfnzl commented Apr 2, 2024

@cristianrgreco tests are failing on podman, which i'm not really familiar with. I installed podman and ran the test locally and they pass though...

Copy link
Member

@eddumelendez eddumelendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, @stfnzl ! I've left a few comments.

Comment on lines +84 to +90
public getAdminAddress(): string {
return `http://${this.getHost()}:${this.getMappedPort(REDPANDA_ADMIN_PORT)}`;
}

public getRestProxyAddress(): string {
return `http://${this.getHost()}:${this.getMappedPort(REST_PROXY_PORT)}`;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please add some tests for those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 46 to 57
const client = await getContainerRuntimeClient();
const container = client.container.getById(inspectResult.name.substring(1));
const renderedRedpandaFile = path.join(os.tmpdir(), `redpanda-${container.id}.yaml`);
fs.writeFileSync(
renderedRedpandaFile,
this.renderRedpandaFile(client.info.containerRuntime.host, inspectResult.ports[REDPANDA_PORT][0].hostPort)
);
const tar = archiver("tar");
tar.file(renderedRedpandaFile, { name: "/etc/redpanda/redpanda.yaml" });
tar.finalize();
await client.container.putArchive(container, tar, "/");
fs.unlinkSync(renderedRedpandaFile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be replaced by using container.copyContentToContainer. See kafka-container as a reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I took a deeper look on how kafka was implemented and adapted to use copyContentToContainer

@cristianrgreco cristianrgreco merged commit 59a62f4 into testcontainers:main Apr 15, 2024
125 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor Backward compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants