Fix broken tests, add testing script

This commit is contained in:
Brandon Thomas committed 2023-04-29 23:56:48 -07:00
1 parent 3d63e34ca1
commit f710b68a3e
8 files changed
+25 -11

No files matched your search

@@ -33,8 +33,8 @@ mod tests {
assert_eq!(true, directory_exists(PathBuf::from("/")));
// Other directories
assert_eq!(true, directory_exists("../../../test_data/audio/flac"));
assert_eq!(true, directory_exists(PathBuf::from("../../../test_data/audio/flac")));
assert_eq!(true, directory_exists("../../../../test_data/audio/flac"));
assert_eq!(true, directory_exists(PathBuf::from("../../../../test_data/audio/flac")));
}
#[test]
+2 -2
View File
@@ -18,8 +18,8 @@ mod tests {
#[test]
fn test_file_exists() {
assert_eq!(true, file_exists("../../../test_data/audio/flac/zelda_ocarina_small_item.flac"));
assert_eq!(true, file_exists(PathBuf::from("../../../test_data/audio/flac/zelda_ocarina_small_item.flac")));
assert_eq!(true, file_exists("../../../../test_data/audio/flac/zelda_ocarina_small_item.flac"));
assert_eq!(true, file_exists(PathBuf::from("../../../../test_data/audio/flac/zelda_ocarina_small_item.flac")));
}
#[test]
+1 -1
View File
@@ -23,7 +23,7 @@ mod tests {
fn test_file(path_from_repo_root: &str) -> PathBuf {
// https://doc.rust-lang.org/cargo/reference/environment-variables.html
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push(format!("../../../{}", path_from_repo_root));
path.push(format!("../../../../{}", path_from_repo_root));
path
}
@@ -21,7 +21,7 @@ pub mod tests {
fn test_sha256_hash_file_1() {
assert_eq!(
"8d593e85d8c30620b57af0734c010a8cd00083a5a2ffd1ffb91f2c9e85d8535d",
sha256_hash_file("../../../test_data/audio/aac/golden_sun_elemental_stars_cyanne.aac")
sha256_hash_file("../../../../test_data/audio/aac/golden_sun_elemental_stars_cyanne.aac")
.unwrap());
}
@@ -29,7 +29,7 @@ pub mod tests {
fn test_sha256_hash_file_2() {
assert_eq!(
"452812e5b5269f74b13175e0ef739255ee094f55c9d45a9336ed129cf7c66f8e",
sha256_hash_file("../../../test_data/video/webm/laser_pong.webm")
sha256_hash_file("../../../../test_data/video/webm/laser_pong.webm")
.unwrap());
}
}
@@ -23,7 +23,7 @@ mod tests {
fn test_file(path_from_repo_root: &str) -> PathBuf {
// https://doc.rust-lang.org/cargo/reference/environment-variables.html
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push(format!("../../../{}", path_from_repo_root));
path.push(format!("../../../../{}", path_from_repo_root));
path
}
@@ -99,7 +99,7 @@ mod tests {
#[test]
fn test_command() {
let command = DockerOptions {
image_name: "MY_IMAAGE".to_string(),
image_name: "MY_IMAGE".to_string(),
maybe_bind_mount: Some(DockerFilesystemMount {
local_filesystem: "/local".to_string(),
container_filesystem: "/container".to_string(),
@@ -111,7 +111,7 @@ mod tests {
maybe_gpu: Some(DockerGpu::All),
};
assert_eq!("docker run --rm --env FOO=1,BAR=2 --mount type=bind,source=/local,target=/container --gpus all MY_IMAAGE /bin/bash -c \"echo wat\"",
assert_eq!("docker run --rm --env FOO=1 --env BAR=2 --mount type=bind,source=/local,target=/container --gpus all MY_IMAGE /bin/bash -c \"echo wat\"",
command.to_command_string("echo wat"));
}
}
+1 -1
View File
@@ -173,7 +173,7 @@ mod tests {
use once_cell::sync::Lazy;
use crate::clean_symbols::clean_symbols;
const TIME_BOMB_EPOCH_STR : &'static str = "2023-04-01T00:00:00.00Z";
const TIME_BOMB_EPOCH_STR : &'static str = "2023-06-01T00:00:00.00Z";
static TIME_BOMB_EPOCH: Lazy<DateTime<Utc>> = Lazy::new(|| {
let datetime = DateTime::parse_from_rfc3339(TIME_BOMB_EPOCH_STR)
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
echo 'Running tests...'
# TODO: Fix 'fakeyou_client' and 'billing_component'
# TODO: Run 'sqlite_queries' and 'aichatbot-sidecar' after postgres migrations
cargo test \
--workspace \
--exclude sqlite_queries \
--exclude aichatbot-sidecar \
--exclude fakeyou_client \
--exclude billing_component