Struct sqllogictest::runner::Runner
source · pub struct Runner<D: AsyncDB, M: MakeConnection> { /* private fields */ }
Expand description
Sqllogictest runner.
Implementations§
source§impl<D: AsyncDB, M: MakeConnection<Conn = D>> Runner<D, M>
impl<D: AsyncDB, M: MakeConnection<Conn = D>> Runner<D, M>
sourcepub fn new(make_conn: M) -> Self
pub fn new(make_conn: M) -> Self
Create a new test runner on the database, with the given connection maker.
See MakeConnection
for more details.
sourcepub fn enable_testdir(&mut self)
pub fn enable_testdir(&mut self)
Replace the pattern __TEST_DIR__
in SQL with a temporary directory path.
This feature is useful in those tests where data will be written to local
files, e.g. COPY
.
pub fn with_validator(&mut self, validator: Validator)
pub fn with_column_validator( &mut self, validator: ColumnTypeValidator<D::ColumnType> )
pub fn with_hash_threshold(&mut self, hash_threshold: usize)
pub async fn apply_record( &mut self, record: Record<D::ColumnType> ) -> RecordOutput<D::ColumnType>
sourcepub async fn run_async(
&mut self,
record: Record<D::ColumnType>
) -> Result<(), TestError>
pub async fn run_async( &mut self, record: Record<D::ColumnType> ) -> Result<(), TestError>
Run a single record.
sourcepub fn run(&mut self, record: Record<D::ColumnType>) -> Result<(), TestError>
pub fn run(&mut self, record: Record<D::ColumnType>) -> Result<(), TestError>
Run a single record.
sourcepub async fn run_multi_async(
&mut self,
records: impl IntoIterator<Item = Record<D::ColumnType>>
) -> Result<(), TestError>
pub async fn run_multi_async( &mut self, records: impl IntoIterator<Item = Record<D::ColumnType>> ) -> Result<(), TestError>
Run multiple records.
The runner will stop early once a halt record is seen.
sourcepub fn run_multi(
&mut self,
records: impl IntoIterator<Item = Record<D::ColumnType>>
) -> Result<(), TestError>
pub fn run_multi( &mut self, records: impl IntoIterator<Item = Record<D::ColumnType>> ) -> Result<(), TestError>
Run multiple records.
The runner will stop early once a halt record is seen.
sourcepub async fn run_script_async(&mut self, script: &str) -> Result<(), TestError>
pub async fn run_script_async(&mut self, script: &str) -> Result<(), TestError>
Run a sqllogictest script.
sourcepub async fn run_script_with_name_async(
&mut self,
script: &str,
name: impl Into<Arc<str>>
) -> Result<(), TestError>
pub async fn run_script_with_name_async( &mut self, script: &str, name: impl Into<Arc<str>> ) -> Result<(), TestError>
Run a sqllogictest script with a given script name.
sourcepub async fn run_file_async(
&mut self,
filename: impl AsRef<Path>
) -> Result<(), TestError>
pub async fn run_file_async( &mut self, filename: impl AsRef<Path> ) -> Result<(), TestError>
Run a sqllogictest file.
sourcepub fn run_script_with_name(
&mut self,
script: &str,
name: impl Into<Arc<str>>
) -> Result<(), TestError>
pub fn run_script_with_name( &mut self, script: &str, name: impl Into<Arc<str>> ) -> Result<(), TestError>
Run a sqllogictest script with a given script name.
sourcepub fn run_file(&mut self, filename: impl AsRef<Path>) -> Result<(), TestError>
pub fn run_file(&mut self, filename: impl AsRef<Path>) -> Result<(), TestError>
Run a sqllogictest file.
sourcepub async fn run_parallel_async<Fut>(
&mut self,
glob: &str,
hosts: Vec<String>,
conn_builder: fn(_: String, _: String) -> Fut,
jobs: usize
) -> Result<(), ParallelTestError>where
Fut: Future<Output = D>,
pub async fn run_parallel_async<Fut>( &mut self, glob: &str, hosts: Vec<String>, conn_builder: fn(_: String, _: String) -> Fut, jobs: usize ) -> Result<(), ParallelTestError>where Fut: Future<Output = D>,
accept the tasks, spawn jobs task to run slt test. the tasks are (AsyncDB, slt filename) pairs.
sourcepub fn run_parallel<Fut>(
&mut self,
glob: &str,
hosts: Vec<String>,
conn_builder: fn(_: String, _: String) -> Fut,
jobs: usize
) -> Result<(), ParallelTestError>where
Fut: Future<Output = D>,
pub fn run_parallel<Fut>( &mut self, glob: &str, hosts: Vec<String>, conn_builder: fn(_: String, _: String) -> Fut, jobs: usize ) -> Result<(), ParallelTestError>where Fut: Future<Output = D>,
sync version of run_parallel_async
sourcepub async fn update_test_file(
&mut self,
filename: impl AsRef<Path>,
col_separator: &str,
validator: Validator,
column_type_validator: ColumnTypeValidator<D::ColumnType>
) -> Result<(), Box<dyn Error>>
pub async fn update_test_file( &mut self, filename: impl AsRef<Path>, col_separator: &str, validator: Validator, column_type_validator: ColumnTypeValidator<D::ColumnType> ) -> Result<(), Box<dyn Error>>
Updates a test file with the output produced by a Database. It is an utility function
wrapping [update_test_file_with_runner
].
Specifically, it will create "{filename}.temp"
to buffer the updated records and then
override the original file with it.
Some other notes:
- empty lines at the end of the file are cleaned.
halt
andinclude
are correctly handled.
Auto Trait Implementations§
impl<D, M> RefUnwindSafe for Runner<D, M>where D: RefUnwindSafe, M: RefUnwindSafe,
impl<D, M> Send for Runner<D, M>where D: Send, M: Send,
impl<D, M> Sync for Runner<D, M>where D: Sync, M: Sync,
impl<D, M> Unpin for Runner<D, M>where D: Unpin, M: Unpin,
impl<D, M> UnwindSafe for Runner<D, M>where D: UnwindSafe, M: UnwindSafe,
Blanket Implementations§
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> 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<D> OwoColorize for D
impl<D> OwoColorize for D
source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,
source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,
source§fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>
source§fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>
source§fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>
source§fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>
source§fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>
source§fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>
source§fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>
source§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
source§fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>
source§fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>
source§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
source§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
source§fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
source§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
source§fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>
source§fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>
source§fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>
source§fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>
source§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
source§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
source§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
source§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
source§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
source§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
source§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
source§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
source§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
source§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
source§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
source§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
source§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
source§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
source§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
source§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
source§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
source§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
source§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
source§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
source§fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>
source§fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>
source§fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>
source§fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>
source§fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
fn blink<'a>(&'a self) -> BlinkDisplay<'a, Self>
source§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
source§fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>
source§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read moresource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more