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

chore: made deriving Clone consistent #156

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/clickhouse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const CLICKHOUSE_PORT: ContainerPort = ContainerPort::Tcp(8123);
///
/// [`ClickHouse`]: https://clickhouse.com/
/// [`Clickhouse docker image`]: https://hub.docker.com/r/clickhouse/clickhouse-server
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct ClickHouse {
env_vars: BTreeMap<String, String>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/cockroach_db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const DEFAULT_IMAGE_TAG: &str = "v23.2.3";
/// [`Cockroach`]: https://www.cockroachlabs.com/
/// [`Cockroach docker image`]: https://hub.docker.com/r/cockroachdb/cockroach
/// [`Cockroach commands`]: https://www.cockroachlabs.com/docs/stable/cockroach-commands
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct CockroachDb {
cmd: CockroachDbCmd,
}
Expand Down
2 changes: 1 addition & 1 deletion src/consul/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const CONSUL_LOCAL_CONFIG: &str = "CONSUL_LOCAL_CONFIG";
///
/// [`Consul`]: https://www.consul.io/
/// [`Consul docker image`]: https://hub.docker.com/r/hashicorp/consul
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct Consul {
env_vars: BTreeMap<String, String>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/dynamodb_local/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const NAME: &str = "amazon/dynamodb-local";
const TAG: &str = "2.0.0";
const DEFAULT_WAIT: u64 = 3000;

#[derive(Default, Debug)]
#[derive(Default, Debug, Clone)]
pub struct DynamoDb;

impl Image for DynamoDb {
Expand Down
2 changes: 1 addition & 1 deletion src/elastic_search/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use testcontainers::{
const NAME: &str = "docker.elastic.co/elasticsearch/elasticsearch";
const TAG: &str = "7.16.1";

#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct ElasticSearch {
_priv: (),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing that I found interesting is this pattern vs (for example) pub struct DynamoDb;

Out of curiosity:
Is there a reason for having this unused member variable? ^^

Copy link
Contributor

@DDtKey DDtKey Jul 1, 2024

Choose a reason for hiding this comment

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

Is there a reason for having this unused member variable? ^^

Yes, to provide encapsulation, this allows the image to be extended without breaking future changes.

pub struct DynamoDb; allows you to create an instance simply by using DynamoDb (e.g DynamoDb.start()). Therefore adding a new field will break this usage.
Although ElasticSearch requires the use of new() or default() so that we can safely add new fields.

However, some images are still missing this pattern and should be updated in the future

}
Expand Down
2 changes: 1 addition & 1 deletion src/elasticmq/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use testcontainers::{core::WaitFor, Image};
const NAME: &str = "softwaremill/elasticmq";
const TAG: &str = "1.5.2";

#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct ElasticMq;

impl Image for ElasticMq {
Expand Down
2 changes: 1 addition & 1 deletion src/google_cloud_sdk_emulators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl IntoIterator for &CloudSdkCmd {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct CloudSdk {
exposed_ports: Vec<ContainerPort>,
ready_condition: WaitFor,
Expand Down
2 changes: 1 addition & 1 deletion src/hashicorp_vault/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const DEFAULT_IMAGE_TAG: &str = "1.17";
/// [`Hashicorp Vault`]: https://github.com/hashicorp/vault
/// [`Hashicorp Vault docker image`]: https://hub.docker.com/r/hashicorp/vault
/// [`Hashicorp Vault commands`]: https://developer.hashicorp.com/vault/docs/commands
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct HashicorpVault {
name: String,
tag: String,
Expand Down
2 changes: 1 addition & 1 deletion src/kafka/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const TAG: &str = "6.1.1";
pub const KAFKA_PORT: u16 = 9093;
const ZOOKEEPER_PORT: u16 = 2181;

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Kafka {
env_vars: HashMap<String, String>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/kwok/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DEFAULT_WAIT: u64 = 3000;
/// ```
///
/// No environment variables are required.
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct KwokCluster;

impl Image for KwokCluster {
Expand Down
2 changes: 1 addition & 1 deletion src/localstack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const DEFAULT_WAIT: u64 = 3000;
/// ```
///
/// No environment variables are required.
#[derive(Default, Debug)]
#[derive(Default, Debug, Clone)]
pub struct LocalStack {
_priv: (),
}
Expand Down
2 changes: 1 addition & 1 deletion src/mariadb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const TAG: &str = "11.3";
///
/// [`MariaDB`]: https://www.mariadb.com/
/// [`MariaDB docker image`]: https://hub.docker.com/_/mariadb
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct Mariadb {
_priv: (),
}
Expand Down
2 changes: 1 addition & 1 deletion src/minio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const TAG: &str = "RELEASE.2022-02-07T08-17-33Z";
const DIR: &str = "/data";
const CONSOLE_ADDRESS: &str = ":9001";

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct MinIO {
env_vars: HashMap<String, String>,
cmd: MinIOServerCmd,
Expand Down
2 changes: 1 addition & 1 deletion src/mongo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use testcontainers::{core::WaitFor, Image};
const NAME: &str = "mongo";
const TAG: &str = "5.0.6";

#[derive(Default, Debug)]
#[derive(Default, Debug, Clone)]
pub struct Mongo;

impl Image for Mongo {
Expand Down
2 changes: 1 addition & 1 deletion src/mssql_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use testcontainers::{core::WaitFor, Image};
///
/// The edition of SQL Server.
/// The default value is `Developer`, which will run the container using the Developer Edition.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct MssqlServer {
env_vars: HashMap<String, String>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/mysql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const TAG: &str = "8.1";
///
/// [`MySQL`]: https://www.mysql.com/
/// [`MySQL docker image`]: https://hub.docker.com/_/mysql
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct Mysql {
_priv: (),
}
Expand Down
2 changes: 1 addition & 1 deletion src/nats/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const TAG: &str = "2.10.14";
/// Nats image for [testcontainers](https://crates.io/crates/testcontainers).
///
/// This image is based on the official [Nats](https://hub.docker.com/_/nats) image.
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct Nats {
cmd: NatsServerCmd,
}
Expand Down
2 changes: 1 addition & 1 deletion src/oracle/free.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const DEFAULT_IMAGE_TAG: &str = "23-slim-faststart";
/// [`Oracle Database Free`]: https://www.oracle.com/database/free/
/// [Oracle official dockerfiles]: https://github.com/oracle/docker-images/tree/main/OracleDatabase
/// [`gvenzl/oracle-free:23-slim-faststart`]: https://hub.docker.com/r/gvenzl/oracle-free
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct Oracle {
_priv: (),
}
Expand Down
2 changes: 1 addition & 1 deletion src/orientdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use testcontainers::{core::WaitFor, Image};
const NAME: &str = "orientdb";
const TAG: &str = "3.2.19";

#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct OrientDb {
_priv: (),
}
Expand Down
2 changes: 1 addition & 1 deletion src/parity_parity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use testcontainers::{core::WaitFor, Image};
const NAME: &str = "parity/parity";
const TAG: &str = "v2.5.0";

#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct ParityEthereum {
_priv: (),
}
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const TAG: &str = "11-alpine";
///
/// [`Postgres`]: https://www.postgresql.org/
/// [`Postgres docker image`]: https://hub.docker.com/_/postgres
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Postgres {
env_vars: HashMap<String, String>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/redis/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const TAG: &str = "7.2.0-v8";
/// [`Redis Stack docker image`]: https://hub.docker.com/r/redis/redis-stack-server
/// [`Redis reference guide`]: https://redis.io/docs/interact/
/// [`REDIS_PORT`]: super::REDIS_PORT
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct RedisStack;

impl Image for RedisStack {
Expand Down
2 changes: 1 addition & 1 deletion src/redis/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const TAG: &str = "5.0";
/// [`Redis docker image`]: https://hub.docker.com/_/redis
/// [`Redis reference guide`]: https://redis.io/docs/interact/
/// [`REDIS_PORT`]: super::REDIS_PORT
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct Redis;

impl Image for Redis {
Expand Down
2 changes: 1 addition & 1 deletion src/solr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const TAG: &str = "9.5.0-slim";
/// [`Solr`]: https://solr.apache.org/
/// [`Solr docker image`]: https://hub.docker.com/_/solr
/// [`Solr reference guide`]: https://solr.apache.org/guide/solr/latest/
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct Solr {
_priv: (),
}
Expand Down
2 changes: 1 addition & 1 deletion src/surrealdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub const SURREALDB_PORT: ContainerPort = ContainerPort::Tcp(8000);
/// [`SurrealDB`]: https://surrealdb.com/
/// [`SurrealDB docker image`]: https://hub.docker.com/r/surrealdb/surrealdb
///
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct SurrealDb {
env_vars: HashMap<String, String>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/trufflesuite_ganachecli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use testcontainers::{core::WaitFor, Image};
const NAME: &str = "trufflesuite/ganache-cli";
const TAG: &str = "v6.1.3";

#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct GanacheCli {
cmd: GanacheCliCmd,
}
Expand Down
2 changes: 1 addition & 1 deletion src/victoria_metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const TAG: &str = "v1.96.0";
/// [`VictoriaMetrics`]: https://docs.victoriametrics.com/
/// [`VictoriaMetrics API examples`]: https://docs.victoriametrics.com/url-examples.html#victoriametrics-api-examples
/// [`VictoriaMetrics Docker image`]: https://hub.docker.com/r/victoriametrics/victoria-metrics
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct VictoriaMetrics;

impl Image for VictoriaMetrics {
Expand Down
2 changes: 1 addition & 1 deletion src/zookeeper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use testcontainers::{core::WaitFor, Image};
const NAME: &str = "bitnami/zookeeper";
const TAG: &str = "3.9.0";

#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct Zookeeper {
_priv: (),
}
Expand Down
Loading