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

feat: add CrateDB module #236

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

surister
Copy link

Solves #198

cc @kneth

@DDtKey DDtKey changed the title feat: Add CrateDB module feat: add CrateDB module Oct 20, 2024
@mervyn-mccreight
Copy link
Contributor

Thanks for your contribution 🚀
Can you please check the formatting plus the clippy errors?

@mervyn-mccreight
Copy link
Contributor

Seems like rustfmt is still failing

Copy link
Contributor

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

Hi, sorry for the late reviews.

I usually would not review so late in the cycle, but I think the docs currently would not work as you intended.

Comment on lines +12 to +15
/// super_user: crate
/// password: <empty>
/// pg_port: 5432
/// http_port: 4200
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// super_user: crate
/// password: <empty>
/// pg_port: 5432
/// http_port: 4200
/// - `super_user`: `crate`
/// - `password`: <empty>
/// - `pg_port`: `5432`
/// - `http_port`: `4200`

Comment on lines +23 to +34
/// use testcontainers_modules::{postgres, testcontainers::runners::SyncRunner};
///
/// let postgres_instance = cratedb::CrateDB::default().start().unwrap();
///
/// let connection_string = format!(
/// "postgres://crate@{}:{}/postgres",
/// postgres_instance.get_host().unwrap(),
/// postgres_instance.get_host_port_ipv4(5432).unwrap()
/// );
///
/// let mut conn = postgres::Client::connect(connection_string, postgres::NoTls).unwrap();
/// let rows = conn.query("SELECT 1 + 1", &[]).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

currently, this is not a doctest

Suggested change
/// use testcontainers_modules::{postgres, testcontainers::runners::SyncRunner};
///
/// let postgres_instance = cratedb::CrateDB::default().start().unwrap();
///
/// let connection_string = format!(
/// "postgres://crate@{}:{}/postgres",
/// postgres_instance.get_host().unwrap(),
/// postgres_instance.get_host_port_ipv4(5432).unwrap()
/// );
///
/// let mut conn = postgres::Client::connect(connection_string, postgres::NoTls).unwrap();
/// let rows = conn.query("SELECT 1 + 1", &[]).unwrap();
/// ```
/// use testcontainers_modules::{postgres, testcontainers::runners::SyncRunner};
///
/// let postgres_instance = cratedb::CrateDB::default().start().unwrap();
///
/// let connection_string = format!(
/// "postgres://crate@{}:{}/postgres",
/// postgres_instance.get_host().unwrap(),
/// postgres_instance.get_host_port_ipv4(5432).unwrap()
/// );
///
/// let mut conn = postgres::Client::connect(connection_string, postgres::NoTls).unwrap();
/// let rows = conn.query("SELECT 1 + 1", &[]).unwrap();
/// # assert_eq!(rows.len(), 1);
/// ```

}

impl CrateDB {
/// Sets CrateDB's heap size, only increase it if you are testing big high volumes of data.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Sets CrateDB's heap size, only increase it if you are testing big high volumes of data.
/// Sets CrateDB's heap size
///
/// You may need to increase this if you are testing high volumes of data.

}

fn copy_to_sources(&self) -> impl IntoIterator<Item = &CopyToContainer> {
&self.copy_to_sources
Copy link
Contributor

Choose a reason for hiding this comment

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

This is never set to anything other than Vec::new... Is this intentional?

Comment on lines +89 to +92

use super::*;
use testcontainers::{runners::SyncRunner, ImageExt};
#[test]
Copy link
Contributor

Choose a reason for hiding this comment

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

This fixes the linting issue raised by rustfmt

Suggested change
use super::*;
use testcontainers::{runners::SyncRunner, ImageExt};
#[test]
use super::*;
use crate::testcontainers::{runners::SyncRunner, ImageExt};
#[test]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants