mirror of
https://github.com/jlengrand/engine.git
synced 2026-03-10 08:11:21 +00:00
69 lines
2.6 KiB
Rust
69 lines
2.6 KiB
Rust
use crate::digitalocean::deploy_environment_on_do;
|
|
use qovery_engine::container_registry::docr::get_current_registry_name;
|
|
use qovery_engine::models::{Action, Clone2, EnvironmentAction};
|
|
use qovery_engine::transaction::TransactionResult;
|
|
use test_utilities::digitalocean::digital_ocean_token;
|
|
use test_utilities::utilities::{context, init};
|
|
use tracing::{debug, error, info, span, warn, Level};
|
|
|
|
#[test]
|
|
fn deploy_a_working_environment_with_no_router_on_do() {
|
|
init();
|
|
let span = span!(
|
|
Level::INFO,
|
|
"deploy_a_working_environment_with_no_router_on_do"
|
|
);
|
|
let _enter = span.enter();
|
|
|
|
let context = context();
|
|
let context_for_delete = context.clone_not_same_execution_id();
|
|
let mut environment = test_utilities::aws::environment_only_http_server(&context);
|
|
let mut environment_for_delete = test_utilities::aws::environment_only_http_server(&context);
|
|
environment.routers = vec![];
|
|
environment_for_delete.routers = vec![];
|
|
environment_for_delete.action = Action::Delete;
|
|
let ea = EnvironmentAction::Environment(environment);
|
|
let ea_delete = EnvironmentAction::Environment(environment_for_delete);
|
|
|
|
match deploy_environment_on_do(&context, &ea) {
|
|
TransactionResult::Ok => assert!(true),
|
|
TransactionResult::Rollback(_) => assert!(false),
|
|
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
|
};
|
|
|
|
// perform check on internal fns
|
|
let engine = test_utilities::digitalocean::docker_cr_do_engine(&context);
|
|
let registry = engine.container_registry();
|
|
let registry_name = registry.name();
|
|
assert_eq!(
|
|
registry_name,
|
|
get_current_registry_name(digital_ocean_token().as_str())
|
|
.unwrap()
|
|
.as_str()
|
|
)
|
|
|
|
/*
|
|
TODO: delete environement is not implemented yet
|
|
match deploy_environment_on_do(&context_for_delete, &ea_delete) {
|
|
TransactionResult::Ok => assert!(true),
|
|
TransactionResult::Rollback(_) => assert!(false),
|
|
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
|
};*/
|
|
}
|
|
|
|
#[test]
|
|
fn deploy_a_working_environment_router_and_app_on_do() {
|
|
init();
|
|
|
|
let context = context();
|
|
let context_for_delete = context.clone_not_same_execution_id();
|
|
let mut environment = test_utilities::aws::environment_only_http_server_router(&context);
|
|
let ea = EnvironmentAction::Environment(environment);
|
|
|
|
match deploy_environment_on_do(&context, &ea) {
|
|
TransactionResult::Ok => assert!(true),
|
|
TransactionResult::Rollback(_) => assert!(false),
|
|
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
|
};
|
|
}
|