pub struct MssqlServer { /* private fields */ }
mssql_server
only.Expand description
Microsoft SQL Server module for testcontainers.
This module is based on the official Microsoft SQL Server for Linux Docker image. Only amd64 images are available for SQL Server. If you use Apple silicon machines, you need to configure Rosetta emulation.
§Example
use testcontainers_modules::{testcontainers::runners::SyncRunner, mssql_server};
let mssql_server = mssql_server::MssqlServer::default().with_accept_eula().start().unwrap();
let ado_connection_string = format!(
"Server=tcp:{},{};Database=test;User Id=sa;Password=yourStrong(!)Password;TrustServerCertificate=True;",
mssql_server.get_host().unwrap(),
mssql_server.get_host_port_ipv4(1433).unwrap()
);
§Environment variables
Refer to the documentation for a complite list of environment variables.
Following environment variables are required. A image provided by this module has default values for them.
§EULA Acceptance
Due to licensing restrictions you are required to explicitly accept an End User License Agreement (EULA) for the MS SQL Server container image.
This is facilitated through the explicit call of with_accept_eula
function.
Please see the microsoft-mssql-server image documentation for a link to the EULA document.
§MSSQL_SA_PASSWORD
The SA user password. This password is required to conform to the
strong password policy.
The default value is yourStrong(!)Password
.
§MSSQL_PID
The edition of SQL Server.
The default value is Developer
, which will run the container using the Developer Edition.
Implementations§
Source§impl MssqlServer
impl MssqlServer
Sourcepub const DEFAULT_SA_PASSWORD: &'static str = "yourStrong(!)Password"
pub const DEFAULT_SA_PASSWORD: &'static str = "yourStrong(!)Password"
Default Password for MSSQL_SA_PASSWORD
.
If you want to set your own password, please use [with_sa_password
]
Sourcepub fn with_sa_password(self, password: impl Into<String>) -> Self
pub fn with_sa_password(self, password: impl Into<String>) -> Self
Sets the password as MSSQL_SA_PASSWORD
.
Sourcepub fn with_accept_eula(self) -> Self
pub fn with_accept_eula(self) -> Self
Due to licensing restrictions you are required to explicitly accept an End User License Agreement (EULA) for the MS SQL Server container image.
This is facilitated through the with_accept_eula
function.
Please see the microsoft-mssql-server image documentation for a link to the EULA document.
Trait Implementations§
Source§impl Clone for MssqlServer
impl Clone for MssqlServer
Source§fn clone(&self) -> MssqlServer
fn clone(&self) -> MssqlServer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MssqlServer
impl Debug for MssqlServer
Source§impl Default for MssqlServer
impl Default for MssqlServer
Source§impl Image for MssqlServer
impl Image for MssqlServer
Source§fn tag(&self) -> &str
fn tag(&self) -> &str
Source§fn ready_conditions(&self) -> Vec<WaitFor>
fn ready_conditions(&self) -> Vec<WaitFor>
Source§fn env_vars(
&self,
) -> impl IntoIterator<Item = (impl Into<Cow<'_, str>>, impl Into<Cow<'_, str>>)>
fn env_vars( &self, ) -> impl IntoIterator<Item = (impl Into<Cow<'_, str>>, impl Into<Cow<'_, str>>)>
Source§fn mounts(&self) -> impl IntoIterator<Item = &Mount>
fn mounts(&self) -> impl IntoIterator<Item = &Mount>
Source§fn copy_to_sources(&self) -> impl IntoIterator<Item = &CopyToContainer>
fn copy_to_sources(&self) -> impl IntoIterator<Item = &CopyToContainer>
Source§fn entrypoint(&self) -> Option<&str>
fn entrypoint(&self) -> Option<&str>
Source§fn cmd(&self) -> impl IntoIterator<Item = impl Into<Cow<'_, str>>>
fn cmd(&self) -> impl IntoIterator<Item = impl Into<Cow<'_, str>>>
CMD
this image needs to be created with.Source§fn expose_ports(&self) -> &[ContainerPort]
fn expose_ports(&self) -> &[ContainerPort]
Source§fn exec_after_start(
&self,
cs: ContainerState,
) -> Result<Vec<ExecCommand>, TestcontainersError>
fn exec_after_start( &self, cs: ContainerState, ) -> Result<Vec<ExecCommand>, TestcontainersError>
Source§fn exec_before_ready(
&self,
cs: ContainerState,
) -> Result<Vec<ExecCommand>, TestcontainersError>
fn exec_before_ready( &self, cs: ContainerState, ) -> Result<Vec<ExecCommand>, TestcontainersError>
Auto Trait Implementations§
impl Freeze for MssqlServer
impl RefUnwindSafe for MssqlServer
impl Send for MssqlServer
impl Sync for MssqlServer
impl Unpin for MssqlServer
impl UnwindSafe for MssqlServer
Blanket Implementations§
Source§impl<T, I> AsyncRunner<I> for T
impl<T, I> AsyncRunner<I> for T
Source§fn start<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<ContainerAsync<I>, TestcontainersError>> + Send + 'async_trait>>where
T: 'async_trait,
fn start<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<ContainerAsync<I>, TestcontainersError>> + Send + 'async_trait>>where
T: 'async_trait,
ContainerAsync
.Source§fn pull_image<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<ContainerRequest<I>, TestcontainersError>> + Send + 'async_trait>>where
T: 'async_trait,
fn pull_image<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<ContainerRequest<I>, TestcontainersError>> + Send + 'async_trait>>where
T: 'async_trait,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<RI, I> ImageExt<I> for RI
impl<RI, I> ImageExt<I> for RI
Source§fn with_cmd(
self,
cmd: impl IntoIterator<Item = impl Into<String>>,
) -> ContainerRequest<I>
fn with_cmd( self, cmd: impl IntoIterator<Item = impl Into<String>>, ) -> ContainerRequest<I>
Source§fn with_name(self, name: impl Into<String>) -> ContainerRequest<I>
fn with_name(self, name: impl Into<String>) -> ContainerRequest<I>
{domain}/{owner}/{image}
).
Can be used to specify a custom registry or owner.Source§fn with_tag(self, tag: impl Into<String>) -> ContainerRequest<I>
fn with_tag(self, tag: impl Into<String>) -> ContainerRequest<I>
Source§fn with_container_name(self, name: impl Into<String>) -> ContainerRequest<I>
fn with_container_name(self, name: impl Into<String>) -> ContainerRequest<I>
Source§fn with_network(self, network: impl Into<String>) -> ContainerRequest<I>
fn with_network(self, network: impl Into<String>) -> ContainerRequest<I>
Source§fn with_label(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> ContainerRequest<I>
fn with_label( self, key: impl Into<String>, value: impl Into<String>, ) -> ContainerRequest<I>
Source§fn with_labels(
self,
labels: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
) -> ContainerRequest<I>
fn with_labels( self, labels: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, ) -> ContainerRequest<I>
Source§fn with_env_var(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> ContainerRequest<I>
fn with_env_var( self, name: impl Into<String>, value: impl Into<String>, ) -> ContainerRequest<I>
Source§fn with_host(
self,
key: impl Into<String>,
value: impl Into<Host>,
) -> ContainerRequest<I>
fn with_host( self, key: impl Into<String>, value: impl Into<Host>, ) -> ContainerRequest<I>
Source§fn with_mount(self, mount: impl Into<Mount>) -> ContainerRequest<I>
fn with_mount(self, mount: impl Into<Mount>) -> ContainerRequest<I>
Source§fn with_copy_to(
self,
target: impl Into<String>,
source: impl Into<CopyDataSource>,
) -> ContainerRequest<I>
fn with_copy_to( self, target: impl Into<String>, source: impl Into<CopyDataSource>, ) -> ContainerRequest<I>
Source§fn with_mapped_port(
self,
host_port: u16,
container_port: ContainerPort,
) -> ContainerRequest<I>
fn with_mapped_port( self, host_port: u16, container_port: ContainerPort, ) -> ContainerRequest<I>
Source§fn with_ulimit(
self,
name: &str,
soft: i64,
hard: Option<i64>,
) -> ContainerRequest<I>
fn with_ulimit( self, name: &str, soft: i64, hard: Option<i64>, ) -> ContainerRequest<I>
Source§fn with_privileged(self, privileged: bool) -> ContainerRequest<I>
fn with_privileged(self, privileged: bool) -> ContainerRequest<I>
Source§fn with_cap_add(self, capability: impl Into<String>) -> ContainerRequest<I>
fn with_cap_add(self, capability: impl Into<String>) -> ContainerRequest<I>
Source§fn with_cap_drop(self, capability: impl Into<String>) -> ContainerRequest<I>
fn with_cap_drop(self, capability: impl Into<String>) -> ContainerRequest<I>
Source§fn with_cgroupns_mode(self, cgroupns_mode: CgroupnsMode) -> ContainerRequest<I>
fn with_cgroupns_mode(self, cgroupns_mode: CgroupnsMode) -> ContainerRequest<I>
Source§fn with_userns_mode(self, userns_mode: &str) -> ContainerRequest<I>
fn with_userns_mode(self, userns_mode: &str) -> ContainerRequest<I>
Source§fn with_shm_size(self, bytes: u64) -> ContainerRequest<I>
fn with_shm_size(self, bytes: u64) -> ContainerRequest<I>
Source§fn with_startup_timeout(self, timeout: Duration) -> ContainerRequest<I>
fn with_startup_timeout(self, timeout: Duration) -> ContainerRequest<I>
Source§fn with_working_dir(self, working_dir: impl Into<String>) -> ContainerRequest<I>
fn with_working_dir(self, working_dir: impl Into<String>) -> ContainerRequest<I>
/
.Source§fn with_log_consumer(
self,
log_consumer: impl LogConsumer + 'static,
) -> ContainerRequest<I>
fn with_log_consumer( self, log_consumer: impl LogConsumer + 'static, ) -> ContainerRequest<I>
Source§fn with_user(self, user: impl Into<String>) -> ContainerRequest<I>
fn with_user(self, user: impl Into<String>) -> ContainerRequest<I>
Source§fn with_readonly_rootfs(self, readonly_rootfs: bool) -> ContainerRequest<I>
fn with_readonly_rootfs(self, readonly_rootfs: bool) -> ContainerRequest<I>
Source§fn with_security_opt(
self,
security_opt: impl Into<String>,
) -> ContainerRequest<I>
fn with_security_opt( self, security_opt: impl Into<String>, ) -> ContainerRequest<I>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, I> SyncRunner<I> for T
impl<T, I> SyncRunner<I> for T
Source§fn start(self) -> Result<Container<I>, TestcontainersError>
fn start(self) -> Result<Container<I>, TestcontainersError>
Container
.