Skip to content

Commit

Permalink
Add Redpanda module (#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
stfnzl authored Apr 15, 2024
1 parent 0bc8c42 commit 59a62f4
Show file tree
Hide file tree
Showing 12 changed files with 536 additions and 2 deletions.
32 changes: 32 additions & 0 deletions docs/modules/redpanda.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Redpanda

Testcontainers can be used to automatically instantiate and manage [Redpanda](https://redpanda.com/) containers.
More precisely Testcontainers uses the official Docker images for [Redpanda](https://hub.docker.com/r/redpandadata/redpanda)

!!! note
This module uses features provided in `docker.redpanda.com/redpandadata/redpanda`.

## Install


```bash
npm install @testcontainers/redpanda --save-dev
```

## Example

<!--codeinclude-->
[Connect:](../../packages/modules/redpanda/src/redpanda-container.test.ts) inside_block:connectToKafka
<!--/codeinclude-->

<!--codeinclude-->
[Schema registry:](../../packages/modules/redpanda/src/redpanda-container.test.ts) inside_block:connectToSchemaRegistry
<!--/codeinclude-->

<!--codeinclude-->
[Admin APIs:](../../packages/modules/redpanda/src/redpanda-container.test.ts) inside_block:connectToAdmin
<!--/codeinclude-->

<!--codeinclude-->
[Rest Proxy:](../../packages/modules/redpanda/src/redpanda-container.test.ts) inside_block:connectToRestProxy
<!--/codeinclude-->
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ nav:
- PostgreSQL: modules/postgresql.md
- Qdrant: modules/qdrant.md
- Redis: modules/redis.md
- Redpanda: modules/redpanda.md
- Selenium: modules/selenium.md
- Weaviate: modules/weaviate.md
- Configuration: configuration.md
151 changes: 149 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions packages/modules/redpanda/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Config } from "jest";
import * as path from "path";

const config: Config = {
preset: "ts-jest",
moduleNameMapper: {
"^testcontainers$": path.resolve(__dirname, "../../testcontainers/src"),
},
};

export default config;
39 changes: 39 additions & 0 deletions packages/modules/redpanda/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@testcontainers/redpanda",
"version": "10.8.0",
"license": "MIT",
"keywords": [
"redpanda",
"testing",
"docker",
"testcontainers"
],
"description": "Redpanda module for Testcontainers",
"homepage": "https://github.com/testcontainers/testcontainers-node#readme",
"repository": {
"type": "git",
"url": "https://github.com/testcontainers/testcontainers-node"
},
"bugs": {
"url": "https://github.com/testcontainers/testcontainers-node/issues"
},
"main": "build/index.js",
"files": [
"build"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"prepack": "shx cp ../../../README.md . && shx cp ../../../LICENSE .",
"build": "tsc --project tsconfig.build.json"
},
"dependencies": {
"handlebars": "^4.7.8",
"testcontainers": "^10.8.0"
},
"devDependencies": {
"kafkajs": "^2.2.4",
"node-fetch": "^3.3.2"
}
}
7 changes: 7 additions & 0 deletions packages/modules/redpanda/src/bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Injected by testcontainers
# This file contains cluster properties which will only be considered when
# starting the cluster for the first time. Afterwards, you can configure cluster
# properties via the Redpanda Admi n API.

kafka_enable_authorization: false
auto_create_topics_enabled: true
1 change: 1 addition & 0 deletions packages/modules/redpanda/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { RedpandaContainer, StartedRedpandaContainer } from "./redpanda-container";
Loading

0 comments on commit 59a62f4

Please sign in to comment.