testcontainers / testcontainers-rs

A library for integration-testing against docker containers from within Rust.
https://rust.testcontainers.org
Apache License 2.0
677 stars 129 forks source link

Support `rustls` #671

Closed FalkWoldmann closed 1 month ago

FalkWoldmann commented 1 month ago

Hi, it would be great if testcontainers could be built without relying on openssl-sys, as setting it up can be quite cumbersome, especially in CI/CD environments. Instead, could rustls be used as an alternative? It appears that openssl-sys is being included via reqwest:

cargo tree  --target all -i openssl-sys
openssl-sys v0.9.102
├── native-tls v0.2.12
│   ├── hyper-tls v0.6.0
│   │   └── reqwest v0.12.5
│   │       └── testcontainers v0.18.0
│   │           └── my-crate
│   ├── reqwest v0.12.5 (*)
│   └── tokio-native-tls v0.3.1
│       ├── hyper-tls v0.6.0 (*)
│       └── reqwest v0.12.5 (*)
└── openssl v0.10.64
    └── native-tls v0.2.12 (*)

It would be great if testcontainers would introduce a feature flag to toggle the rustls functionality in reqwest. Perhaps one could even argue that this should be the default behavior.

DDtKey commented 1 month ago

Hi @FalkWoldmann !

Yes, of course, supporting the switch by a feature is pretty simple part, and in general this was kept in mind before adding the reqwest (e.g the default features are disabled, and specified explicitly already)

Actually, I even think that rustls might be a default for testcontainers (but this should be considered as a breaking change)

I'll try to update this today and release a new version

DDtKey commented 1 month ago

I just switched to rustls by default, native-tls can be enabled explicitly by adding reqwest to custom code dependencies if needed (features are additive)

Later we can consider ability to disable tls at all, but it's used for underlying docker client too (rustls backend)

I'll prepare a release soon