Testing | db-dumper-rust | Spatie       

 SPATIE  

db-dumper-rust
==============

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Db-dumper-rust](https://spatie.be/docs/db-dumper-rust/v1)  Testing

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/db-dumper-rust/v1) 

  Testing    
- [ Introduction ](https://spatie.be/docs/db-dumper-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/db-dumper-rust/v1/support-us)
- [ Requirements ](https://spatie.be/docs/db-dumper-rust/v1/requirements)
- [ Installation ](https://spatie.be/docs/db-dumper-rust/v1/installation)
- [ Usage ](https://spatie.be/docs/db-dumper-rust/v1/usage)
- [ Testing ](https://spatie.be/docs/db-dumper-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/db-dumper-rust/v1/changelog)
- [ Contributing ](https://spatie.be/docs/db-dumper-rust/v1/contributing)
- [ Security Vulnerabilities ](https://spatie.be/docs/db-dumper-rust/v1/security-vulnerabilities)
- [ Credits ](https://spatie.be/docs/db-dumper-rust/v1/credits)
- [ License ](https://spatie.be/docs/db-dumper-rust/v1/license)
- [ PHP parity ](https://spatie.be/docs/db-dumper-rust/v1/parity)

 Testing
=======

###  On this page 

1. [ Rust checks ](#content-rust-checks)
2. [ Native database tests ](#content-native-database-tests)

 ```
cargo test --locked
```

Rust checks
-----------------------------------------------------------------------------------------

```
cargo fmt --all -- --check
cargo clippy --locked --all-targets -- -D warnings
cargo test --locked --all-targets
cargo test --locked --doc
RUSTDOCFLAGS='-D warnings' cargo doc --locked --no-deps
cargo +1.89.0 test --locked --all-targets
cargo +1.89.0 test --locked --doc
cargo audit --deny warnings
```

Install `cargo-audit` with `cargo install cargo-audit --locked` first. The portable tests compile a small Rust fixture executable. They need no running database and run on Linux, macOS and Windows in CI. The documentation's database examples compile as doctests with `no_run`; they retain the PHP examples' assumption that you supply database credentials and have the matching tool installed.

Native database tests
-----------------------------------------------------------------------------------------------------------------------

Run these only against disposable databases named `db_dumper_test*`. They create and drop fixture tables; the MySQL/MariaDB tests also create and drop the named database. MongoDB's test replaces its `things` collection. The PostgreSQL test database must exist first.

SQLite tests need `sqlite3`, `gzip` and `bzip2`:

```
cargo test --locked --test native_tools sqlite_ -- --ignored --nocapture
```

The server tests use `DB_DUMPER_MYSQL_URL`, `DB_DUMPER_MARIADB_URL`, `DB_DUMPER_POSTGRESQL_URL` and `DB_DUMPER_MONGODB_URL`. Set these in your environment, not in source control. Install each database's client and dump executable. MongoDB's test also needs `mongorestore`. To point the MySQL test at a different client directory, put that directory on PATH and set `DB_DUMPER_MYSQL_URL_BINARY_PATH` to it.

```
cargo test --locked --test native_tools mysql_native_roundtrip -- --ignored --nocapture
cargo test --locked --test native_tools mariadb_native_roundtrip -- --ignored --nocapture
cargo test --locked --test native_tools postgresql_native_roundtrip -- --ignored --nocapture
cargo test --locked --test native_tools mongodb_native_archive_roundtrip -- --ignored --nocapture
```

The CI workflow provisions all four database services and runs a separate native-client job for each database. Native tests restore dumps and compare row values, not just file sizes. SQLite tests also cover selection, source/output aliases, gzip/bzip2 and a WAL snapshot while another connection writes. MySQL/MariaDB tests verify table-data exclusions, AUTO\_INCREMENT filtering, and triggers that must not fire during restoration but must work afterwards.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
