You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running cargo test fails in database tests if no env variables are set:
cargo test -p fdo-db --lib Finished test [unoptimized + debuginfo] target(s) in 0.09s Running unittests src/lib.rs (target/debug/deps/fdo_db-307ba6269451e378)running 3 teststest sqlite::tests::test_manufacturer_database ... FAILEDtest sqlite::tests::test_owner_database ... FAILEDtest sqlite::tests::test_rendezvous_database ... FAILEDfailures:---- sqlite::tests::test_manufacturer_database stdout ----Current directory: Ok("/home/mmartinv/devel/src/github.com/fdo-rs/fido-device-onboard-rs/db")thread 'sqlite::tests::test_manufacturer_database' panicked at db/src/sqlite.rs:35:14:SQLITE_MANUFACTURER_DATABASE_URL must be set: NotPresentnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace---- sqlite::tests::test_owner_database stdout ----Current directory: Ok("/home/mmartinv/devel/src/github.com/fdo-rs/fido-device-onboard-rs/db")thread 'sqlite::tests::test_owner_database' panicked at db/src/sqlite.rs:103:51:SQLITE_OWNER_DATABASE_URL must be set: NotPresent---- sqlite::tests::test_rendezvous_database stdout ----Current directory: Ok("/home/mmartinv/devel/src/github.com/fdo-rs/fido-device-onboard-rs/db")thread 'sqlite::tests::test_rendezvous_database' panicked at db/src/sqlite.rs:221:14:SQLITE_RENDEZVOUS_DATABASE_URL must be set: NotPresentfailures: sqlite::tests::test_manufacturer_database sqlite::tests::test_owner_database sqlite::tests::test_rendezvous_databasetest result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00serror: test failed, to rerun pass `-p fdo-db --lib`
It would be great if the databases were created and configured automatically before running the tests.
Also some of the database tests fail when running the tests twice:
export SQLITE_MANUFACTURER_DATABASE_URL=sqlite://manufacturer.db ; diesel migration run --migration-dir migrations/migrations_manufacturing_server_sqlite --database-url $SQLITE_MANUFACTURER_DATABASE_URLRunning migration 2023-10-03-152801_create_dbexport SQLITE_OWNER_DATABASE_URL=sqlite://owner.dbdiesel migration run --migration-dir migrations/migrations_owner_onboarding_server_sqlite --database-url $SQLITE_OWNER_DATABASE_URLRunning migration 2023-10-03-152801_create_dbexport SQLITE_RENDEZVOUS_DATABASE_URL=sqlite://rendezvous.db ; diesel migration run --migration-dir migrations/migrations_rendezvous_server_sqlite --database-url $SQLITE_RENDEZVOUS_DATABASE_URL Running migration 2023-10-03-152801_create_dbmv *.db db/
# First execution goes wellcargo test -p fdo-db --lib Finished test [unoptimized + debuginfo] target(s) in 0.11s Running unittests src/lib.rs (target/debug/deps/fdo_db-307ba6269451e378)running 3 teststest sqlite::tests::test_rendezvous_database ... oktest sqlite::tests::test_manufacturer_database ... oktest sqlite::tests::test_owner_database ... oktest result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.14s
# Second execution failscargo test -p fdo-db --lib Finished test [unoptimized + debuginfo] target(s) in 0.09s Running unittests src/lib.rs (target/debug/deps/fdo_db-307ba6269451e378)running 3 teststest sqlite::tests::test_owner_database ... FAILEDtest sqlite::tests::test_manufacturer_database ... oktest sqlite::tests::test_rendezvous_database ... okfailures:---- sqlite::tests::test_owner_database stdout ----Current directory: Ok("/home/mmartinv/devel/src/github.com/fdo-rs/fido-device-onboard-rs/db")Error: UNIQUE constraint failed: owner_vouchers.guidfailures: sqlite::tests::test_owner_databasetest result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s
The text was updated successfully, but these errors were encountered:
mmartinv
changed the title
Database tests fails if no env variables are set and when they are run twice.
Database tests fail if no env variables are set and when they are run twice.
Feb 27, 2024
The second failure is expected (and just in the owner database) since the test does not remove all the OVs. The tests expect an empty database at every run.
Running
cargo test
fails in database tests if no env variables are set:It would be great if the databases were created and configured automatically before running the tests.
Also some of the database tests fail when running the tests twice:
The text was updated successfully, but these errors were encountered: