mirror of
https://github.com/jlengrand/engine.git
synced 2026-03-10 15:49:32 +00:00
tests: scaleway inject zone into env and db tests (#401)
This commit is contained in:
@@ -113,7 +113,7 @@ impl<'a> Kapsule<'a> {
|
||||
id: String,
|
||||
name: String,
|
||||
version: String,
|
||||
region: Zone,
|
||||
zone: Zone,
|
||||
cloud_provider: &'a Scaleway,
|
||||
dns_provider: &'a dyn DnsProvider,
|
||||
nodes: Vec<Node>,
|
||||
@@ -127,7 +127,7 @@ impl<'a> Kapsule<'a> {
|
||||
"default-s3".to_string(),
|
||||
cloud_provider.access_key.clone(),
|
||||
cloud_provider.secret_key.clone(),
|
||||
region,
|
||||
zone,
|
||||
BucketDeleteStrategy::Empty,
|
||||
false,
|
||||
);
|
||||
@@ -137,7 +137,7 @@ impl<'a> Kapsule<'a> {
|
||||
id,
|
||||
name,
|
||||
version,
|
||||
zone: region,
|
||||
zone,
|
||||
cloud_provider,
|
||||
dns_provider,
|
||||
object_storage,
|
||||
|
||||
@@ -15,10 +15,9 @@ use qovery_engine::transaction::{DeploymentOption, TransactionResult};
|
||||
use crate::cloudflare::dns_provider_cloudflare;
|
||||
use crate::utilities::{build_platform_local_docker, generate_id, FuncTestsSecrets};
|
||||
|
||||
use std::str::FromStr;
|
||||
use tracing::error;
|
||||
|
||||
pub const SCW_QOVERY_ORGANIZATION_ID: &str = "zslbgcfanc6r2nbs";
|
||||
pub const SCW_QOVERY_ORGANIZATION_ID: &str = "zcf8e78e6";
|
||||
pub const SCW_KUBE_TEST_CLUSTER_NAME: &str = "qovery-zb3a2b3b8";
|
||||
pub const SCW_KUBE_TEST_CLUSTER_ID: &str = "zb3a2b3b8";
|
||||
pub const SCW_TEST_ZONE: Zone = Zone::Paris2;
|
||||
@@ -170,6 +169,7 @@ pub fn scw_kubernetes_kapsule<'a>(
|
||||
cloud_provider: &'a Scaleway,
|
||||
dns_provider: &'a dyn DnsProvider,
|
||||
nodes: Vec<Node>,
|
||||
zone: Zone,
|
||||
) -> Kapsule<'a> {
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
Kapsule::<'a>::new(
|
||||
@@ -177,14 +177,7 @@ pub fn scw_kubernetes_kapsule<'a>(
|
||||
SCW_KUBE_TEST_CLUSTER_ID.to_string(),
|
||||
SCW_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
SCW_KUBERNETES_VERSION.to_string(),
|
||||
Zone::from_str(
|
||||
secrets
|
||||
.clone()
|
||||
.SCALEWAY_DEFAULT_REGION
|
||||
.expect("SCALEWAY_DEFAULT_REGION is not set in secrets")
|
||||
.as_str(),
|
||||
)
|
||||
.unwrap(),
|
||||
zone,
|
||||
cloud_provider,
|
||||
dns_provider,
|
||||
nodes,
|
||||
@@ -192,7 +185,7 @@ pub fn scw_kubernetes_kapsule<'a>(
|
||||
)
|
||||
}
|
||||
|
||||
pub fn deploy_environment(context: &Context, environment_action: EnvironmentAction) -> TransactionResult {
|
||||
pub fn deploy_environment(context: &Context, environment_action: EnvironmentAction, zone: Zone) -> TransactionResult {
|
||||
let engine = docker_scw_cr_engine(context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
@@ -200,7 +193,7 @@ pub fn deploy_environment(context: &Context, environment_action: EnvironmentActi
|
||||
let cp = cloud_provider_scaleway(context);
|
||||
let nodes = scw_kubernetes_nodes();
|
||||
let dns_provider = dns_provider_cloudflare(context);
|
||||
let kapsule = scw_kubernetes_kapsule(context, &cp, &dns_provider, nodes);
|
||||
let kapsule = scw_kubernetes_kapsule(context, &cp, &dns_provider, nodes, zone);
|
||||
|
||||
let _ = tx.deploy_environment_with_options(
|
||||
&kapsule,
|
||||
@@ -214,7 +207,7 @@ pub fn deploy_environment(context: &Context, environment_action: EnvironmentActi
|
||||
tx.commit()
|
||||
}
|
||||
|
||||
pub fn delete_environment(context: &Context, environment_action: EnvironmentAction) -> TransactionResult {
|
||||
pub fn delete_environment(context: &Context, environment_action: EnvironmentAction, zone: Zone) -> TransactionResult {
|
||||
let engine = docker_scw_cr_engine(context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
@@ -222,14 +215,14 @@ pub fn delete_environment(context: &Context, environment_action: EnvironmentActi
|
||||
let cp = cloud_provider_scaleway(context);
|
||||
let nodes = scw_kubernetes_nodes();
|
||||
let dns_provider = dns_provider_cloudflare(context);
|
||||
let kapsule = scw_kubernetes_kapsule(context, &cp, &dns_provider, nodes);
|
||||
let kapsule = scw_kubernetes_kapsule(context, &cp, &dns_provider, nodes, zone);
|
||||
|
||||
let _ = tx.delete_environment(&kapsule, &environment_action);
|
||||
|
||||
tx.commit()
|
||||
}
|
||||
|
||||
pub fn pause_environment(context: &Context, environment_action: EnvironmentAction) -> TransactionResult {
|
||||
pub fn pause_environment(context: &Context, environment_action: EnvironmentAction, zone: Zone) -> TransactionResult {
|
||||
let engine = docker_scw_cr_engine(context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
@@ -237,7 +230,7 @@ pub fn pause_environment(context: &Context, environment_action: EnvironmentActio
|
||||
let cp = cloud_provider_scaleway(context);
|
||||
let nodes = scw_kubernetes_nodes();
|
||||
let dns_provider = dns_provider_cloudflare(context);
|
||||
let kapsule = scw_kubernetes_kapsule(context, &cp, &dns_provider, nodes);
|
||||
let kapsule = scw_kubernetes_kapsule(context, &cp, &dns_provider, nodes, zone);
|
||||
|
||||
let _ = tx.pause_environment(&kapsule, &environment_action);
|
||||
|
||||
@@ -248,10 +241,10 @@ pub fn clean_environments(
|
||||
context: &Context,
|
||||
environments: Vec<Environment>,
|
||||
secrets: FuncTestsSecrets,
|
||||
zone: Zone,
|
||||
) -> Result<(), EngineError> {
|
||||
let secret_token = secrets.SCALEWAY_SECRET_KEY.unwrap();
|
||||
let project_id = secrets.SCALEWAY_DEFAULT_PROJECT_ID.unwrap();
|
||||
let zone = Zone::from_str(secrets.SCALEWAY_DEFAULT_REGION.unwrap().as_str()).unwrap();
|
||||
|
||||
let container_registry_client = ScalewayCR::new(
|
||||
context.clone(),
|
||||
|
||||
@@ -13,7 +13,7 @@ use test_utilities::utilities::{
|
||||
use test_utilities::common::working_minimal_environment;
|
||||
use test_utilities::scaleway::{
|
||||
clean_environments, delete_environment, deploy_environment, pause_environment, SCW_DATABASE_DISK_TYPE,
|
||||
SCW_DATABASE_INSTANCE_TYPE, SCW_KUBE_TEST_CLUSTER_ID, SCW_QOVERY_ORGANIZATION_ID,
|
||||
SCW_DATABASE_INSTANCE_TYPE, SCW_KUBE_TEST_CLUSTER_ID, SCW_QOVERY_ORGANIZATION_ID, SCW_TEST_ZONE,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -54,21 +54,21 @@ fn deploy_an_environment_with_3_databases_and_3_apps() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete) {
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets, SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -106,13 +106,13 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action.clone()) {
|
||||
match deploy_environment(&context, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
match pause_environment(&context, env_action) {
|
||||
match pause_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -130,15 +130,15 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
assert_eq!(ret.is_ok(), true);
|
||||
assert_eq!(ret.unwrap().items.is_empty(), true);
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete) {
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -199,7 +199,7 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
let env_action_fail_ok = EnvironmentAction::EnvironmentWithFailover(environment_never_up, environment.clone());
|
||||
let env_action_for_deletion = EnvironmentAction::Environment(environment_delete.clone());
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -216,7 +216,7 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
}
|
||||
match deploy_environment(&context, env_action_fail_ok) {
|
||||
match deploy_environment(&context, env_action_fail_ok, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -233,15 +233,15 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
(false, _) => assert!(false),
|
||||
}
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_for_deletion) {
|
||||
match delete_environment(&context_for_deletion, env_action_for_deletion, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
if let Err(e) = clean_environments(&context, vec![environment, environment_delete], secrets) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment, environment_delete], secrets, SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -291,7 +291,7 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_for_deletion = EnvironmentAction::Environment(environment_delete.clone());
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -303,15 +303,20 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
assert_eq!(con, true);
|
||||
}*/
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_for_deletion) {
|
||||
match delete_environment(&context_for_deletion, env_action_for_deletion, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
if let Err(e) = clean_environments(&context, vec![environment, environment_delete], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(
|
||||
&context,
|
||||
vec![environment, environment_delete],
|
||||
secrets.clone(),
|
||||
SCW_TEST_ZONE,
|
||||
) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -403,12 +408,12 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
match deploy_environment(&context_for_redeploy, env_action_redeploy) {
|
||||
match deploy_environment(&context_for_redeploy, env_action_redeploy, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -426,15 +431,15 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
(false, _) => assert!(false),
|
||||
}
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete) {
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets, SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -519,7 +524,7 @@ fn test_postgresql_configuration(
|
||||
let ea = EnvironmentAction::Environment(environment.clone());
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, ea) {
|
||||
match deploy_environment(&context, ea, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -527,15 +532,15 @@ fn test_postgresql_configuration(
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, ea_delete) {
|
||||
match delete_environment(&context_for_delete, ea_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets, SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -679,7 +684,7 @@ fn test_mongodb_configuration(
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -687,15 +692,15 @@ fn test_mongodb_configuration(
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete) {
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets, SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -855,7 +860,7 @@ fn test_mysql_configuration(
|
||||
let ea = EnvironmentAction::Environment(environment.clone());
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, ea) {
|
||||
match deploy_environment(&context, ea, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -863,15 +868,15 @@ fn test_mysql_configuration(
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&deletion_context, ea_delete) {
|
||||
match delete_environment(&deletion_context, ea_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets, SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -997,7 +1002,7 @@ fn test_redis_configuration(
|
||||
let ea = EnvironmentAction::Environment(environment.clone());
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, ea) {
|
||||
match deploy_environment(&context, ea, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -1005,15 +1010,15 @@ fn test_redis_configuration(
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, ea_delete) {
|
||||
match delete_environment(&context_for_delete, ea_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment], secrets, SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
return test_name.to_string();
|
||||
|
||||
@@ -2,7 +2,7 @@ extern crate test_utilities;
|
||||
|
||||
use self::test_utilities::scaleway::{
|
||||
clean_environments, delete_environment, deploy_environment, pause_environment, SCW_KUBE_TEST_CLUSTER_ID,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
SCW_QOVERY_ORGANIZATION_ID, SCW_TEST_ZONE,
|
||||
};
|
||||
use self::test_utilities::utilities::{
|
||||
engine_run_test, generate_id, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
@@ -50,20 +50,20 @@ fn scaleway_kapsule_deploy_a_working_environment_with_no_router() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_for_delete) {
|
||||
match delete_environment(&context_for_delete, env_action_for_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -102,20 +102,20 @@ fn scaleway_kapsule_deploy_a_not_working_environment_with_no_router() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_for_delete) {
|
||||
match delete_environment(&context_for_delete, env_action_for_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -148,13 +148,13 @@ fn scaleway_kapsule_deploy_a_working_environment_and_pause() {
|
||||
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
|
||||
match deploy_environment(&context, env_action.clone()) {
|
||||
match deploy_environment(&context, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
match pause_environment(&context_for_delete, env_action.clone()) {
|
||||
match pause_environment(&context_for_delete, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -174,21 +174,21 @@ fn scaleway_kapsule_deploy_a_working_environment_and_pause() {
|
||||
|
||||
// Check we can resume the env
|
||||
let ctx_resume = context.clone_not_same_execution_id();
|
||||
match deploy_environment(&ctx_resume, env_action.clone()) {
|
||||
match deploy_environment(&ctx_resume, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
// Cleanup
|
||||
match delete_environment(&context_for_delete, env_action.clone()) {
|
||||
match delete_environment(&context_for_delete, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -236,20 +236,20 @@ fn scaleway_kapsule_build_with_buildpacks_and_deploy_a_working_environment() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_for_delete) {
|
||||
match delete_environment(&context_for_delete, env_action_for_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -286,20 +286,20 @@ fn scaleway_kapsule_deploy_a_working_environment_with_domain() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_for_delete) {
|
||||
match delete_environment(&context_for_delete, env_action_for_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -354,7 +354,7 @@ fn scaleway_kapsule_deploy_a_working_environment_with_storage() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -362,14 +362,14 @@ fn scaleway_kapsule_deploy_a_working_environment_with_storage() {
|
||||
|
||||
// TODO(benjaminch): check the disk is here and with correct size, can use Scaleway API
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete) {
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -429,7 +429,7 @@ fn scaleway_kapsule_redeploy_same_app() {
|
||||
let env_action_redeploy = EnvironmentAction::Environment(environment_redeploy);
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -444,7 +444,7 @@ fn scaleway_kapsule_redeploy_same_app() {
|
||||
secrets.clone(),
|
||||
);
|
||||
|
||||
match deploy_environment(&context_bis, env_action_redeploy) {
|
||||
match deploy_environment(&context_bis, env_action_redeploy, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -461,14 +461,14 @@ fn scaleway_kapsule_redeploy_same_app() {
|
||||
// nothing changed in the app, so, it shouldn't be restarted
|
||||
assert!(number.eq(&number2));
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete) {
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -523,24 +523,24 @@ fn scaleway_kapsule_deploy_a_not_working_environment_and_then_working_environmen
|
||||
let env_action_not_working = EnvironmentAction::Environment(environment_for_not_working);
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context_for_not_working, env_action_not_working) {
|
||||
match deploy_environment(&context_for_not_working, env_action_not_working, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
match delete_environment(&context_for_delete, env_action_delete) {
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -602,41 +602,41 @@ fn scaleway_kapsule_deploy_ok_fail_fail_ok_environment() {
|
||||
let env_action_delete = EnvironmentAction::Environment(delete_env);
|
||||
|
||||
// OK
|
||||
match deploy_environment(&context, env_action.clone()) {
|
||||
match deploy_environment(&context, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
// FAIL and rollback
|
||||
match deploy_environment(&context_for_not_working_1, env_action_not_working_1) {
|
||||
match deploy_environment(&context_for_not_working_1, env_action_not_working_1, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
// FAIL and Rollback again
|
||||
match deploy_environment(&context_for_not_working_2, env_action_not_working_2) {
|
||||
match deploy_environment(&context_for_not_working_2, env_action_not_working_2, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
// Should be working
|
||||
match deploy_environment(&context, env_action.clone()) {
|
||||
match deploy_environment(&context, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete) {
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -673,20 +673,20 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_no_failover() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
let env_action_delete = EnvironmentAction::Environment(delete_env);
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete) {
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone()) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -732,13 +732,13 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_a_working_failover() {
|
||||
let env_action_delete = EnvironmentAction::Environment(delete_env);
|
||||
let env_action = EnvironmentAction::EnvironmentWithFailover(environment.clone(), failover_environment.clone());
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
match delete_environment(&context_deletion, env_action_delete) {
|
||||
match delete_environment(&context_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
@@ -748,8 +748,9 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_a_working_failover() {
|
||||
&context,
|
||||
vec![environment.clone(), failover_environment.clone()],
|
||||
secrets.clone(),
|
||||
SCW_TEST_ZONE,
|
||||
) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
@@ -791,13 +792,13 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_a_non_working_failover
|
||||
let env_action_delete = EnvironmentAction::Environment(delete_env);
|
||||
let env_action = EnvironmentAction::EnvironmentWithFailover(environment.clone(), failover_environment.clone());
|
||||
|
||||
match deploy_environment(&context, env_action) {
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete) {
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
@@ -807,8 +808,9 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_a_non_working_failover
|
||||
&context,
|
||||
vec![environment.clone(), failover_environment.clone()],
|
||||
secrets.clone(),
|
||||
SCW_TEST_ZONE,
|
||||
) {
|
||||
warn!("cannot clean environements, error: {:?}", e);
|
||||
warn!("cannot clean environments, error: {:?}", e);
|
||||
}
|
||||
|
||||
test_name.to_string()
|
||||
|
||||
Reference in New Issue
Block a user