fix test failures and nits

This commit is contained in:
Brandon Thomas committed 2023-11-29 02:43:31 -05:00
1 parent 038401bff4
commit c6fbfaa6ba
5 files changed
+14 -30

No files matched your search

@@ -133,7 +133,7 @@ mod tests {
fn all_variants() {
// Static check
let mut variants = IdCategory::all_variants();
assert_eq!(variants.len(), 6);
assert_eq!(variants.len(), 7);
assert_eq!(variants.pop_first(), Some(IdCategory::MediaFile));
assert_eq!(variants.pop_first(), Some(IdCategory::LipsyncAnimationResult));
assert_eq!(variants.pop_first(), Some(IdCategory::VoiceConversionResult));
+1 -6
View File
@@ -5,19 +5,14 @@ use sqlx::mysql::MySqlPoolOptions;
use config::shared_constants::{DEFAULT_MYSQL_CONNECTION_STRING, DEFAULT_RUST_LOG};
use errors::AnyhowResult;
use crate::seeding::model_weights::seed_weights;
use crate::seeding::model_weights::seed_weights_for_user_token;
use crate::bucket_clients::get_bucket_clients;
use crate::cli_args::parse_cli_args;
use crate::seeding::model_weights::seed_weights;
use crate::seeding::tts_tacotron2::seed_tts_tacotron2;
use crate::seeding::users::seed_user_accounts;
use crate::seeding::voice_conversion::seed_voice_conversion;
use crate::seeding::zero_shot_tts::seed_zero_shot_tts;
pub mod bucket_clients;
pub mod cli_args;
@@ -1,19 +1,13 @@
use chrono::{DateTime, Utc};
use sqlx::{Acquire, MySqlConnection, MySqlPool};
use anyhow::anyhow;
use chrono::{ DateTime, Utc };
use enums::by_table::model_weights::weights_types;
use log::{ info, warn };
use sqlx::{ MySql, MySqlPool, query, Acquire, MySqlConnection };
use sqlx::pool::PoolConnection;
use enums::by_table::model_weights::{
weights_category::WeightsCategory,
weights_types::WeightsType,
};
use enums::common::visibility::Visibility;
use errors::AnyhowResult;
use tokens::tokens::model_weights::ModelWeightToken;
use enums::by_table::model_weights::{
weights_types::WeightsType,
weights_category::WeightsCategory,
};
use tokens::tokens::users::UserToken;
#[derive(Serialize)]
@@ -136,7 +130,7 @@ async fn get_raw_weights_by_creator_username(
"#,
creator_username).fetch_all(connection)
.await?;
return Ok(raw_weights);
Ok(raw_weights)
} else {
let raw_weights: Vec<RawWeightJoinUser> = sqlx::query_as!(
RawWeightJoinUser,
@@ -1,15 +1,10 @@
use anyhow::anyhow;
use sqlx::MySqlPool;
use log::info;
use sqlx::mysql::MySqlPoolOptions;
use enums::common::visibility::Visibility;
use errors::AnyhowResult;
use tokens::tokens::model_weights::ModelWeightToken;
use config::shared_constants::{DEFAULT_MYSQL_CONNECTION_STRING, DEFAULT_RUST_LOG};
pub struct UpdateWeightArgs<'a> {
pub weight_token: &'a ModelWeightToken,
pub title: Option<&'a str>,
@@ -58,13 +53,13 @@ pub async fn update_weights(args: UpdateWeightArgs<'_>) -> AnyhowResult<()> {
#[cfg(test)]
mod tests {
use tokio;
// Template
// Template
use sqlx::mysql::MySqlPoolOptions;
use tokio;
use config::shared_constants::{DEFAULT_MYSQL_CONNECTION_STRING};
use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
use errors::AnyhowResult;
#[tokio::test]
async fn test_update_weights() -> AnyhowResult<()> {
let db_connection_string = DEFAULT_MYSQL_CONNECTION_STRING;
@@ -107,7 +107,7 @@ impl SyncVirtualLfuCache {
#[cfg(test)]
pub mod tests {
use crate::caching::virtual_lfu_cache::VirtualLfuCache;
use crate::job::job_types::tts::tacotron2_v2_early_fakeyou::virtual_lfu_cache::VirtualLfuCache;
#[test]
fn large_capacity_does_not_shed() {