greentic-deploy-spec 0.1.27300454030

Greentic deployment object-model schemas (Environment, Revision, TrafficSplit, BundleDeployment, Credentials, PackConfig, RuntimeConfig)
Documentation
use greentic_config_types::EnvironmentConfig;
use greentic_deploy_spec::{EnvId, EnvironmentHostConfig};
use std::str::FromStr;

#[test]
fn legacy_environment_config_maps_to_host_config() {
    let legacy = EnvironmentConfig {
        env_id: EnvId::from_str("local").unwrap(),
        deployment: None,
        connection: None,
        region: Some("eu-west-1".into()),
    };
    let host: EnvironmentHostConfig = legacy.into();
    assert_eq!(host.env_id.to_string(), "local");
    assert_eq!(host.region.as_deref(), Some("eu-west-1"));
    assert_eq!(host.tenant_org_id, None);
}

#[test]
fn adapter_borrows_legacy_config() {
    let legacy = EnvironmentConfig {
        env_id: EnvId::from_str("prod").unwrap(),
        deployment: None,
        connection: None,
        region: None,
    };
    let host: EnvironmentHostConfig = (&legacy).into();
    assert_eq!(host.env_id.to_string(), "prod");
    assert_eq!(host.region, None);
}