acrate_database: Add connect tests

This commit is contained in:
Steffo 2024-12-13 04:06:26 +01:00
parent 7e62707e1e
commit b43cc8aa3e
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
4 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,22 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="buildProfileId" value="dev" />
<option name="command" value="test" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs>
<env name="ACRATE_DATABASE_URL" value="postgres:///acrate?host=/run/postgresql/" />
</envs>
<option name="emulateTerminal" value="true" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="true" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<option name="isRedirectInput" value="false" />
<option name="redirectInputPath" value="" />
<method v="2">
<option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
</method>
</configuration>
</component>

View file

@ -0,0 +1,22 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test ignored" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="buildProfileId" value="dev" />
<option name="command" value="test -- --ignored" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs>
<env name="ACRATE_DATABASE_URL" value="postgres:///acrate?host=/run/postgresql/" />
</envs>
<option name="emulateTerminal" value="true" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="true" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<option name="isRedirectInput" value="false" />
<option name="redirectInputPath" value="" />
<method v="2">
<option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
</method>
</configuration>
</component>

View file

@ -19,11 +19,13 @@ micronfig = { version = "0.3.0", optional = true }
mime = "0.3.17"
pretty_env_logger = { version = "0.5.0", optional = true }
uuid = "1.11.0"
tokio = { version = "1.42.0", optional = true }
[features]
default = ["connect"]
bin = ["diesel_migrations", "pretty_env_logger", "connect"]
connect = ["micronfig"]
tests = ["tokio", "connect"]
[lib]
name = "acrate_database"

View file

@ -0,0 +1,15 @@
use acrate_database::connect::{connect_async, connect_sync};
#[test]
#[ignore]
fn test_connect_sync() -> diesel::ConnectionResult<()> {
connect_sync()?;
Ok(())
}
#[tokio::test]
#[ignore]
async fn test_connect_async() -> diesel::ConnectionResult<()> {
connect_async().await?;
Ok(())
}