Skip to content

Commit 9c35d0e

Browse files
committed
crates_io_test_db: Add README.md
1 parent eb46844 commit 9c35d0e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

crates/crates_io_test_db/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# crates_io_test_db
2+
3+
This package contains the code necessary to create test databases for testing
4+
purposes.
5+
6+
`TestDatabase::new()` can be used to create a new test database, based on a
7+
template database, which is lazily created the first time it is needed.
8+
9+
The databases are created based on the `TEST_DATABASE_URL` environment variable,
10+
which should be set to a valid database URL. The template database will then be
11+
created with a similar name and `_template` suffix, while the test databases
12+
will use random suffixes.
13+
14+
Note that the template database will be created with applied database migrations,
15+
so if you need an empty database, this is not the right tool for you.

crates/crates_io_test_db/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![doc = include_str!("../README.md")]
2+
13
use crates_io_env_vars::required_var_parsed;
24
use diesel::prelude::*;
35
use diesel::r2d2::{ConnectionManager, Pool, PooledConnection};

0 commit comments

Comments
 (0)