ml-cellar 0.2.0

CLI of ML model registry for minimum MLOps
Documentation
use assert_cmd::cargo::cargo_bin_cmd;

/// This test uses `tests/fixtures/test_registry/test_check_for_files/0.1`
/// This directory contains all required files.
/// Expected to success for check command.
#[test]
fn test_check_required_files() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_files/0.1";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().success();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_files/0.2`
/// This directory lacks `config.yaml`, which is required file.
/// Expected to failure for check command.
#[test]
fn test_check_missing_required_files() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_files/0.2";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().failure();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_files/0.3`
/// This directory contains all required files and optional files (config.py).
/// Expected to success for check command because config.toml defines any kind of files as optional files.
#[test]
fn test_check_optional_files() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_files/0.3";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().success();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_project_files/0.1`
/// This directory contains all required files in project's directory (base/).
/// Expected to success for check command.
#[test]
fn test_check_required_files_for_project() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_project_files/base/0.1";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().success();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_project_files/0.2`
/// This directory lacks `config.yaml`, which is required file.
/// Expected to failure for check command.
#[test]
fn test_check_missing_required_files_for_project() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_project_files/base/0.2";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().failure();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_project_files/0.3`
/// This directory contains all required files and `config.py`, which is not defined as optional files.
/// Expected to failure for check command.
#[test]
fn test_check_optional_files_for_project() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_project_files/base/0.3";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().failure();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_version/base/1` as test directory
/// The version "1" is wrong and should be 1.0 as X.Y.
/// Expected to failure for check command.
#[test]
fn test_check_version_x_y_missing_to_x() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_version/1";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().failure();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_version/base/1.0.0` as test directory
/// The version "1.0.0" is wrong and should be 1.0 as X.Y.
/// Expected to failure for check command.
#[test]
fn test_check_version_x_y_missing_to_x_y_z() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_version/base/1.0.0";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().failure();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_version/projectA/0.1` as test directory.
/// The version "0.1" is wrong and should be 0.1.0 as X.Y.Z.
/// Expected to failure for check command.
#[test]
fn test_check_version_x_y_z_missing_to_x_y() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_version/projectA/0.1";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().failure();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_version/projectA/0.1.1` as test directory.
/// The version "0.1.1" is correct versioning as X.Y.Z.
/// Expected to success for check command.
#[test]
fn test_check_version_x_y_z() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_version/projectA/0.1.1";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().success();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_version/pretrained/20250101` as test directory.
/// The version "20250101" is correct versioning as YYYYMMDD.
/// Expected to success for check command.
#[test]
fn test_check_version_for_yyyymmdd() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_version/pretrained/20250101";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().success();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_version/pretrained/0.1` as test directory
/// The version "0.1" is wrong and should be 20250101 as YYYYMMDD.
/// Expected to failure for check command.
#[test]
fn test_check_version_yyyymmdd_missing_to_x_y() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_version/pretrained/0.1";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().failure();
}

/// This test uses `tests/fixtures/test_registry/test_check_for_version/pretrained/202501030` as test directory.
/// The version "202501030" is wrong for YYYYMMDD.
/// Expected to failure for check command.
#[test]
fn test_check_version_for_missing_yyyymmdd() {
    let test_dir = "tests/fixtures/test_registry/test_check_for_version/pretrained/202501030";
    let mut cmd = cargo_bin_cmd!("ml-cellar");
    cmd.arg("check").arg(test_dir);
    cmd.assert().failure();
}