Crate testkit_core

Source

Re-exports§

pub use utils::*;

Modules§

boxed
callsite
Callsites represent the source locations from which spans or events originate.
dispatcher
Dispatches trace events to Subscribers.
event
Events represent single points in time during the execution of a program.
field
Span and Event key-value data.
instrument
Attach a span to a std::future::Future.
level_filters
Trace verbosity level filtering.
metadata
Metadata describing trace data.
span
Spans represent periods of time in which a program was executing in a particular context.
subscriber
Collects and records trace data.
tests
Testing utilities for working with database handlers in a mock environment
transaction
utils

Macros§

boxed_async
Macro to automatically box an async block for use with the boxed database API
db_test
A more ergonomic macro for database operations that hides all the boxing complexity
debug
Constructs an event at the debug level.
debug_span
Constructs a span at the debug level.
enabled
Checks whether a span or event is enabled based on the provided metadata.
error
Constructs an event at the error level.
error_span
Constructs a span at the error level.
event
Constructs a new Event.
event_enabled
Tests whether an event with the specified level and target would be enabled.
impl_transaction_handler
Macro to implement the TransactionHandler trait for a type
info
Constructs an event at the info level.
info_span
Constructs a span at the info level.
metadata
Statically constructs new span metadata.
setup
A macro to simplify setting up a database
setup_and_transaction
A macro to simplify both setup and transaction phases
span
Constructs a new span.
span_enabled
Tests whether a span with the specified level and target would be enabled.
trace
Constructs an event at the trace level.
trace_span
Constructs a span at the trace level.
transaction
A macro to simplify running a transaction
warn
Constructs an event at the warn level.
warn_span
Constructs a span at the warn level.

Structs§

AndThenHandler
Handler that executes two handlers in sequence
BoxedDatabaseEntryPoint
Entry point for database operations with automatic boxing of closures
DatabaseConfig
Configuration for database connections
DatabaseName
A unique database name
DatabaseTransactionHandler
Handler that combines a database instance with transaction management
DbTransactionHandlerWrapper
Helper wrapper for DatabaseTransactionHandler
Dispatch
Dispatch trace data to a Subscriber.
Event
Events represent single points in time where something occurred during the execution of a program.
Id
Identifies a span within the context of a subscriber.
Level
Describes the level of verbosity of a span or event.
Metadata
Metadata describing a span or event.
MockConnectionFor
MockTransactionFor
SetupHandler
Handler for database setup operations
SetupHandlerWrapper
Helper wrapper for SetupHandler
Span
A handle representing a span, with the capability to enter the span if it exists.
TestContext
A test context that contains a database instance
TestDatabaseInstance
A test database that handles setup, connections, and cleanup TODO: Create a TestManager that can handle connection pooling and cleanup
TransactionFnHandler
Handler for executing functions within a transaction
TransactionFnHandlerWrapper
Helper wrapper for TransactionFnHandler

Traits§

Callsite
Trait implemented by callsites.
DatabaseBackend
Trait defining a test database abstraction
DatabaseHandler
Trait for handlers that can be executed in the context of a database
DatabasePool
Instrument
Attaches spans to a std::future::Future.
IntoTransactionHandler
A trait for converting types into transaction handlers
Subscriber
Trait representing the functions required to collect trace data.
TestDatabaseConnection
TransactionHandler
A trait for handlers that can work with transactions
TransactionStarter
A helper trait to simplify type constraints
Value
A field value of an erased type.

Functions§

init_tracing
Initialize tracing for the application. Only initializes if RUST_ENV is set to “DEBUG”
run_with_database
Helper function to run a handler with a new database
setup
Create a new setup handler
with_boxed_database
Create a new database entry point with the given backend
with_boxed_database_config
Create a new database entry point with the given backend and config
with_connection
Execute a function with a newly created connection and automatically close it
with_connection_string
Execute a function with a newly created connection using a connection string
with_database
Database handlers for the testkit crate
with_database_config
Database handlers for the testkit crate
with_db_transaction
Create a new database transaction handler
with_transaction
Create a new transaction function handler

Attribute Macros§

instrument
Instruments a function to create and enter a tracing span every time the function is called.