-
-
Notifications
You must be signed in to change notification settings - Fork 193
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 Clickhouse module #648
base: main
Are you sure you want to change the base?
Add Clickhouse module #648
Conversation
✅ Deploy Preview for testcontainers-node ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution, @tomershafir ! I've left some comments.
if (this.hostConfigPathXml) | ||
this.withCopyFilesToContainer([{source: this.hostConfigPathXml, target: CONFIG_PATH_XML, mode: CONFIG_FILE_MODE}]); | ||
if (this.hostConfigPathYaml) | ||
this.withCopyFilesToContainer([{source: this.hostConfigPathYaml, target: CONFIG_PATH_YAML, mode: CONFIG_FILE_MODE}]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although, those are very convenient, sometimes, can confuse to users when having multiple configurations. I'm not a ClickHouse expert, so, for now my suggestion would be to do not support those OOTB but rather have examples using the withCopyFilesToContainer
as part of the documentation.
|
||
function createClickhouseContainerHttpClient(container: StartedClickhouseContainer) { | ||
return createClient({ | ||
host: `http://${container.getHost()}:${container.getHostPorts().http}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this should be returned by the container implementation for easy access?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the client should be a different module rather than part the container abstraction
it also couples the dev to a dep he may not want (even though it may make sense to couple because its an official client), for example qryn project doesnt use this client atm
public getHostPorts(): {http: number; native: number} { | ||
return {http: this.httpHostPort, native: this.nativeHostPort} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the urls should be returned instead of the ports.
|
||
function createClickhouseContainerHttpClient(container: StartedClickhouseContainer) { | ||
return createClient({ | ||
host: container.getHttpUrl("http"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to the current support the getHttpUrl()
can return the http
protocol. If, at some point in the future, https is supported another method/fn can be added or revisited
@tomershafir please add your module under modules add file https://github.com/testcontainers/testcontainers-node/blob/main/mkdocs.yml. Otherwise it will be missing in the documentation. |
done, @cristianrgreco hey, can you merge? |
Thanks @tomershafir, please address the linting issues. The security alerts could also be solved by replacing |
done |
public getNativeUrl(schema: string): string { | ||
return this.toUrl(schema, this.hostNativePort) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you provide an example of this please? or better add a test :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as clickhouse-js doesnt support native protocol I removed the js methods. Added https one
972304e
to
1e24e78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @eddumelendez 🙂 Will merge when the build passes |
@tomershafir This test is failing: |
Add basic clickhouse module