mirror of
https://github.com/jlengrand/engine.git
synced 2026-03-10 08:11:21 +00:00
lint: continue
This commit is contained in:
4
.github/workflows/tests.yml
vendored
4
.github/workflows/tests.yml
vendored
@@ -39,12 +39,12 @@ jobs:
|
||||
sccache --show-stats
|
||||
echo "########## LINTER ##########"
|
||||
cargo fmt --all -- --check --color=always || (echo "Use cargo fmt to format your code"; exit 1)
|
||||
RUSTC_WRAPPER="" RUSTC_WORKSPACE_WRAPPER=$GITHUB_WORKSPACE/bin/sccache cargo clippy --workspace -- -D warnings || (echo "Solve your warnings to continue"; exit 1)
|
||||
RUSTC_WRAPPER="" RUSTC_WORKSPACE_WRAPPER=$GITHUB_WORKSPACE/bin/sccache cargo clippy --tests -- -D warnings || (echo "Solve your warnings to continue"; exit 1)
|
||||
echo "########## START BUILD ##########"
|
||||
cargo build --all-features
|
||||
sccache --show-stats
|
||||
echo "########## START UNIT TESTS ##########"
|
||||
cargo test
|
||||
cargo test --lib
|
||||
selected-functionnal-tests:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.draft == false
|
||||
|
||||
59
Cargo.lock
generated
59
Cargo.lock
generated
@@ -138,9 +138,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "0.2.16"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
|
||||
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"memchr",
|
||||
@@ -439,9 +439,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "curl"
|
||||
version = "0.4.38"
|
||||
version = "0.4.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "003cb79c1c6d1c93344c7e1201bb51c2148f24ec2bd9c253709d6b2efb796515"
|
||||
checksum = "aaa3b8db7f3341ddef15786d250106334d4a6c4b0ae4a46cd77082777d9849b9"
|
||||
dependencies = [
|
||||
"curl-sys",
|
||||
"libc",
|
||||
@@ -454,9 +454,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "curl-sys"
|
||||
version = "0.4.45+curl-7.78.0"
|
||||
version = "0.4.49+curl-7.79.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de9e5a72b1c744eb5dd20b2be4d7eb84625070bb5c4ab9b347b70464ab1e62eb"
|
||||
checksum = "e0f44960aea24a786a46907b8824ebc0e66ca06bf4e4978408c7499620343483"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -1859,9 +1859,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "passwords"
|
||||
version = "3.1.7"
|
||||
version = "3.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03258d8822ae1e392ba9385d4f66c1eed50129fd679c13faa2ce6f62bae5b511"
|
||||
checksum = "3911e67d9a111aea69d3457a13de9a03d9fd920bc30cff110526eb5259ded58f"
|
||||
dependencies = [
|
||||
"random-pick",
|
||||
]
|
||||
@@ -2049,8 +2049,10 @@ name = "qovery-engine"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64 0.13.0",
|
||||
"bstr",
|
||||
"chrono",
|
||||
"cmd_lib",
|
||||
"curl",
|
||||
"digitalocean",
|
||||
"dirs",
|
||||
"flate2",
|
||||
@@ -2058,9 +2060,11 @@ dependencies = [
|
||||
"futures 0.3.16",
|
||||
"gethostname",
|
||||
"git2",
|
||||
"hashicorp_vault",
|
||||
"itertools",
|
||||
"lazy_static",
|
||||
"maplit",
|
||||
"passwords",
|
||||
"rand 0.8.4",
|
||||
"reqwest 0.11.4",
|
||||
"retry",
|
||||
@@ -2083,7 +2087,7 @@ dependencies = [
|
||||
"tempdir",
|
||||
"tempfile",
|
||||
"tera",
|
||||
"test-utilities",
|
||||
"time 0.3.4",
|
||||
"timeout-readwrite",
|
||||
"tokio 1.10.0",
|
||||
"tracing",
|
||||
@@ -3205,34 +3209,6 @@ dependencies = [
|
||||
"unic-segment",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test-utilities"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64 0.13.0",
|
||||
"bstr",
|
||||
"chrono",
|
||||
"curl",
|
||||
"digitalocean",
|
||||
"dirs",
|
||||
"gethostname",
|
||||
"hashicorp_vault",
|
||||
"maplit",
|
||||
"passwords",
|
||||
"qovery-engine",
|
||||
"rand 0.7.3",
|
||||
"reqwest 0.10.10",
|
||||
"retry",
|
||||
"scaleway_api_rs",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"time 0.2.27",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.26"
|
||||
@@ -3288,6 +3264,15 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99beeb0daeac2bd1e86ac2c21caddecb244b39a093594da1a661ec2060c7aedd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.1.1"
|
||||
|
||||
@@ -67,12 +67,16 @@ digitalocean = "0.1.1"
|
||||
scaleway_api_rs = "=0.1.2"
|
||||
|
||||
[dev-dependencies]
|
||||
test-utilities = { path = "test_utilities" }
|
||||
tempdir = "0.3"
|
||||
tempfile = "3.2.0"
|
||||
uuid = { version = "0.8", features = ["v4"] }
|
||||
function_name = "0.2.0"
|
||||
maplit = "1.0.2"
|
||||
bstr = "0.2.17"
|
||||
passwords = "3.1.8"
|
||||
time = "0.3.4"
|
||||
curl = "0.4.39"
|
||||
hashicorp_vault = "2.1.0"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -248,7 +248,7 @@ mod tests_do_vpcs {
|
||||
#[test]
|
||||
fn check_reserved_subnets() {
|
||||
// if not reserved
|
||||
assert_eq!(is_do_reserved_vpc_subnets(Region::Frankfurt, "192.168.0.0/24"), false);
|
||||
assert!(!is_do_reserved_vpc_subnets(Region::Frankfurt, "192.168.0.0/24"));
|
||||
// if region reserved
|
||||
assert!(is_do_reserved_vpc_subnets(Region::Frankfurt, "10.19.0.0/16"));
|
||||
// if world wide reserved
|
||||
|
||||
@@ -921,26 +921,26 @@ mod tests {
|
||||
assert_eq!(result.required_upgrade_on.unwrap(), KubernetesNodesType::Masters); // master should be performed first
|
||||
assert_eq!(result.deployed_masters_version, version_1_16);
|
||||
assert_eq!(result.deployed_workers_version, version_1_16);
|
||||
assert_eq!(result.older_masters_version_detected, false);
|
||||
assert_eq!(result.older_workers_version_detected, false);
|
||||
assert!(!result.older_masters_version_detected);
|
||||
assert!(!result.older_workers_version_detected);
|
||||
let result = check_kubernetes_upgrade_status("1.17", version_1_17.clone(), vec![version_1_16.clone()]).unwrap();
|
||||
assert_eq!(result.required_upgrade_on.unwrap(), KubernetesNodesType::Workers); // then workers
|
||||
assert_eq!(result.deployed_masters_version, version_1_17);
|
||||
assert_eq!(result.deployed_workers_version, version_1_16);
|
||||
assert_eq!(result.older_masters_version_detected, false);
|
||||
assert_eq!(result.older_workers_version_detected, false);
|
||||
assert!(!result.older_masters_version_detected);
|
||||
assert!(!result.older_workers_version_detected);
|
||||
|
||||
// everything is up to date, no upgrade required
|
||||
let result = check_kubernetes_upgrade_status("1.17", version_1_17.clone(), vec![version_1_17.clone()]).unwrap();
|
||||
assert!(result.required_upgrade_on.is_none());
|
||||
assert_eq!(result.older_masters_version_detected, false);
|
||||
assert_eq!(result.older_workers_version_detected, false);
|
||||
assert!(!result.older_masters_version_detected);
|
||||
assert!(!result.older_workers_version_detected);
|
||||
|
||||
// downgrade should be detected
|
||||
let result = check_kubernetes_upgrade_status("1.16", version_1_17.clone(), vec![version_1_17.clone()]).unwrap();
|
||||
assert!(result.required_upgrade_on.is_none());
|
||||
assert_eq!(result.older_masters_version_detected, true);
|
||||
assert_eq!(result.older_workers_version_detected, true);
|
||||
assert!(result.older_masters_version_detected);
|
||||
assert!(result.older_workers_version_detected);
|
||||
|
||||
// mixed workers version
|
||||
let result = check_kubernetes_upgrade_status(
|
||||
@@ -952,8 +952,8 @@ mod tests {
|
||||
assert_eq!(result.required_upgrade_on.unwrap(), KubernetesNodesType::Workers);
|
||||
assert_eq!(result.deployed_masters_version, version_1_17);
|
||||
assert_eq!(result.deployed_workers_version, version_1_16);
|
||||
assert_eq!(result.older_masters_version_detected, false); // not true because we're in an upgrade process
|
||||
assert_eq!(result.older_workers_version_detected, false); // not true because we're in an upgrade process
|
||||
assert!(!result.older_masters_version_detected); // not true because we're in an upgrade process
|
||||
assert!(!result.older_workers_version_detected); // not true because we're in an upgrade process
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -1057,11 +1057,10 @@ mod tests {
|
||||
|
||||
// upgrade is not required
|
||||
//print_kubernetes_version(&provider_version, &provider.wished_version);
|
||||
assert_eq!(
|
||||
compare_kubernetes_cluster_versions_for_upgrade(&provider_version, &provider.wished_version)
|
||||
assert!(
|
||||
!compare_kubernetes_cluster_versions_for_upgrade(&provider_version, &provider.wished_version)
|
||||
.unwrap()
|
||||
.upgraded_required,
|
||||
false
|
||||
.upgraded_required
|
||||
);
|
||||
|
||||
// upgrade is required
|
||||
@@ -1410,17 +1409,15 @@ mod tests {
|
||||
|
||||
// upgrade is not required
|
||||
//print_kubernetes_version(&provider_version, &provider.wished_version);
|
||||
assert_eq!(
|
||||
compare_kubernetes_cluster_versions_for_upgrade(&kubelet, &provider.wished_version)
|
||||
assert!(
|
||||
!compare_kubernetes_cluster_versions_for_upgrade(&kubelet, &provider.wished_version)
|
||||
.unwrap()
|
||||
.upgraded_required,
|
||||
false
|
||||
.upgraded_required
|
||||
);
|
||||
assert_eq!(
|
||||
compare_kubernetes_cluster_versions_for_upgrade(&kube_proxy, &provider.wished_version)
|
||||
assert!(
|
||||
!compare_kubernetes_cluster_versions_for_upgrade(&kube_proxy, &provider.wished_version)
|
||||
.unwrap()
|
||||
.upgraded_required,
|
||||
false
|
||||
.upgraded_required
|
||||
);
|
||||
|
||||
// upgrade is required
|
||||
|
||||
@@ -85,7 +85,7 @@ impl FromStr for ScwInstancesType {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
mod node_tests {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::cloud_provider::models::NodeGroups;
|
||||
|
||||
@@ -301,7 +301,7 @@ mod tests {
|
||||
"#;
|
||||
|
||||
let pod_status = serde_json::from_str::<KubernetesList<KubernetesPod>>(payload);
|
||||
assert_eq!(pod_status.is_ok(), true);
|
||||
assert!(pod_status.is_ok());
|
||||
assert_eq!(pod_status.unwrap().items[0].status.conditions[0].status, "False");
|
||||
|
||||
let payload = r#"
|
||||
@@ -576,6 +576,6 @@ mod tests {
|
||||
"#;
|
||||
|
||||
let pod_status = serde_json::from_str::<KubernetesList<KubernetesPod>>(payload);
|
||||
assert_eq!(pod_status.is_ok(), true);
|
||||
assert!(pod_status.is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,14 +295,14 @@ mod tests {
|
||||
#[test]
|
||||
fn test_command_with_timeout() {
|
||||
let ret = exec_with_envs_and_output("sleep", vec!["120"], vec![], |_| {}, |_| {}, Duration::seconds(2));
|
||||
assert_eq!(ret.is_err(), true);
|
||||
assert_eq!(ret.err().unwrap().message.unwrap().contains("timeout"), true);
|
||||
assert!(ret.is_err());
|
||||
assert!(ret.err().unwrap().message.unwrap().contains("timeout"));
|
||||
|
||||
let ret = exec_with_envs_and_output("yes", vec![""], vec![], |_| {}, |_| {}, Duration::seconds(2));
|
||||
assert_eq!(ret.is_err(), true);
|
||||
assert!(ret.is_err());
|
||||
|
||||
let ret2 = exec_with_envs_and_output("sleep", vec!["1"], vec![], |_| {}, |_| {}, Duration::seconds(5));
|
||||
|
||||
assert_eq!(ret2.is_ok(), true);
|
||||
assert!(ret2.is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
17
src/fs.rs
17
src/fs.rs
@@ -192,7 +192,7 @@ mod tests {
|
||||
.iter()
|
||||
.for_each(|d| fs::create_dir_all(d).expect("error creating directory"));
|
||||
|
||||
let tmp_files = vec![
|
||||
let tmp_files_path_content = vec![
|
||||
(".terraform/file-1.txt", "content"),
|
||||
(".terraform/dir-1/file-1.txt", "content"),
|
||||
("dir-1/.terraform/file-1.txt", "content"),
|
||||
@@ -204,15 +204,14 @@ mod tests {
|
||||
("dir-1/.terraform.lock.hcl", "content"),
|
||||
("dir-2/dir-1/.terraform.lock.hcl", "content"),
|
||||
("dir-2/dir-1/file-2.txt", "content"),
|
||||
]
|
||||
.iter()
|
||||
.map(|(p, c)| {
|
||||
];
|
||||
|
||||
let tmp_files = tmp_files_path_content.iter().map(|(p, c)| {
|
||||
let mut file = File::create(root_dir_path.join(p)).expect("error creating file");
|
||||
file.write_all(c.as_bytes()).expect("error writing into file");
|
||||
|
||||
file
|
||||
})
|
||||
.collect::<Vec<File>>();
|
||||
});
|
||||
|
||||
// execute:
|
||||
let result = archive_workspace_directory(
|
||||
@@ -221,7 +220,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// verify:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
|
||||
let expected_files_in_tar: HashSet<String> =
|
||||
vec![String::from("file-1.txt"), String::from("dir-2/dir-1/file-2.txt")]
|
||||
@@ -248,10 +247,10 @@ mod tests {
|
||||
|
||||
assert_eq!(expected_files_in_tar.len(), files_in_tar.len());
|
||||
for e in expected_files_in_tar.iter() {
|
||||
assert_eq!(true, files_in_tar.contains(e));
|
||||
assert!(files_in_tar.contains(e));
|
||||
}
|
||||
for e in files_in_tar.iter() {
|
||||
assert_eq!(true, expected_files_in_tar.contains(e));
|
||||
assert!(expected_files_in_tar.contains(e));
|
||||
}
|
||||
|
||||
// clean:
|
||||
|
||||
4135
test_utilities/Cargo.lock
generated
4135
test_utilities/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,35 +0,0 @@
|
||||
[package]
|
||||
name = "test-utilities"
|
||||
version = "0.1.0"
|
||||
authors = ["Romaric Philogene <evoxmusic@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
base64 = "0.13.0"
|
||||
bstr = "0.2.16"
|
||||
qovery-engine = { path = "../" }
|
||||
chrono = "0.4.11"
|
||||
dirs = "3.0.1"
|
||||
gethostname = "0.2.1"
|
||||
passwords = "3.1.7"
|
||||
rand = "0.7.3"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0.57"
|
||||
serde_derive = "1.0"
|
||||
curl = "0.4.34"
|
||||
reqwest = { version = "0.10.8", features = ["blocking"] }
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.2"
|
||||
retry = "1.0.0"
|
||||
time = "0.2.23"
|
||||
hashicorp_vault = "2.0.1"
|
||||
maplit = "1.0.2"
|
||||
uuid = { version = "0.8", features = ["v4"] }
|
||||
|
||||
# Digital Ocean Deps
|
||||
digitalocean = "0.1.1"
|
||||
|
||||
# Scaleway Deps
|
||||
scaleway_api_rs = "=0.1.2"
|
||||
@@ -1,21 +1,23 @@
|
||||
extern crate test_utilities;
|
||||
|
||||
use ::function_name::named;
|
||||
use qovery_engine::cloud_provider::Kind as ProviderKind;
|
||||
use qovery_engine::models::{
|
||||
pub use qovery_engine::cloud_provider::Kind as ProviderKind;
|
||||
pub use qovery_engine::models::{
|
||||
Action, Clone2, Context, Database, DatabaseKind, DatabaseMode, Environment, EnvironmentAction,
|
||||
};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
use test_utilities::utilities::{init, FuncTestsSecrets};
|
||||
use tracing::{span, Level};
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
pub use tracing::{span, Level};
|
||||
|
||||
use crate::aws::aws_environment::{ctx_pause_environment, delete_environment, deploy_environment};
|
||||
pub use crate::aws::aws_environment::{ctx_pause_environment, delete_environment, deploy_environment};
|
||||
|
||||
use self::test_utilities::aws::{
|
||||
pub use crate::helpers::aws::{
|
||||
AWS_DATABASE_DISK_TYPE, AWS_DATABASE_INSTANCE_TYPE, AWS_KUBE_TEST_CLUSTER_ID, AWS_QOVERY_ORGANIZATION_ID,
|
||||
};
|
||||
use self::test_utilities::utilities::{context, engine_run_test, generate_id, get_pods, is_pod_restarted_env};
|
||||
use qovery_engine::models::DatabaseMode::{CONTAINER, MANAGED};
|
||||
pub use crate::helpers::common::{
|
||||
environment_3_apps_3_routers_3_databases, environnement_2_app_2_routers_1_psql, working_minimal_environment,
|
||||
};
|
||||
pub use crate::helpers::utilities::{
|
||||
context, engine_run_test, generate_id, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
};
|
||||
pub use function_name::named;
|
||||
pub use qovery_engine::models::DatabaseMode::{CONTAINER, MANAGED};
|
||||
|
||||
/**
|
||||
**
|
||||
@@ -38,7 +40,7 @@ fn deploy_an_environment_with_3_databases_and_3_apps() {
|
||||
let context = context();
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::environment_3_apps_3_routers_3_databases(
|
||||
let environment = environment_3_apps_3_routers_3_databases(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -55,15 +57,15 @@ fn deploy_an_environment_with_3_databases_and_3_apps() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -84,7 +86,7 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
let context = context();
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let environment = environnement_2_app_2_routers_1_psql(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -102,15 +104,15 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match ctx_pause_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Check that we have actually 0 pods running for this db
|
||||
@@ -126,9 +128,9 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
assert_eq!(ret.unwrap().items.is_empty(), true);
|
||||
|
||||
match delete_environment(&context_for_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -155,7 +157,7 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
.DEFAULT_TEST_DOMAIN
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let environment = environnement_2_app_2_routers_1_psql(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -173,7 +175,7 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
app
|
||||
})
|
||||
.collect::<Vec<qovery_engine::models::Application>>();
|
||||
let mut environment_delete = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let mut environment_delete = environnement_2_app_2_routers_1_psql(
|
||||
&context_for_deletion,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -189,9 +191,9 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
let ea_for_deletion = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY
|
||||
let database_name = format!("postgresql{}-0", &environment_check.databases[0].name);
|
||||
@@ -202,13 +204,13 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
database_name.as_str(),
|
||||
secrets.clone(),
|
||||
) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
(true, _) => {}
|
||||
(false, _) => panic!(),
|
||||
}
|
||||
match deploy_environment(&context, &ea_fail_ok) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => {}
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY EVEN IF FAIL
|
||||
match is_pod_restarted_env(
|
||||
@@ -218,14 +220,14 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
database_name.as_str(),
|
||||
secrets,
|
||||
) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
(true, _) => {}
|
||||
(false, _) => panic!(),
|
||||
}
|
||||
|
||||
match delete_environment(&context_for_deletion, &ea_for_deletion) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -252,7 +254,7 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let environment = environnement_2_app_2_routers_1_psql(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -260,7 +262,7 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
AWS_DATABASE_DISK_TYPE,
|
||||
);
|
||||
//let env_to_check = environment.clone();
|
||||
let mut environment_delete = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let mut environment_delete = environnement_2_app_2_routers_1_psql(
|
||||
&context_for_deletion,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -274,9 +276,9 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
let ea_for_deletion = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TODO: should be uncommented as soon as cert-manager is fixed
|
||||
// for the moment this assert report a SSL issue on the second router, so it's works well
|
||||
@@ -286,9 +288,9 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
}*/
|
||||
|
||||
match delete_environment(&context_for_deletion, &ea_for_deletion) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -312,7 +314,7 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
let context_for_redeploy = context.clone_not_same_execution_id();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -385,14 +387,14 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
match deploy_environment(&context_for_redeploy, &ea_redeploy) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY
|
||||
let database_name = format!("postgresql{}-0", &environment_check.databases[0].name);
|
||||
@@ -403,14 +405,14 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
database_name.as_str(),
|
||||
secrets,
|
||||
) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
(true, _) => {}
|
||||
(false, _) => panic!(),
|
||||
}
|
||||
|
||||
match delete_environment(&context_for_delete, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -492,17 +494,17 @@ fn test_postgresql_configuration(
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
test_name.to_string()
|
||||
})
|
||||
@@ -515,7 +517,7 @@ fn test_postgresql_configuration(
|
||||
fn postgresql_v10_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -533,7 +535,7 @@ fn postgresql_v10_deploy_a_working_dev_environment() {
|
||||
fn postgresql_v11_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -552,7 +554,7 @@ fn postgresql_v11_deploy_a_working_dev_environment() {
|
||||
fn postgresql_v12_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -571,7 +573,7 @@ fn postgresql_v12_deploy_a_working_dev_environment() {
|
||||
fn postgresql_v10_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -589,7 +591,7 @@ fn postgresql_v10_deploy_a_working_prod_environment() {
|
||||
fn postgresql_v11_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -607,7 +609,7 @@ fn postgresql_v11_deploy_a_working_prod_environment() {
|
||||
fn postgresql_v12_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -701,17 +703,17 @@ fn test_mongodb_configuration(
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
@@ -725,7 +727,7 @@ fn test_mongodb_configuration(
|
||||
fn mongodb_v3_6_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -743,7 +745,7 @@ fn mongodb_v3_6_deploy_a_working_dev_environment() {
|
||||
fn mongodb_v4_0_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -761,7 +763,7 @@ fn mongodb_v4_0_deploy_a_working_dev_environment() {
|
||||
fn mongodb_v4_2_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -779,7 +781,7 @@ fn mongodb_v4_2_deploy_a_working_dev_environment() {
|
||||
fn mongodb_v4_4_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -798,7 +800,7 @@ fn mongodb_v4_4_deploy_a_working_dev_environment() {
|
||||
fn mongodb_v3_6_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -816,7 +818,7 @@ fn mongodb_v3_6_deploy_a_working_prod_environment() {
|
||||
fn mongodb_v4_0_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -906,17 +908,17 @@ fn test_mysql_configuration(
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&deletion_context, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
@@ -930,7 +932,7 @@ fn test_mysql_configuration(
|
||||
fn mysql_v5_7_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -948,7 +950,7 @@ fn mysql_v5_7_deploy_a_working_dev_environment() {
|
||||
fn mysql_v8_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -967,7 +969,7 @@ fn mysql_v8_deploy_a_working_dev_environment() {
|
||||
fn mysql_v5_7_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -985,7 +987,7 @@ fn mysql_v5_7_deploy_a_working_prod_environment() {
|
||||
fn mysql_v8_0_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -1082,17 +1084,17 @@ fn test_redis_configuration(
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
@@ -1106,7 +1108,7 @@ fn test_redis_configuration(
|
||||
fn redis_v5_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -1124,7 +1126,7 @@ fn redis_v5_deploy_a_working_dev_environment() {
|
||||
fn redis_v6_deploy_a_working_dev_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -1143,7 +1145,7 @@ fn redis_v6_deploy_a_working_dev_environment() {
|
||||
fn redis_v5_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -1161,7 +1163,7 @@ fn redis_v5_deploy_a_working_prod_environment() {
|
||||
fn redis_v6_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
extern crate test_utilities;
|
||||
pub use qovery_engine::cloud_provider::Kind;
|
||||
pub use std::collections::BTreeMap;
|
||||
|
||||
use self::test_utilities::aws::{AWS_KUBE_TEST_CLUSTER_ID, AWS_QOVERY_ORGANIZATION_ID};
|
||||
use self::test_utilities::cloudflare::dns_provider_cloudflare;
|
||||
use self::test_utilities::utilities::{engine_run_test, generate_id, get_pods, is_pod_restarted_env, FuncTestsSecrets};
|
||||
use ::function_name::named;
|
||||
use qovery_engine::cloud_provider::Kind;
|
||||
use qovery_engine::models::{Action, Clone2, Context, EnvironmentAction, Storage, StorageType};
|
||||
use qovery_engine::transaction::{DeploymentOption, TransactionResult};
|
||||
use std::collections::BTreeMap;
|
||||
use test_utilities::utilities::context;
|
||||
use test_utilities::utilities::init;
|
||||
use tracing::{span, Level};
|
||||
pub use crate::helpers::aws::{
|
||||
aws_kubernetes_eks, aws_kubernetes_nodes, cloud_provider_aws, docker_ecr_aws_engine, AWS_KUBE_TEST_CLUSTER_ID,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
};
|
||||
pub use crate::helpers::cloudflare::dns_provider_cloudflare;
|
||||
pub use crate::helpers::common::{echo_app_environment, non_working_environment, working_minimal_environment};
|
||||
pub use crate::helpers::utilities::{
|
||||
context, engine_run_test, generate_id, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
};
|
||||
pub use function_name::named;
|
||||
pub use qovery_engine::models::{Action, Clone2, Context, EnvironmentAction, Storage, StorageType};
|
||||
pub use qovery_engine::transaction::{DeploymentOption, TransactionResult};
|
||||
pub use tracing::{span, Level};
|
||||
|
||||
// TODO:
|
||||
// - Tests that applications are always restarted when recieving a CREATE action
|
||||
@@ -18,14 +21,14 @@ use tracing::{span, Level};
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn deploy_environment(context: &Context, environment_action: &EnvironmentAction) -> TransactionResult {
|
||||
let engine = test_utilities::aws::docker_ecr_aws_engine(context);
|
||||
let engine = docker_ecr_aws_engine(context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let cp = test_utilities::aws::cloud_provider_aws(context);
|
||||
let nodes = test_utilities::aws::aws_kubernetes_nodes();
|
||||
let cp = cloud_provider_aws(context);
|
||||
let nodes = aws_kubernetes_nodes();
|
||||
let dns_provider = dns_provider_cloudflare(context);
|
||||
let k = test_utilities::aws::aws_kubernetes_eks(context, &cp, &dns_provider, nodes);
|
||||
let k = aws_kubernetes_eks(context, &cp, &dns_provider, nodes);
|
||||
|
||||
let _ = tx.deploy_environment_with_options(
|
||||
&k,
|
||||
@@ -41,14 +44,14 @@ pub fn deploy_environment(context: &Context, environment_action: &EnvironmentAct
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn ctx_pause_environment(context: &Context, environment_action: &EnvironmentAction) -> TransactionResult {
|
||||
let engine = test_utilities::aws::docker_ecr_aws_engine(context);
|
||||
let engine = docker_ecr_aws_engine(context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let cp = test_utilities::aws::cloud_provider_aws(context);
|
||||
let nodes = test_utilities::aws::aws_kubernetes_nodes();
|
||||
let cp = cloud_provider_aws(context);
|
||||
let nodes = aws_kubernetes_nodes();
|
||||
let dns_provider = dns_provider_cloudflare(context);
|
||||
let k = test_utilities::aws::aws_kubernetes_eks(context, &cp, &dns_provider, nodes);
|
||||
let k = aws_kubernetes_eks(context, &cp, &dns_provider, nodes);
|
||||
|
||||
let _ = tx.pause_environment(&k, environment_action);
|
||||
|
||||
@@ -57,14 +60,14 @@ pub fn ctx_pause_environment(context: &Context, environment_action: &Environment
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn delete_environment(context: &Context, environment_action: &EnvironmentAction) -> TransactionResult {
|
||||
let engine = test_utilities::aws::docker_ecr_aws_engine(context);
|
||||
let engine = docker_ecr_aws_engine(context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let cp = test_utilities::aws::cloud_provider_aws(context);
|
||||
let nodes = test_utilities::aws::aws_kubernetes_nodes();
|
||||
let cp = cloud_provider_aws(context);
|
||||
let nodes = aws_kubernetes_nodes();
|
||||
let dns_provider = dns_provider_cloudflare(context);
|
||||
let k = test_utilities::aws::aws_kubernetes_eks(context, &cp, &dns_provider, nodes);
|
||||
let k = aws_kubernetes_eks(context, &cp, &dns_provider, nodes);
|
||||
|
||||
let _ = tx.delete_environment(&k, environment_action);
|
||||
|
||||
@@ -84,7 +87,7 @@ fn deploy_a_working_environment_with_no_router_on_aws_eks() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -102,15 +105,15 @@ fn deploy_a_working_environment_with_no_router_on_aws_eks() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -130,7 +133,7 @@ fn deploy_a_working_environment_and_pause_it_eks() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -142,15 +145,15 @@ fn deploy_a_working_environment_and_pause_it_eks() {
|
||||
|
||||
let ea = EnvironmentAction::Environment(environment.clone());
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match ctx_pause_environment(&context_for_delete, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Check that we have actually 0 pods running for this app
|
||||
@@ -168,16 +171,16 @@ fn deploy_a_working_environment_and_pause_it_eks() {
|
||||
// Check we can resume the env
|
||||
let ctx_resume = context.clone_not_same_execution_id();
|
||||
match deploy_environment(&ctx_resume, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Cleanup
|
||||
match delete_environment(&context_for_delete, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
return test_name.to_string();
|
||||
})
|
||||
@@ -197,7 +200,7 @@ fn deploy_a_not_working_environment_with_no_router_on_aws_eks() {
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
let mut environment = test_utilities::common::non_working_environment(
|
||||
let mut environment = non_working_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -214,15 +217,15 @@ fn deploy_a_not_working_environment_with_no_router_on_aws_eks() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -243,7 +246,7 @@ fn build_with_buildpacks_and_deploy_a_working_environment() {
|
||||
let context = context();
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -270,15 +273,15 @@ fn build_with_buildpacks_and_deploy_a_working_environment() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -299,7 +302,7 @@ fn build_worker_with_buildpacks_and_deploy_a_working_environment() {
|
||||
let context = context();
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -326,15 +329,15 @@ fn build_worker_with_buildpacks_and_deploy_a_working_environment() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -355,7 +358,7 @@ fn deploy_a_working_environment_with_domain() {
|
||||
let context = context();
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -371,15 +374,15 @@ fn deploy_a_working_environment_with_domain() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -400,7 +403,7 @@ fn deploy_a_working_environment_with_domain() {
|
||||
// let context_for_delete = context.clone_not_same_execution_id();
|
||||
// let secrets = FuncTestsSecrets::new();
|
||||
//
|
||||
// let mut environment = test_utilities::aws::working_minimal_environment(&context, secrets.clone());
|
||||
// let mut environment = working_minimal_environment(&context, secrets.clone());
|
||||
// // Todo: fix domains
|
||||
// environment.routers = environment
|
||||
// .routers
|
||||
@@ -423,17 +426,17 @@ fn deploy_a_working_environment_with_domain() {
|
||||
// let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
//
|
||||
// match deploy_environment(&context, &ea) {
|
||||
// TransactionResult::Ok => assert!(true),
|
||||
// TransactionResult::Rollback(_) => assert!(false),
|
||||
// TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
// TransactionResult::Ok => {},
|
||||
// TransactionResult::Rollback(_) => panic!(),
|
||||
// TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
// };
|
||||
//
|
||||
// // todo: check TLS
|
||||
//
|
||||
// match delete_environment(&context_for_delete, &ea_delete) {
|
||||
// TransactionResult::Ok => assert!(true),
|
||||
// TransactionResult::Rollback(_) => assert!(false),
|
||||
// TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
// TransactionResult::Ok => {},
|
||||
// TransactionResult::Rollback(_) => panic!(),
|
||||
// TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
// };
|
||||
// return "deploy_a_working_environment_with_custom_domain".to_string();
|
||||
// })
|
||||
@@ -454,7 +457,7 @@ fn deploy_a_working_environment_with_storage_on_aws_eks() {
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -487,17 +490,17 @@ fn deploy_a_working_environment_with_storage_on_aws_eks() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -521,7 +524,7 @@ fn redeploy_same_app_with_ebs() {
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -558,9 +561,9 @@ fn redeploy_same_app_with_ebs() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
let app_name = format!("{}-0", &environment_check1.applications[0].name);
|
||||
let (_, number) = is_pod_restarted_env(
|
||||
@@ -572,9 +575,9 @@ fn redeploy_same_app_with_ebs() {
|
||||
);
|
||||
|
||||
match deploy_environment(&context_bis, &ea2) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
let (_, number2) = is_pod_restarted_env(
|
||||
@@ -587,9 +590,9 @@ fn redeploy_same_app_with_ebs() {
|
||||
//nothing change in the app, so, it shouldn't be restarted
|
||||
assert!(number.eq(&number2));
|
||||
match delete_environment(&context_for_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
return test_name.to_string();
|
||||
})
|
||||
@@ -602,7 +605,7 @@ fn redeploy_same_app_with_ebs() {
|
||||
// let context = context();
|
||||
// let deletion_context = context.clone_not_same_execution_id();
|
||||
//
|
||||
// let mut environment = test_utilities::aws::working_minimal_environment(&context);
|
||||
// let mut environment = working_minimal_environment(&context);
|
||||
//
|
||||
// // no apps
|
||||
// environment.applications = vec![];
|
||||
@@ -634,15 +637,15 @@ fn redeploy_same_app_with_ebs() {
|
||||
// let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
//
|
||||
// match deploy_environment(&context, &ea) {
|
||||
// TransactionResult::Ok => assert!(true),
|
||||
// TransactionResult::Rollback(_) => assert!(false),
|
||||
// TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
// TransactionResult::Ok => {},
|
||||
// TransactionResult::Rollback(_) => panic!(),
|
||||
// TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
// };
|
||||
//
|
||||
// match delete_environment(&deletion_context, &ea_delete) {
|
||||
// TransactionResult::Ok => assert!(true),
|
||||
// TransactionResult::Rollback(_) => assert!(false),
|
||||
// TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
// TransactionResult::Ok => {},
|
||||
// TransactionResult::Rollback(_) => panic!(),
|
||||
// TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
// };
|
||||
//
|
||||
// // TODO: remove the namespace (or project)
|
||||
@@ -655,21 +658,21 @@ fn deploy_a_working_production_environment_with_all_options_on_aws_eks() {
|
||||
|
||||
let context = context();
|
||||
|
||||
let mut environment = test_utilities::aws::working_environment(&context);
|
||||
let mut environment = working_environment(&context);
|
||||
environment.kind = Kind::Production;
|
||||
let environment_delete = environment.clone_not_same_execution_id();
|
||||
let ea = EnvironmentAction::Environment(environment);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {},
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
match delete_environment(&context, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {},
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
}*/
|
||||
|
||||
@@ -684,14 +687,14 @@ fn deploy_a_not_working_environment_and_after_working_environment() {
|
||||
let span = span!(Level::INFO, "test", name = test_name);
|
||||
let _enter = span.enter();
|
||||
|
||||
// let mut contex_envs = generate_contexts_and_environments(3, test_utilities::aws::working_minimal_environment);
|
||||
// let mut contex_envs = generate_contexts_and_environments(3, working_minimal_environment);
|
||||
let context = context();
|
||||
let context_for_not_working = context.clone_not_same_execution_id();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
// env part generation
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -721,19 +724,19 @@ fn deploy_a_not_working_environment_and_after_working_environment() {
|
||||
let ea_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context_for_not_working, &ea_not_working) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
match delete_environment(&context_for_delete, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -755,7 +758,7 @@ fn deploy_ok_fail_fail_ok_environment() {
|
||||
// working env
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -795,36 +798,36 @@ fn deploy_ok_fail_fail_ok_environment() {
|
||||
|
||||
// OK
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// FAIL and rollback
|
||||
match deploy_environment(&context_for_not_working_1, &ea_not_working_1) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => {}
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// FAIL and Rollback again
|
||||
match deploy_environment(&context_for_not_working_2, &ea_not_working_2) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => {}
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// Should be working
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -844,7 +847,7 @@ fn deploy_a_non_working_environment_with_no_failover_on_aws_eks() {
|
||||
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::non_working_environment(
|
||||
let environment = non_working_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -861,14 +864,14 @@ fn deploy_a_non_working_environment_with_no_failover_on_aws_eks() {
|
||||
let ea_delete = EnvironmentAction::Environment(delete_env);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
match delete_environment(&context_for_delete, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -894,33 +897,26 @@ fn deploy_a_non_working_environment_with_a_working_failover_on_aws_eks() {
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment =
|
||||
test_utilities::common::non_working_environment(&context, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment = test_utilities::common::working_minimal_environment(
|
||||
&context,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let environment = non_working_environment(&context, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment =
|
||||
working_minimal_environment(&context, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
// context for deletion
|
||||
let context_deletion = context.clone_not_same_execution_id();
|
||||
let mut delete_env = test_utilities::common::working_minimal_environment(
|
||||
&context_deletion,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let mut delete_env =
|
||||
working_minimal_environment(&context_deletion, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
delete_env.action = Action::Delete;
|
||||
let ea_delete = EnvironmentAction::Environment(delete_env);
|
||||
let ea = EnvironmentAction::EnvironmentWithFailover(environment, Box::new(failover_environment));
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
match delete_environment(&context_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -946,22 +942,16 @@ fn deploy_2_non_working_environments_with_2_working_failovers_on_aws_eks() {
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let failover_environment_1 = test_utilities::common::echo_app_environment(
|
||||
&context_failover_1,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let fail_app_1 = test_utilities::common::non_working_environment(
|
||||
let failover_environment_1 =
|
||||
echo_app_environment(&context_failover_1, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let fail_app_1 = non_working_environment(
|
||||
&context_first_fail_deployement_1,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let mut failover_environment_2 = test_utilities::common::echo_app_environment(
|
||||
&context_failover_2,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let fail_app_2 = test_utilities::common::non_working_environment(
|
||||
let mut failover_environment_2 =
|
||||
echo_app_environment(&context_failover_2, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let fail_app_2 = non_working_environment(
|
||||
&context_second_fail_deployement_2,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -980,11 +970,7 @@ fn deploy_2_non_working_environments_with_2_working_failovers_on_aws_eks() {
|
||||
|
||||
// context for deletion
|
||||
let context_deletion = context_failover_1.clone_not_same_execution_id();
|
||||
let mut delete_env = test_utilities::common::echo_app_environment(
|
||||
&context_deletion,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let mut delete_env = echo_app_environment(&context_deletion, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
delete_env.action = Action::Delete;
|
||||
let ea_delete = EnvironmentAction::Environment(delete_env);
|
||||
|
||||
@@ -993,21 +979,21 @@ fn deploy_2_non_working_environments_with_2_working_failovers_on_aws_eks() {
|
||||
let ea2 = EnvironmentAction::EnvironmentWithFailover(fail_app_2, Box::new(failover_environment_2));
|
||||
|
||||
match deploy_environment(&context_failover_1, &ea1) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match deploy_environment(&context_failover_2, &ea2) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match delete_environment(&context_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1029,31 +1015,26 @@ fn deploy_a_non_working_environment_with_a_non_working_failover_on_aws_eks() {
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment =
|
||||
test_utilities::common::non_working_environment(&context, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment =
|
||||
test_utilities::common::non_working_environment(&context, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let environment = non_working_environment(&context, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment = non_working_environment(&context, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let mut delete_env = test_utilities::common::non_working_environment(
|
||||
&context_for_deletion,
|
||||
AWS_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let mut delete_env =
|
||||
non_working_environment(&context_for_deletion, AWS_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
delete_env.action = Action::Delete;
|
||||
// environment action initialize
|
||||
let ea_delete = EnvironmentAction::Environment(delete_env);
|
||||
let ea = EnvironmentAction::EnvironmentWithFailover(environment, Box::new(failover_environment));
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
match delete_environment(&context_for_deletion, &ea_delete) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
return test_name.to_string();
|
||||
@@ -1079,17 +1060,17 @@ fn deploy_but_fail_to_push_image_on_container_registry() {
|
||||
fn pause_a_working_development_environment_on_aws_eks() {
|
||||
init();
|
||||
|
||||
let context = test_utilities::aws::context();
|
||||
let context = context();
|
||||
|
||||
let mut environment = test_utilities::aws::working_environment(&context);
|
||||
let mut environment = working_environment(&context);
|
||||
environment.kind = Kind::Development;
|
||||
|
||||
let ea = EnvironmentAction::Environment(environment);
|
||||
|
||||
match pause_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {},
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1098,17 +1079,17 @@ fn pause_a_working_development_environment_on_aws_eks() {
|
||||
fn pause_a_working_production_environment_on_aws_eks() {
|
||||
init();
|
||||
|
||||
let context = test_utilities::aws::context();
|
||||
let context = context();
|
||||
|
||||
let mut environment = test_utilities::aws::working_environment(&context);
|
||||
let mut environment = working_environment(&context);
|
||||
environment.kind = Kind::Production;
|
||||
|
||||
let ea = EnvironmentAction::Environment(environment);
|
||||
|
||||
match pause_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {},
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1117,16 +1098,16 @@ fn pause_a_working_production_environment_on_aws_eks() {
|
||||
fn pause_a_non_working_environment_on_aws_eks() {
|
||||
init();
|
||||
|
||||
let context = test_utilities::aws::context();
|
||||
let context = context();
|
||||
|
||||
let mut environment = test_utilities::aws::non_working_environment(&context);
|
||||
let mut environment = non_working_environment(&context);
|
||||
|
||||
let ea = EnvironmentAction::Environment(environment);
|
||||
|
||||
match pause_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {},
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1136,51 +1117,51 @@ fn start_and_pause_and_start_and_delete_a_working_environment_on_aws_eks() {
|
||||
init();
|
||||
|
||||
// START
|
||||
let context = test_utilities::aws::context();
|
||||
let context = context();
|
||||
|
||||
let mut environment = test_utilities::aws::working_environment(&context);
|
||||
let mut environment = working_environment(&context);
|
||||
let ea = EnvironmentAction::Environment(environment);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {},
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// PAUSE
|
||||
let context = test_utilities::aws::context();
|
||||
let context = context();
|
||||
|
||||
let mut environment = test_utilities::aws::working_environment(&context);
|
||||
let mut environment = working_environment(&context);
|
||||
let ea = EnvironmentAction::Environment(environment);
|
||||
|
||||
match pause_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {},
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// START
|
||||
let context = test_utilities::aws::context();
|
||||
let context = context();
|
||||
|
||||
let mut environment = test_utilities::aws::working_environment(&context);
|
||||
let mut environment = working_environment(&context);
|
||||
let ea = EnvironmentAction::Environment(environment);
|
||||
|
||||
match deploy_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {},
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// DELETE
|
||||
let context = test_utilities::aws::context();
|
||||
let context = context();
|
||||
|
||||
let mut environment = test_utilities::aws::working_environment(&context);
|
||||
let mut environment = working_environment(&context);
|
||||
let ea = EnvironmentAction::Environment(environment);
|
||||
|
||||
match delete_environment(&context, &ea) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {},
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
extern crate test_utilities;
|
||||
pub use ::function_name::named;
|
||||
pub use tracing::{span, Level};
|
||||
|
||||
use self::test_utilities::cloudflare::dns_provider_cloudflare;
|
||||
use self::test_utilities::utilities::{context, engine_run_test, generate_cluster_id, init, FuncTestsSecrets};
|
||||
use ::function_name::named;
|
||||
use tracing::{span, Level};
|
||||
|
||||
use self::test_utilities::aws::eks_options;
|
||||
use qovery_engine::cloud_provider::aws::kubernetes::VpcQoveryNetworkMode::{WithNatGateways, WithoutNatGateways};
|
||||
use qovery_engine::cloud_provider::aws::kubernetes::{VpcQoveryNetworkMode, EKS};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
pub use crate::helpers::aws::{
|
||||
aws_kubernetes_nodes, cloud_provider_aws, docker_ecr_aws_engine, eks_options, AWS_KUBERNETES_VERSION,
|
||||
};
|
||||
pub use crate::helpers::cloudflare::dns_provider_cloudflare;
|
||||
pub use crate::helpers::utilities::{context, engine_run_test, generate_cluster_id, init, FuncTestsSecrets};
|
||||
pub use qovery_engine::cloud_provider::aws::kubernetes::VpcQoveryNetworkMode::{WithNatGateways, WithoutNatGateways};
|
||||
pub use qovery_engine::cloud_provider::aws::kubernetes::{VpcQoveryNetworkMode, EKS};
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
|
||||
#[cfg(test)]
|
||||
fn create_upgrade_and_destroy_eks_cluster(
|
||||
@@ -25,12 +25,12 @@ fn create_upgrade_and_destroy_eks_cluster(
|
||||
let _enter = span.enter();
|
||||
|
||||
let context = context();
|
||||
let engine = test_utilities::aws::docker_ecr_aws_engine(&context);
|
||||
let engine = docker_ecr_aws_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let aws = test_utilities::aws::cloud_provider_aws(&context);
|
||||
let nodes = test_utilities::aws::aws_kubernetes_nodes();
|
||||
let aws = cloud_provider_aws(&context);
|
||||
let nodes = aws_kubernetes_nodes();
|
||||
|
||||
let cloudflare = dns_provider_cloudflare(&context);
|
||||
|
||||
@@ -53,9 +53,9 @@ fn create_upgrade_and_destroy_eks_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Upgrade
|
||||
@@ -76,9 +76,9 @@ fn create_upgrade_and_destroy_eks_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Destroy
|
||||
@@ -86,9 +86,9 @@ fn create_upgrade_and_destroy_eks_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
@@ -111,12 +111,12 @@ fn create_and_destroy_eks_cluster(
|
||||
|
||||
let context = context();
|
||||
|
||||
let engine = test_utilities::aws::docker_ecr_aws_engine(&context);
|
||||
let engine = docker_ecr_aws_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let aws = test_utilities::aws::cloud_provider_aws(&context);
|
||||
let nodes = test_utilities::aws::aws_kubernetes_nodes();
|
||||
let aws = cloud_provider_aws(&context);
|
||||
let nodes = aws_kubernetes_nodes();
|
||||
let mut eks_options = eks_options(secrets);
|
||||
eks_options.vpc_qovery_network_mode = vpc_network_mode;
|
||||
|
||||
@@ -127,7 +127,7 @@ fn create_and_destroy_eks_cluster(
|
||||
generate_cluster_id(region).as_str(),
|
||||
uuid::Uuid::new_v4(),
|
||||
generate_cluster_id(region).as_str(),
|
||||
test_utilities::aws::AWS_KUBERNETES_VERSION,
|
||||
AWS_KUBERNETES_VERSION,
|
||||
region,
|
||||
&aws,
|
||||
&cloudflare,
|
||||
@@ -141,9 +141,9 @@ fn create_and_destroy_eks_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if test_infra_pause {
|
||||
@@ -152,9 +152,9 @@ fn create_and_destroy_eks_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Resume
|
||||
@@ -162,9 +162,9 @@ fn create_and_destroy_eks_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -173,9 +173,9 @@ fn create_and_destroy_eks_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
use ::function_name::named;
|
||||
use tracing::{span, warn, Level};
|
||||
pub use tracing::{span, warn, Level};
|
||||
|
||||
use qovery_engine::cloud_provider::Kind as ProviderKind;
|
||||
use qovery_engine::models::{
|
||||
pub use qovery_engine::cloud_provider::Kind as ProviderKind;
|
||||
pub use qovery_engine::models::{
|
||||
Action, Application, Clone2, Context, Database, DatabaseKind, DatabaseMode, Environment, EnvironmentAction,
|
||||
};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
use test_utilities::utilities::{
|
||||
context, engine_run_test, generate_id, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
};
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
|
||||
use qovery_engine::models::DatabaseMode::{CONTAINER, MANAGED};
|
||||
use test_utilities::common::working_minimal_environment;
|
||||
use test_utilities::digitalocean::{
|
||||
pub use qovery_engine::models::DatabaseMode::{CONTAINER, MANAGED};
|
||||
|
||||
pub use crate::helpers::common::{
|
||||
environment_3_apps_3_routers_3_databases, environnement_2_app_2_routers_1_psql, working_minimal_environment,
|
||||
};
|
||||
pub use crate::helpers::digitalocean::{
|
||||
clean_environments, delete_environment, deploy_environment, pause_environment, DO_KUBE_TEST_CLUSTER_ID,
|
||||
DO_MANAGED_DATABASE_DISK_TYPE, DO_MANAGED_DATABASE_INSTANCE_TYPE, DO_QOVERY_ORGANIZATION_ID,
|
||||
DO_SELF_HOSTED_DATABASE_DISK_TYPE, DO_SELF_HOSTED_DATABASE_INSTANCE_TYPE, DO_TEST_REGION,
|
||||
};
|
||||
pub use crate::helpers::utilities::{
|
||||
context, engine_run_test, generate_id, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
};
|
||||
pub use function_name::named;
|
||||
|
||||
/**
|
||||
**
|
||||
@@ -40,7 +43,7 @@ fn deploy_an_environment_with_3_databases_and_3_apps() {
|
||||
let context = context();
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::environment_3_apps_3_routers_3_databases(
|
||||
let environment = environment_3_apps_3_routers_3_databases(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -58,15 +61,15 @@ fn deploy_an_environment_with_3_databases_and_3_apps() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -93,7 +96,7 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
let context = context();
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let environment = environnement_2_app_2_routers_1_psql(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -111,15 +114,15 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action.clone(), DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match pause_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Check that we have actually 0 pods running for this db
|
||||
@@ -135,9 +138,9 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
assert_eq!(ret.unwrap().items.is_empty(), true);
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -170,7 +173,7 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
.DEFAULT_TEST_DOMAIN
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let environment = environnement_2_app_2_routers_1_psql(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -188,7 +191,7 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
app
|
||||
})
|
||||
.collect::<Vec<qovery_engine::models::Application>>();
|
||||
let mut environment_delete = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let mut environment_delete = environnement_2_app_2_routers_1_psql(
|
||||
&context_for_deletion,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -204,9 +207,9 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
let env_action_for_deletion = EnvironmentAction::Environment(environment_delete.clone());
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY
|
||||
let database_name = format!("postgresql-{}-0", &environment_check.databases[0].name);
|
||||
@@ -217,13 +220,13 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
database_name.as_str(),
|
||||
secrets.clone(),
|
||||
) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
(true, _) => {}
|
||||
(false, _) => panic!(),
|
||||
}
|
||||
match deploy_environment(&context, env_action_fail_ok, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => {}
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY EVEN IF FAIL
|
||||
match is_pod_restarted_env(
|
||||
@@ -233,14 +236,14 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
database_name.as_str(),
|
||||
secrets.clone(),
|
||||
) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
(true, _) => {}
|
||||
(false, _) => panic!(),
|
||||
}
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_for_deletion, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -273,7 +276,7 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let environment = environnement_2_app_2_routers_1_psql(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -281,7 +284,7 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
DO_SELF_HOSTED_DATABASE_DISK_TYPE,
|
||||
);
|
||||
//let env_to_check = environment.clone();
|
||||
let mut environment_delete = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let mut environment_delete = environnement_2_app_2_routers_1_psql(
|
||||
&context_for_deletion,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -295,9 +298,9 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
let env_action_for_deletion = EnvironmentAction::Environment(environment_delete.clone());
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TODO: should be uncommented as soon as cert-manager is fixed
|
||||
// for the moment this assert report a SSL issue on the second router, so it's works well
|
||||
@@ -307,9 +310,9 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
}*/
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_for_deletion, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -344,7 +347,7 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
let context_for_redeploy = context.clone_not_same_execution_id();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -429,14 +432,14 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
match deploy_environment(&context_for_redeploy, env_action_redeploy, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY
|
||||
let database_name = format!("postgresql-{}-0", &environment_check.databases[0].name);
|
||||
@@ -447,14 +450,14 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
database_name.as_str(),
|
||||
secrets.clone(),
|
||||
) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
(true, _) => {}
|
||||
(false, _) => panic!(),
|
||||
}
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -556,17 +559,17 @@ fn test_postgresql_configuration(
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, ea, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, ea_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -733,17 +736,17 @@ fn test_mongodb_configuration(
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -924,17 +927,17 @@ fn test_mysql_configuration(
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, ea, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&deletion_context, ea_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -1078,17 +1081,17 @@ fn test_redis_configuration(
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, ea, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, ea_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
extern crate test_utilities;
|
||||
// Note: All those tests relies on a test cluster running on DigitalOcean infrastructure.
|
||||
// This cluster should be live in order to have those tests passing properly.
|
||||
|
||||
use self::test_utilities::digitalocean::{
|
||||
pub use crate::helpers::common::{non_working_environment, working_minimal_environment};
|
||||
pub use crate::helpers::digitalocean::{
|
||||
clean_environments, delete_environment, deploy_environment, pause_environment, DO_KUBE_TEST_CLUSTER_ID,
|
||||
DO_QOVERY_ORGANIZATION_ID, DO_TEST_REGION,
|
||||
};
|
||||
use self::test_utilities::utilities::{
|
||||
engine_run_test, generate_id, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
pub use crate::helpers::utilities::{
|
||||
context, engine_run_test, generate_id, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
};
|
||||
use ::function_name::named;
|
||||
use qovery_engine::cloud_provider::Kind;
|
||||
use qovery_engine::models::{Action, Clone2, EnvironmentAction, Storage, StorageType};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
use std::collections::BTreeMap;
|
||||
use test_utilities::utilities::context;
|
||||
use tracing::{span, warn, Level};
|
||||
|
||||
// Note: All those tests relies on a test cluster running on DigitalOcean infrastructure.
|
||||
// This cluster should be live in order to have those tests passing properly.
|
||||
pub use function_name::named;
|
||||
pub use qovery_engine::cloud_provider::Kind;
|
||||
pub use qovery_engine::models::{Action, Clone2, EnvironmentAction, Storage, StorageType};
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
pub use std::collections::BTreeMap;
|
||||
pub use tracing::{span, warn, Level};
|
||||
|
||||
#[cfg(feature = "test-do-self-hosted")]
|
||||
#[ignore]
|
||||
@@ -33,7 +31,7 @@ fn digitalocean_doks_deploy_a_working_environment_with_no_router() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -52,15 +50,15 @@ fn digitalocean_doks_deploy_a_working_environment_with_no_router() {
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_for_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -87,7 +85,7 @@ fn digitalocean_doks_deploy_a_not_working_environment_with_no_router() {
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
let mut environment = test_utilities::common::non_working_environment(
|
||||
let mut environment = non_working_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -105,15 +103,15 @@ fn digitalocean_doks_deploy_a_not_working_environment_with_no_router() {
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_for_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -139,7 +137,7 @@ fn digitalocean_doks_deploy_a_working_environment_and_pause() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -152,15 +150,15 @@ fn digitalocean_doks_deploy_a_working_environment_and_pause() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
|
||||
match deploy_environment(&context, env_action.clone(), DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match pause_environment(&context_for_delete, env_action.clone(), DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Check that we have actually 0 pods running for this app
|
||||
@@ -178,16 +176,16 @@ fn digitalocean_doks_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(), DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Cleanup
|
||||
match delete_environment(&context_for_delete, env_action.clone(), DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -213,7 +211,7 @@ fn digitalocean_doks_build_with_buildpacks_and_deploy_a_working_environment() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -241,15 +239,15 @@ fn digitalocean_doks_build_with_buildpacks_and_deploy_a_working_environment() {
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_for_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -275,7 +273,7 @@ fn digitalocean_doks_deploy_a_working_environment_with_domain() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -292,15 +290,15 @@ fn digitalocean_doks_deploy_a_working_environment_with_domain() {
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_for_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -327,7 +325,7 @@ fn digitalocean_doks_deploy_a_working_environment_with_storage() {
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -361,17 +359,17 @@ fn digitalocean_doks_deploy_a_working_environment_with_storage() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// TODO(benjaminch): check the disk is here and with correct size, can use DigitalOcean API
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -399,7 +397,7 @@ fn digitalocean_doks_redeploy_same_app() {
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -437,9 +435,9 @@ fn digitalocean_doks_redeploy_same_app() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
let app_name = format!("{}-0", &environment_check1.applications[0].name);
|
||||
@@ -452,9 +450,9 @@ fn digitalocean_doks_redeploy_same_app() {
|
||||
);
|
||||
|
||||
match deploy_environment(&context_bis, env_action_redeploy, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
let (_, number2) = is_pod_restarted_env(
|
||||
@@ -469,9 +467,9 @@ fn digitalocean_doks_redeploy_same_app() {
|
||||
assert!(number.eq(&number2));
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -500,7 +498,7 @@ fn digitalocean_doks_deploy_a_not_working_environment_and_then_working_environme
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
// env part generation
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -532,19 +530,19 @@ fn digitalocean_doks_deploy_a_not_working_environment_and_then_working_environme
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context_for_not_working, env_action_not_working, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
match delete_environment(&context_for_delete, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -570,7 +568,7 @@ fn digitalocean_doks_deploy_ok_fail_fail_ok_environment() {
|
||||
// working env
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -611,36 +609,36 @@ fn digitalocean_doks_deploy_ok_fail_fail_ok_environment() {
|
||||
|
||||
// OK
|
||||
match deploy_environment(&context, env_action.clone(), DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// FAIL and rollback
|
||||
match deploy_environment(&context_for_not_working_1, env_action_not_working_1, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => {}
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// FAIL and Rollback again
|
||||
match deploy_environment(&context_for_not_working_2, env_action_not_working_2, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => {}
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// Should be working
|
||||
match deploy_environment(&context, env_action.clone(), DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -665,7 +663,7 @@ fn digitalocean_doks_deploy_a_non_working_environment_with_no_failover() {
|
||||
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::non_working_environment(
|
||||
let environment = non_working_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -683,15 +681,15 @@ fn digitalocean_doks_deploy_a_non_working_environment_with_no_failover() {
|
||||
let env_action_delete = EnvironmentAction::Environment(delete_env);
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), DO_TEST_REGION) {
|
||||
@@ -722,21 +720,14 @@ fn digitalocean_doks_deploy_a_non_working_environment_with_a_working_failover()
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment =
|
||||
test_utilities::common::non_working_environment(&context, DO_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment = test_utilities::common::working_minimal_environment(
|
||||
&context,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let environment = non_working_environment(&context, DO_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment =
|
||||
working_minimal_environment(&context, DO_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
|
||||
// context for deletion
|
||||
let context_deletion = context.clone_not_same_execution_id();
|
||||
let mut delete_env = test_utilities::common::working_minimal_environment(
|
||||
&context_deletion,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let mut delete_env =
|
||||
working_minimal_environment(&context_deletion, DO_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
delete_env.action = Action::Delete;
|
||||
|
||||
let env_action_delete = EnvironmentAction::Environment(delete_env);
|
||||
@@ -744,15 +735,15 @@ fn digitalocean_doks_deploy_a_non_working_environment_with_a_working_failover()
|
||||
EnvironmentAction::EnvironmentWithFailover(environment.clone(), Box::new(failover_environment.clone()));
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match delete_environment(&context_deletion, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(
|
||||
@@ -787,17 +778,12 @@ fn digitalocean_doks_deploy_a_non_working_environment_with_a_non_working_failove
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment =
|
||||
test_utilities::common::non_working_environment(&context, DO_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment =
|
||||
test_utilities::common::non_working_environment(&context, DO_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let environment = non_working_environment(&context, DO_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment = non_working_environment(&context, DO_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let mut delete_env = test_utilities::common::non_working_environment(
|
||||
&context_for_deletion,
|
||||
DO_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let mut delete_env =
|
||||
non_working_environment(&context_for_deletion, DO_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
delete_env.action = Action::Delete;
|
||||
|
||||
// environment action initialize
|
||||
@@ -806,15 +792,15 @@ fn digitalocean_doks_deploy_a_non_working_environment_with_a_non_working_failove
|
||||
EnvironmentAction::EnvironmentWithFailover(environment.clone(), Box::new(failover_environment.clone()));
|
||||
|
||||
match deploy_environment(&context, env_action, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, DO_TEST_REGION) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
extern crate test_utilities;
|
||||
pub use ::function_name::named;
|
||||
pub use tracing::{span, Level};
|
||||
|
||||
use self::test_utilities::cloudflare::dns_provider_cloudflare;
|
||||
use self::test_utilities::utilities::{context, engine_run_test, generate_cluster_id, init, FuncTestsSecrets};
|
||||
use ::function_name::named;
|
||||
use tracing::{span, Level};
|
||||
pub use qovery_engine::cloud_provider::digitalocean::kubernetes::DOKS;
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
|
||||
use qovery_engine::cloud_provider::digitalocean::kubernetes::DOKS;
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
|
||||
use qovery_engine::cloud_provider::digitalocean::application::Region;
|
||||
use test_utilities::digitalocean::DO_KUBERNETES_VERSION;
|
||||
pub use crate::helpers::cloudflare::dns_provider_cloudflare;
|
||||
pub use crate::helpers::digitalocean::{
|
||||
cloud_provider_digitalocean, do_kubernetes_cluster_options, do_kubernetes_nodes, docker_cr_do_engine,
|
||||
DO_KUBERNETES_VERSION,
|
||||
};
|
||||
pub use crate::helpers::utilities::{context, engine_run_test, generate_cluster_id, init, FuncTestsSecrets};
|
||||
pub use qovery_engine::cloud_provider::digitalocean::application::Region;
|
||||
|
||||
#[cfg(test)]
|
||||
fn create_upgrade_and_destroy_doks_cluster(
|
||||
@@ -26,12 +27,12 @@ fn create_upgrade_and_destroy_doks_cluster(
|
||||
let _enter = span.enter();
|
||||
|
||||
let context = context();
|
||||
let engine = test_utilities::digitalocean::docker_cr_do_engine(&context);
|
||||
let engine = docker_cr_do_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let do_cluster = test_utilities::digitalocean::cloud_provider_digitalocean(&context);
|
||||
let nodes = test_utilities::digitalocean::do_kubernetes_nodes();
|
||||
let do_cluster = cloud_provider_digitalocean(&context);
|
||||
let nodes = do_kubernetes_nodes();
|
||||
let cloudflare = dns_provider_cloudflare(&context);
|
||||
|
||||
let cluster_id = generate_cluster_id(region.as_str());
|
||||
@@ -46,7 +47,7 @@ fn create_upgrade_and_destroy_doks_cluster(
|
||||
&do_cluster,
|
||||
&cloudflare,
|
||||
nodes,
|
||||
test_utilities::digitalocean::do_kubernetes_cluster_options(secrets, cluster_id),
|
||||
do_kubernetes_cluster_options(secrets, cluster_id),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -55,9 +56,9 @@ fn create_upgrade_and_destroy_doks_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Upgrade
|
||||
@@ -67,9 +68,9 @@ fn create_upgrade_and_destroy_doks_cluster(
|
||||
// panic!("{:?}", err)
|
||||
// }
|
||||
// let _ = match tx.commit() {
|
||||
// TransactionResult::Ok => assert!(true),
|
||||
// TransactionResult::Rollback(_) => assert!(false),
|
||||
// TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
// TransactionResult::Ok => {},
|
||||
// TransactionResult::Rollback(_) => panic!(),
|
||||
// TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
// };
|
||||
|
||||
// Destroy
|
||||
@@ -77,9 +78,9 @@ fn create_upgrade_and_destroy_doks_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
@@ -95,12 +96,12 @@ fn create_and_destroy_doks_cluster(region: Region, secrets: FuncTestsSecrets, te
|
||||
let _enter = span.enter();
|
||||
|
||||
let context = context();
|
||||
let engine = test_utilities::digitalocean::docker_cr_do_engine(&context);
|
||||
let engine = docker_cr_do_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let do_cluster = test_utilities::digitalocean::cloud_provider_digitalocean(&context);
|
||||
let nodes = test_utilities::digitalocean::do_kubernetes_nodes();
|
||||
let do_cluster = cloud_provider_digitalocean(&context);
|
||||
let nodes = do_kubernetes_nodes();
|
||||
let cloudflare = dns_provider_cloudflare(&context);
|
||||
|
||||
let cluster_id = generate_cluster_id(region.as_str());
|
||||
@@ -115,7 +116,7 @@ fn create_and_destroy_doks_cluster(region: Region, secrets: FuncTestsSecrets, te
|
||||
&do_cluster,
|
||||
&cloudflare,
|
||||
nodes,
|
||||
test_utilities::digitalocean::do_kubernetes_cluster_options(secrets, cluster_id),
|
||||
do_kubernetes_cluster_options(secrets, cluster_id),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -124,9 +125,9 @@ fn create_and_destroy_doks_cluster(region: Region, secrets: FuncTestsSecrets, te
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if test_infra_pause {
|
||||
@@ -135,9 +136,9 @@ fn create_and_destroy_doks_cluster(region: Region, secrets: FuncTestsSecrets, te
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Resume
|
||||
@@ -145,9 +146,9 @@ fn create_and_destroy_doks_cluster(region: Region, secrets: FuncTestsSecrets, te
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -156,9 +157,9 @@ fn create_and_destroy_doks_cluster(region: Region, secrets: FuncTestsSecrets, te
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
extern crate test_utilities;
|
||||
pub use ::function_name::named;
|
||||
pub use tracing::{span, Level};
|
||||
|
||||
use self::test_utilities::cloudflare::dns_provider_cloudflare;
|
||||
use self::test_utilities::utilities::{context, engine_run_test, init, FuncTestsSecrets};
|
||||
use ::function_name::named;
|
||||
use tracing::{span, Level};
|
||||
|
||||
use qovery_engine::cloud_provider::digitalocean::kubernetes::DOKS;
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
pub use crate::helpers::cloudflare::dns_provider_cloudflare;
|
||||
pub use crate::helpers::digitalocean::{
|
||||
cloud_provider_digitalocean, do_kubernetes_cluster_options, do_kubernetes_nodes, docker_cr_do_engine,
|
||||
DO_KUBERNETES_VERSION, DO_KUBE_TEST_CLUSTER_ID, DO_KUBE_TEST_CLUSTER_NAME, DO_TEST_REGION,
|
||||
};
|
||||
pub use crate::helpers::utilities::{context, engine_run_test, init, FuncTestsSecrets};
|
||||
pub use qovery_engine::cloud_provider::digitalocean::kubernetes::DOKS;
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
|
||||
// Warning: This test shouldn't be ran by CI
|
||||
// Note: this test creates the test cluster where all application tests will be ran
|
||||
@@ -25,28 +27,25 @@ fn create_digitalocean_kubernetes_doks_test_cluster() {
|
||||
let _enter = span.enter();
|
||||
|
||||
let context = context();
|
||||
let engine = test_utilities::digitalocean::docker_cr_do_engine(&context);
|
||||
let engine = docker_cr_do_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let do_cluster = test_utilities::digitalocean::cloud_provider_digitalocean(&context);
|
||||
let nodes = test_utilities::digitalocean::do_kubernetes_nodes();
|
||||
let do_cluster = cloud_provider_digitalocean(&context);
|
||||
let nodes = do_kubernetes_nodes();
|
||||
let cloudflare = dns_provider_cloudflare(&context);
|
||||
|
||||
let kubernetes = DOKS::new(
|
||||
context,
|
||||
test_utilities::digitalocean::DO_KUBE_TEST_CLUSTER_ID.to_string(),
|
||||
DO_KUBE_TEST_CLUSTER_ID.to_string(),
|
||||
uuid::Uuid::new_v4(),
|
||||
test_utilities::digitalocean::DO_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
test_utilities::digitalocean::DO_KUBERNETES_VERSION.to_string(),
|
||||
test_utilities::digitalocean::DO_TEST_REGION,
|
||||
DO_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
DO_KUBERNETES_VERSION.to_string(),
|
||||
DO_TEST_REGION,
|
||||
&do_cluster,
|
||||
&cloudflare,
|
||||
nodes,
|
||||
test_utilities::digitalocean::do_kubernetes_cluster_options(
|
||||
secrets,
|
||||
test_utilities::digitalocean::DO_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
),
|
||||
do_kubernetes_cluster_options(secrets, DO_KUBE_TEST_CLUSTER_NAME.to_string()),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -55,9 +54,9 @@ fn create_digitalocean_kubernetes_doks_test_cluster() {
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
@@ -81,28 +80,25 @@ fn destroy_digitalocean_kubernetes_doks_test_cluster() {
|
||||
let _enter = span.enter();
|
||||
|
||||
let context = context();
|
||||
let engine = test_utilities::digitalocean::docker_cr_do_engine(&context);
|
||||
let engine = docker_cr_do_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let do_cluster = test_utilities::digitalocean::cloud_provider_digitalocean(&context);
|
||||
let nodes = test_utilities::digitalocean::do_kubernetes_nodes();
|
||||
let do_cluster = cloud_provider_digitalocean(&context);
|
||||
let nodes = do_kubernetes_nodes();
|
||||
let cloudflare = dns_provider_cloudflare(&context);
|
||||
|
||||
let kubernetes = DOKS::new(
|
||||
context,
|
||||
test_utilities::digitalocean::DO_KUBE_TEST_CLUSTER_ID.to_string(),
|
||||
DO_KUBE_TEST_CLUSTER_ID.to_string(),
|
||||
uuid::Uuid::new_v4(),
|
||||
test_utilities::digitalocean::DO_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
test_utilities::digitalocean::DO_KUBERNETES_VERSION.to_string(),
|
||||
test_utilities::digitalocean::DO_TEST_REGION,
|
||||
DO_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
DO_KUBERNETES_VERSION.to_string(),
|
||||
DO_TEST_REGION,
|
||||
&do_cluster,
|
||||
&cloudflare,
|
||||
nodes,
|
||||
test_utilities::digitalocean::do_kubernetes_cluster_options(
|
||||
secrets,
|
||||
test_utilities::digitalocean::DO_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
),
|
||||
do_kubernetes_cluster_options(secrets, DO_KUBE_TEST_CLUSTER_NAME.to_string()),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -111,9 +107,9 @@ fn destroy_digitalocean_kubernetes_doks_test_cluster() {
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
|
||||
@@ -7,14 +7,13 @@ use qovery_engine::cloud_provider::aws::AWS;
|
||||
use qovery_engine::cloud_provider::models::NodeGroups;
|
||||
use qovery_engine::cloud_provider::qovery::EngineLocation::ClientSide;
|
||||
use qovery_engine::cloud_provider::TerraformStateCredentials;
|
||||
use qovery_engine::container_registry::docker_hub::DockerHub;
|
||||
use qovery_engine::container_registry::ecr::ECR;
|
||||
use qovery_engine::dns_provider::DnsProvider;
|
||||
use qovery_engine::engine::Engine;
|
||||
use qovery_engine::models::Context;
|
||||
|
||||
use crate::cloudflare::dns_provider_cloudflare;
|
||||
use crate::utilities::{build_platform_local_docker, FuncTestsSecrets};
|
||||
use crate::helpers::cloudflare::dns_provider_cloudflare;
|
||||
use crate::helpers::utilities::{build_platform_local_docker, FuncTestsSecrets};
|
||||
|
||||
pub const AWS_QOVERY_ORGANIZATION_ID: &str = "u8nb94c7fwxzr2jt";
|
||||
pub const AWS_REGION_FOR_S3: &str = "eu-west-3";
|
||||
@@ -43,16 +42,6 @@ pub fn container_registry_ecr(context: &Context) -> ECR {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn container_registry_docker_hub(context: &Context) -> DockerHub {
|
||||
DockerHub::new(
|
||||
context.clone(),
|
||||
"my-docker-hub-id-123",
|
||||
"my-default-docker-hub",
|
||||
"qoveryrd",
|
||||
"3b9481fe-74e7-4d7b-bc08-e147c9fd4f24",
|
||||
)
|
||||
}
|
||||
|
||||
pub fn aws_kubernetes_nodes() -> Vec<NodeGroups> {
|
||||
vec![NodeGroups::new("groupeks0".to_string(), 5, 10, "t3a.large".to_string())
|
||||
.expect("Problem while setup EKS nodes")]
|
||||
@@ -71,7 +60,7 @@ pub fn cloud_provider_aws(context: &Context) -> AWS {
|
||||
TerraformStateCredentials {
|
||||
access_key_id: secrets.TERRAFORM_AWS_ACCESS_KEY_ID.unwrap(),
|
||||
secret_access_key: secrets.TERRAFORM_AWS_SECRET_ACCESS_KEY.unwrap(),
|
||||
region: "eu-west-3".to_string(),
|
||||
region: AWS_REGION_FOR_S3.to_string(),
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::utilities::FuncTestsSecrets;
|
||||
use crate::helpers::utilities::FuncTestsSecrets;
|
||||
use qovery_engine::dns_provider::cloudflare::Cloudflare;
|
||||
use qovery_engine::models::Context;
|
||||
|
||||
@@ -3,25 +3,17 @@ extern crate serde_derive;
|
||||
|
||||
use chrono::Utc;
|
||||
|
||||
use crate::helpers::utilities::{generate_id, generate_password};
|
||||
use qovery_engine::cloud_provider::utilities::sanitize_name;
|
||||
use qovery_engine::models::{
|
||||
Action, Application, Context, Database, DatabaseKind, Environment, GitCredentials, Route, Router, Storage,
|
||||
StorageType,
|
||||
};
|
||||
|
||||
use crate::utilities::{generate_id, generate_password};
|
||||
use base64;
|
||||
use qovery_engine::models::DatabaseMode::CONTAINER;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
pub fn execution_id() -> String {
|
||||
Utc::now()
|
||||
.to_rfc3339()
|
||||
.replace(":", "-")
|
||||
.replace(".", "-")
|
||||
.replace("+", "-")
|
||||
}
|
||||
|
||||
pub fn environment_3_apps_3_routers_3_databases(
|
||||
context: &Context,
|
||||
organization_id: &str,
|
||||
@@ -566,94 +558,3 @@ pub fn echo_app_environment(context: &Context, organization_id: &str, test_domai
|
||||
clone_from_environment_id: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn environment_only_http_server(context: &Context, organization_id: &str) -> Environment {
|
||||
let suffix = generate_id();
|
||||
Environment {
|
||||
execution_id: context.execution_id().to_string(),
|
||||
id: generate_id(),
|
||||
owner_id: generate_id(),
|
||||
project_id: generate_id(),
|
||||
organization_id: organization_id.to_string(),
|
||||
action: Action::Create,
|
||||
applications: vec![Application {
|
||||
id: generate_id(),
|
||||
name: format!("{}-{}", "mini-http".to_string(), &suffix),
|
||||
/*name: "simple-app".to_string(),*/
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
commit_id: "a873edd459c97beb51453db056c40bca85f36ef9".to_string(),
|
||||
dockerfile_path: Some("Dockerfile".to_string()),
|
||||
buildpack_language: None,
|
||||
root_path: String::from("/"),
|
||||
action: Action::Create,
|
||||
git_credentials: Some(GitCredentials {
|
||||
login: "x-access-token".to_string(),
|
||||
access_token: "xxx".to_string(),
|
||||
expired_at: Utc::now(),
|
||||
}),
|
||||
storage: vec![],
|
||||
environment_vars: BTreeMap::default(),
|
||||
branch: "mini-http".to_string(),
|
||||
private_port: Some(3000),
|
||||
total_cpus: "100m".to_string(),
|
||||
total_ram_in_mib: 256,
|
||||
total_instances: 2,
|
||||
cpu_burst: "100m".to_string(),
|
||||
start_timeout_in_seconds: 60,
|
||||
}],
|
||||
routers: vec![],
|
||||
databases: vec![],
|
||||
clone_from_environment_id: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn environment_only_http_server_router(context: &Context, organization_id: &str, test_domain: &str) -> Environment {
|
||||
let suffix = generate_id();
|
||||
Environment {
|
||||
execution_id: context.execution_id().to_string(),
|
||||
id: generate_id(),
|
||||
owner_id: generate_id(),
|
||||
project_id: generate_id(),
|
||||
organization_id: organization_id.to_string(),
|
||||
action: Action::Create,
|
||||
applications: vec![Application {
|
||||
id: generate_id(),
|
||||
name: format!("{}-{}", "mini-http".to_string(), &suffix),
|
||||
/*name: "simple-app".to_string(),*/
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
commit_id: "a873edd459c97beb51453db056c40bca85f36ef9".to_string(),
|
||||
dockerfile_path: Some("Dockerfile".to_string()),
|
||||
buildpack_language: None,
|
||||
root_path: String::from("/"),
|
||||
action: Action::Create,
|
||||
git_credentials: Some(GitCredentials {
|
||||
login: "x-access-token".to_string(),
|
||||
access_token: "xxx".to_string(),
|
||||
expired_at: Utc::now(),
|
||||
}),
|
||||
storage: vec![],
|
||||
environment_vars: BTreeMap::default(),
|
||||
branch: "mini-http".to_string(),
|
||||
private_port: Some(3000),
|
||||
total_cpus: "100m".to_string(),
|
||||
total_ram_in_mib: 256,
|
||||
total_instances: 2,
|
||||
cpu_burst: "100m".to_string(),
|
||||
start_timeout_in_seconds: 60,
|
||||
}],
|
||||
routers: vec![Router {
|
||||
id: generate_id(),
|
||||
name: "main".to_string(),
|
||||
action: Action::Create,
|
||||
default_domain: format!("{}.{}", generate_id(), test_domain),
|
||||
public_port: 443,
|
||||
custom_domains: vec![],
|
||||
routes: vec![Route {
|
||||
path: "/".to_string(),
|
||||
application_name: format!("{}-{}", "mini-http".to_string(), &suffix),
|
||||
}],
|
||||
}],
|
||||
databases: vec![],
|
||||
clone_from_environment_id: None,
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ use qovery_engine::error::EngineError;
|
||||
use qovery_engine::models::{Context, Environment, EnvironmentAction};
|
||||
use qovery_engine::transaction::{DeploymentOption, TransactionResult};
|
||||
|
||||
use crate::cloudflare::dns_provider_cloudflare;
|
||||
use crate::utilities::{build_platform_local_docker, FuncTestsSecrets};
|
||||
use crate::helpers::cloudflare::dns_provider_cloudflare;
|
||||
use crate::helpers::utilities::{build_platform_local_docker, FuncTestsSecrets};
|
||||
use qovery_engine::cloud_provider::digitalocean::application::Region;
|
||||
use qovery_engine::cloud_provider::qovery::EngineLocation;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#[macro_use]
|
||||
extern crate maplit;
|
||||
|
||||
pub mod aws;
|
||||
pub mod cloudflare;
|
||||
pub mod common;
|
||||
@@ -8,11 +8,10 @@ use qovery_engine::dns_provider::DnsProvider;
|
||||
use qovery_engine::engine::Engine;
|
||||
use qovery_engine::error::EngineError;
|
||||
use qovery_engine::models::{Context, Environment, EnvironmentAction};
|
||||
use qovery_engine::object_storage::scaleway_object_storage::{BucketDeleteStrategy, ScalewayOS};
|
||||
use qovery_engine::transaction::{DeploymentOption, TransactionResult};
|
||||
|
||||
use crate::cloudflare::dns_provider_cloudflare;
|
||||
use crate::utilities::{build_platform_local_docker, generate_id, FuncTestsSecrets};
|
||||
use crate::helpers::cloudflare::dns_provider_cloudflare;
|
||||
use crate::helpers::utilities::{build_platform_local_docker, generate_id, FuncTestsSecrets};
|
||||
|
||||
use qovery_engine::cloud_provider::models::NodeGroups;
|
||||
use qovery_engine::cloud_provider::qovery::EngineLocation;
|
||||
@@ -127,26 +126,6 @@ pub fn scw_kubernetes_cluster_options(secrets: FuncTestsSecrets) -> KapsuleOptio
|
||||
)
|
||||
}
|
||||
|
||||
pub fn scw_object_storage(context: Context, region: Zone) -> ScalewayOS {
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let random_id = generate_id();
|
||||
|
||||
ScalewayOS::new(
|
||||
context,
|
||||
format!("qovery-test-object-storage-{}", random_id.clone()),
|
||||
format!("Qovery Test Object-Storage {}", random_id),
|
||||
secrets
|
||||
.SCALEWAY_ACCESS_KEY
|
||||
.expect("SCALEWAY_ACCESS_KEY is not set in secrets"),
|
||||
secrets
|
||||
.SCALEWAY_SECRET_KEY
|
||||
.expect("SCALEWAY_SECRET_KEY is not set in secrets"),
|
||||
region,
|
||||
BucketDeleteStrategy::Empty, // do not delete bucket due to deletion 24h delay
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn scw_kubernetes_nodes() -> Vec<NodeGroups> {
|
||||
// Note: Dev1M is a bit too small to handle engine + local docker, hence using Dev1L
|
||||
vec![NodeGroups::new("groupscw0".to_string(), 5, 10, "dev1-l".to_string()).expect("Problem while setup SCW nodes")]
|
||||
@@ -1,11 +1,11 @@
|
||||
extern crate base64;
|
||||
extern crate bstr;
|
||||
extern crate hashicorp_vault;
|
||||
extern crate passwords;
|
||||
extern crate scaleway_api_rs;
|
||||
|
||||
use bstr::ByteSlice;
|
||||
use chrono::Utc;
|
||||
use curl::easy::Easy;
|
||||
use dirs::home_dir;
|
||||
use gethostname;
|
||||
use std::io::{Error, ErrorKind, Write};
|
||||
@@ -22,8 +22,6 @@ use std::fs;
|
||||
use tracing::{error, info, warn};
|
||||
use tracing_subscriber;
|
||||
|
||||
use crate::scaleway::SCW_KUBE_TEST_CLUSTER_ID;
|
||||
use hashicorp_vault;
|
||||
use qovery_engine::build_platform::local_docker::LocalDocker;
|
||||
use qovery_engine::cloud_provider::scaleway::application::Zone;
|
||||
use qovery_engine::cloud_provider::Kind;
|
||||
@@ -35,6 +33,7 @@ use qovery_engine::error::{SimpleError, SimpleErrorKind};
|
||||
use qovery_engine::models::{Context, Environment, Features, Metadata};
|
||||
use serde::{Deserialize, Serialize};
|
||||
extern crate time;
|
||||
use crate::helpers::scaleway::SCW_KUBE_TEST_CLUSTER_ID;
|
||||
use qovery_engine::cmd::structs::{KubernetesList, KubernetesPod};
|
||||
use qovery_engine::runtime::block_on;
|
||||
use time::Instant;
|
||||
@@ -341,7 +340,7 @@ pub fn teardown(start_time: Instant, test_name: String) {
|
||||
info!("{} seconds for test {}", elapsed.as_seconds_f64(), test_name);
|
||||
}
|
||||
|
||||
pub fn engine_run_test<T>(test: T) -> ()
|
||||
pub fn engine_run_test<T>(test: T)
|
||||
where
|
||||
T: FnOnce() -> String,
|
||||
{
|
||||
@@ -357,7 +356,11 @@ pub fn generate_id() -> String {
|
||||
let uuid;
|
||||
|
||||
loop {
|
||||
let rand_string: String = thread_rng().sample_iter(Alphanumeric).take(15).collect();
|
||||
let rand_string: String = thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(15)
|
||||
.map(char::from)
|
||||
.collect();
|
||||
if rand_string.chars().next().unwrap().is_alphabetic() {
|
||||
uuid = rand_string.to_lowercase();
|
||||
break;
|
||||
@@ -396,34 +399,6 @@ pub fn generate_password(allow_using_symbols: bool) -> String {
|
||||
password
|
||||
}
|
||||
|
||||
pub fn check_all_connections(env: &Environment) -> Vec<bool> {
|
||||
let mut checking: Vec<bool> = Vec::with_capacity(env.routers.len());
|
||||
|
||||
for router_to_test in &env.routers {
|
||||
let path_to_test = format!(
|
||||
"https://{}{}",
|
||||
&router_to_test.default_domain, &router_to_test.routes[0].path
|
||||
);
|
||||
|
||||
checking.push(curl_path(path_to_test.as_str()));
|
||||
}
|
||||
return checking;
|
||||
}
|
||||
|
||||
fn curl_path(path: &str) -> bool {
|
||||
let mut easy = Easy::new();
|
||||
easy.url(path).unwrap();
|
||||
let res = easy.perform();
|
||||
match res {
|
||||
Ok(_) => return true,
|
||||
|
||||
Err(e) => {
|
||||
println!("TEST Error : while trying to call {}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn kubernetes_config_path(
|
||||
provider_kind: Kind,
|
||||
workspace_directory: &str,
|
||||
@@ -697,7 +672,7 @@ pub fn get_pods(
|
||||
kubernetes_config.unwrap().as_str(),
|
||||
namespace_name.clone().as_str(),
|
||||
pod_to_check,
|
||||
get_cloud_provider_credentials(provider_kind.clone(), &secrets.clone()),
|
||||
get_cloud_provider_credentials(provider_kind, &secrets),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -734,11 +709,11 @@ pub fn generate_cluster_id(region: &str) -> String {
|
||||
if current_name.chars().count() < shrink_size {
|
||||
shrink_size = current_name.chars().count()
|
||||
}
|
||||
let mut final_name = format!("{}", ¤t_name[..shrink_size]);
|
||||
let mut final_name = current_name[..shrink_size].to_string();
|
||||
// do not end with a non alphanumeric char
|
||||
while !final_name.chars().last().unwrap().is_alphanumeric() {
|
||||
shrink_size -= 1;
|
||||
final_name = format!("{}", ¤t_name[..shrink_size]);
|
||||
final_name = current_name[..shrink_size].to_string();
|
||||
}
|
||||
// note ensure you use only lowercase (uppercase are not allowed in lot of AWS resources)
|
||||
format!("{}-{}", final_name.to_lowercase(), region.to_lowercase())
|
||||
@@ -2,5 +2,6 @@
|
||||
extern crate maplit;
|
||||
mod aws;
|
||||
mod digitalocean;
|
||||
mod helpers;
|
||||
mod scaleway;
|
||||
mod unit;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
extern crate test_utilities;
|
||||
|
||||
use self::test_utilities::utilities::{context, FuncTestsSecrets};
|
||||
use qovery_engine::build_platform::Image;
|
||||
use qovery_engine::cloud_provider::scaleway::application::Zone;
|
||||
use qovery_engine::container_registry::scaleway_container_registry::ScalewayCR;
|
||||
use tracing::debug;
|
||||
use uuid::Uuid;
|
||||
pub use crate::helpers::utilities::{context, FuncTestsSecrets};
|
||||
pub use qovery_engine::build_platform::Image;
|
||||
pub use qovery_engine::cloud_provider::scaleway::application::Zone;
|
||||
pub use qovery_engine::container_registry::scaleway_container_registry::ScalewayCR;
|
||||
pub use tracing::debug;
|
||||
pub use uuid::Uuid;
|
||||
|
||||
fn zones_to_test() -> Vec<Zone> {
|
||||
vec![Zone::Paris1, Zone::Paris2, Zone::Amsterdam1, Zone::Warsaw1]
|
||||
@@ -67,10 +65,10 @@ fn test_get_registry_namespace() {
|
||||
let result = container_registry.get_registry_namespace(&image);
|
||||
|
||||
// verify:
|
||||
assert_eq!(true, result.is_some());
|
||||
assert!(result.is_some());
|
||||
|
||||
let result = result.unwrap();
|
||||
assert_eq!(true, result.status.is_some());
|
||||
assert!(result.status.is_some());
|
||||
|
||||
let status = result.status.unwrap();
|
||||
assert_eq!(
|
||||
@@ -121,13 +119,13 @@ fn test_create_registry_namespace() {
|
||||
let result = container_registry.create_registry_namespace(&image);
|
||||
|
||||
// verify:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
|
||||
let added_registry_result = container_registry.get_registry_namespace(&image);
|
||||
assert_eq!(true, added_registry_result.is_some());
|
||||
assert!(added_registry_result.is_some());
|
||||
|
||||
let added_registry_result = added_registry_result.unwrap();
|
||||
assert_eq!(true, added_registry_result.status.is_some());
|
||||
assert!(added_registry_result.status.is_some());
|
||||
|
||||
// clean-up:
|
||||
container_registry.delete_registry_namespace(&image).unwrap();
|
||||
@@ -176,7 +174,7 @@ fn test_delete_registry_namespace() {
|
||||
let result = container_registry.delete_registry_namespace(&image);
|
||||
|
||||
// verify:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,10 +222,10 @@ fn test_get_or_create_registry_namespace() {
|
||||
let result = container_registry.get_or_create_registry_namespace(&image);
|
||||
|
||||
// verify:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
|
||||
let result = result.unwrap();
|
||||
assert_eq!(true, result.status.is_some());
|
||||
assert!(result.status.is_some());
|
||||
|
||||
let status = result.status.unwrap();
|
||||
assert_eq!(
|
||||
@@ -236,19 +234,19 @@ fn test_get_or_create_registry_namespace() {
|
||||
);
|
||||
|
||||
let added_registry_result = container_registry.get_registry_namespace(&image);
|
||||
assert_eq!(true, added_registry_result.is_some());
|
||||
assert!(added_registry_result.is_some());
|
||||
|
||||
let added_registry_result = added_registry_result.unwrap();
|
||||
assert_eq!(true, added_registry_result.status.is_some());
|
||||
assert!(added_registry_result.status.is_some());
|
||||
|
||||
// second try: repository already created, so should be a get only
|
||||
let result = container_registry.get_or_create_registry_namespace(&image);
|
||||
|
||||
// verify:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
|
||||
let result = result.unwrap();
|
||||
assert_eq!(true, result.status.is_some());
|
||||
assert!(result.status.is_some());
|
||||
|
||||
let status = result.status.unwrap();
|
||||
assert_eq!(
|
||||
@@ -257,10 +255,10 @@ fn test_get_or_create_registry_namespace() {
|
||||
);
|
||||
|
||||
let added_registry_result = container_registry.get_registry_namespace(&image);
|
||||
assert_eq!(true, added_registry_result.is_some());
|
||||
assert!(added_registry_result.is_some());
|
||||
|
||||
let added_registry_result = added_registry_result.unwrap();
|
||||
assert_eq!(true, added_registry_result.status.is_some());
|
||||
assert!(added_registry_result.status.is_some());
|
||||
|
||||
// clean-up:
|
||||
container_registry.delete_registry_namespace(&image).unwrap();
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
use ::function_name::named;
|
||||
use tracing::{span, warn, Level};
|
||||
pub use tracing::{span, warn, Level};
|
||||
|
||||
use qovery_engine::cloud_provider::Kind as ProviderKind;
|
||||
use qovery_engine::models::{
|
||||
pub use qovery_engine::cloud_provider::Kind as ProviderKind;
|
||||
pub use qovery_engine::models::{
|
||||
Action, Application, Clone2, Context, Database, DatabaseKind, DatabaseMode, Environment, EnvironmentAction,
|
||||
};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
use test_utilities::utilities::{
|
||||
context, engine_run_test, generate_id, generate_password, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
};
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
|
||||
use qovery_engine::models::DatabaseMode::{CONTAINER, MANAGED};
|
||||
use test_utilities::common::working_minimal_environment;
|
||||
use test_utilities::scaleway::{
|
||||
pub use qovery_engine::models::DatabaseMode::{CONTAINER, MANAGED};
|
||||
|
||||
pub use crate::helpers::common::{
|
||||
environment_3_apps_3_routers_3_databases, environnement_2_app_2_routers_1_psql, working_minimal_environment,
|
||||
};
|
||||
pub use crate::helpers::scaleway::{
|
||||
clean_environments, delete_environment, deploy_environment, pause_environment, SCW_KUBE_TEST_CLUSTER_ID,
|
||||
SCW_MANAGED_DATABASE_DISK_TYPE, SCW_MANAGED_DATABASE_INSTANCE_TYPE, SCW_QOVERY_ORGANIZATION_ID,
|
||||
SCW_SELF_HOSTED_DATABASE_DISK_TYPE, SCW_SELF_HOSTED_DATABASE_INSTANCE_TYPE, SCW_TEST_ZONE,
|
||||
};
|
||||
pub use crate::helpers::utilities::{
|
||||
context, engine_run_test, generate_id, generate_password, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
};
|
||||
pub use function_name::named;
|
||||
|
||||
/**
|
||||
**
|
||||
@@ -39,7 +42,7 @@ fn deploy_an_environment_with_3_databases_and_3_apps() {
|
||||
let context = context();
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::environment_3_apps_3_routers_3_databases(
|
||||
let environment = environment_3_apps_3_routers_3_databases(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -57,15 +60,15 @@ fn deploy_an_environment_with_3_databases_and_3_apps() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -91,7 +94,7 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
let context = context();
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let environment = environnement_2_app_2_routers_1_psql(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -109,15 +112,15 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match pause_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Check that we have actually 0 pods running for this db
|
||||
@@ -133,9 +136,9 @@ fn deploy_an_environment_with_db_and_pause_it() {
|
||||
assert_eq!(ret.unwrap().items.is_empty(), true);
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -167,7 +170,7 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
.DEFAULT_TEST_DOMAIN
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let environment = environnement_2_app_2_routers_1_psql(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -185,7 +188,7 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
app
|
||||
})
|
||||
.collect::<Vec<qovery_engine::models::Application>>();
|
||||
let mut environment_delete = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let mut environment_delete = environnement_2_app_2_routers_1_psql(
|
||||
&context_for_deletion,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -201,9 +204,9 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
let env_action_for_deletion = EnvironmentAction::Environment(environment_delete.clone());
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY
|
||||
let database_name = format!("postgresql-{}-0", &environment_check.databases[0].name);
|
||||
@@ -214,13 +217,13 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
database_name.as_str(),
|
||||
secrets.clone(),
|
||||
) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
(true, _) => {}
|
||||
(false, _) => panic!(),
|
||||
}
|
||||
match deploy_environment(&context, env_action_fail_ok, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(true),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => {}
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY EVEN IF FAIL
|
||||
match is_pod_restarted_env(
|
||||
@@ -230,14 +233,14 @@ fn postgresql_failover_dev_environment_with_all_options() {
|
||||
database_name.as_str(),
|
||||
secrets.clone(),
|
||||
) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
(true, _) => {}
|
||||
(false, _) => panic!(),
|
||||
}
|
||||
|
||||
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),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -269,14 +272,14 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let environment = environnement_2_app_2_routers_1_psql(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
SCW_SELF_HOSTED_DATABASE_INSTANCE_TYPE,
|
||||
SCW_SELF_HOSTED_DATABASE_DISK_TYPE,
|
||||
);
|
||||
let mut environment_delete = test_utilities::common::environnement_2_app_2_routers_1_psql(
|
||||
let mut environment_delete = environnement_2_app_2_routers_1_psql(
|
||||
&context_for_deletion,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
@@ -290,15 +293,15 @@ fn postgresql_deploy_a_working_development_environment_with_all_options() {
|
||||
let env_action_for_deletion = EnvironmentAction::Environment(environment_delete.clone());
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
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),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -332,7 +335,7 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
let context_for_redeploy = context.clone_not_same_execution_id();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -418,14 +421,14 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
match deploy_environment(&context_for_redeploy, env_action_redeploy, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY
|
||||
let database_name = format!("postgresql-{}-0", &environment_check.databases[0].name);
|
||||
@@ -436,14 +439,14 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
database_name.as_str(),
|
||||
secrets.clone(),
|
||||
) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
(true, _) => {}
|
||||
(false, _) => panic!(),
|
||||
}
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -545,17 +548,17 @@ fn test_postgresql_configuration(
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, ea, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, ea_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -777,17 +780,17 @@ fn test_mongodb_configuration(
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -964,17 +967,17 @@ fn test_mysql_configuration(
|
||||
let ea_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, ea, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&deletion_context, ea_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
@@ -1031,7 +1034,7 @@ fn mysql_v8_deploy_a_working_dev_environment() {
|
||||
fn mysql_v8_deploy_a_working_prod_environment() {
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -1134,17 +1137,17 @@ fn test_redis_configuration(
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// todo: check the database disk is here and with correct size
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// delete images created during test from registries
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
extern crate test_utilities;
|
||||
// Note: All those tests relies on a test cluster running on Scaleway infrastructure.
|
||||
// This cluster should be live in order to have those tests passing properly.
|
||||
|
||||
use self::test_utilities::scaleway::{
|
||||
pub use crate::helpers::common::{non_working_environment, working_minimal_environment};
|
||||
pub use crate::helpers::scaleway::{
|
||||
clean_environments, delete_environment, deploy_environment, pause_environment, SCW_KUBE_TEST_CLUSTER_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,
|
||||
pub use crate::helpers::utilities::{
|
||||
context, engine_run_test, generate_id, get_pods, init, is_pod_restarted_env, FuncTestsSecrets,
|
||||
};
|
||||
use ::function_name::named;
|
||||
use qovery_engine::cloud_provider::Kind;
|
||||
use qovery_engine::models::{Action, Clone2, EnvironmentAction, Storage, StorageType};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
use std::collections::BTreeMap;
|
||||
use test_utilities::utilities::context;
|
||||
use tracing::{span, warn, Level};
|
||||
|
||||
// Note: All those tests relies on a test cluster running on Scaleway infrastructure.
|
||||
// This cluster should be live in order to have those tests passing properly.
|
||||
pub use function_name::named;
|
||||
pub use qovery_engine::cloud_provider::Kind;
|
||||
pub use qovery_engine::models::{Action, Clone2, EnvironmentAction, Storage, StorageType};
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
pub use std::collections::BTreeMap;
|
||||
pub use tracing::{span, warn, Level};
|
||||
|
||||
#[cfg(feature = "test-scw-self-hosted")]
|
||||
#[named]
|
||||
@@ -32,7 +30,7 @@ fn scaleway_kapsule_deploy_a_working_environment_with_no_router() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -51,15 +49,15 @@ fn scaleway_kapsule_deploy_a_working_environment_with_no_router() {
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
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),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -85,7 +83,7 @@ fn scaleway_kapsule_deploy_a_not_working_environment_with_no_router() {
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
let mut environment = test_utilities::common::non_working_environment(
|
||||
let mut environment = non_working_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -103,15 +101,15 @@ fn scaleway_kapsule_deploy_a_not_working_environment_with_no_router() {
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
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),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -136,7 +134,7 @@ fn scaleway_kapsule_deploy_a_working_environment_and_pause() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -149,15 +147,15 @@ fn scaleway_kapsule_deploy_a_working_environment_and_pause() {
|
||||
let env_action = EnvironmentAction::Environment(environment.clone());
|
||||
|
||||
match deploy_environment(&context, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match pause_environment(&context_for_delete, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Check that we have actually 0 pods running for this app
|
||||
@@ -175,16 +173,16 @@ 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(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Cleanup
|
||||
match delete_environment(&context_for_delete, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -209,7 +207,7 @@ fn scaleway_kapsule_build_with_buildpacks_and_deploy_a_working_environment() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -237,15 +235,15 @@ fn scaleway_kapsule_build_with_buildpacks_and_deploy_a_working_environment() {
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
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),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -270,7 +268,7 @@ fn scaleway_kapsule_deploy_a_working_environment_with_domain() {
|
||||
let context = context();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -287,15 +285,15 @@ fn scaleway_kapsule_deploy_a_working_environment_with_domain() {
|
||||
let env_action_for_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
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),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -321,7 +319,7 @@ fn scaleway_kapsule_deploy_a_working_environment_with_storage() {
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -355,17 +353,17 @@ fn scaleway_kapsule_deploy_a_working_environment_with_storage() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// TODO(benjaminch): check the disk is here and with correct size, can use Scaleway API
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -392,7 +390,7 @@ fn scaleway_kapsule_redeploy_same_app() {
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
let mut environment = test_utilities::common::working_minimal_environment(
|
||||
let mut environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -430,9 +428,9 @@ fn scaleway_kapsule_redeploy_same_app() {
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_delete);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
let app_name = format!("{}-0", &environment_check1.applications[0].name);
|
||||
@@ -445,9 +443,9 @@ fn scaleway_kapsule_redeploy_same_app() {
|
||||
);
|
||||
|
||||
match deploy_environment(&context_bis, env_action_redeploy, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
let (_, number2) = is_pod_restarted_env(
|
||||
@@ -462,9 +460,9 @@ fn scaleway_kapsule_redeploy_same_app() {
|
||||
assert!(number.eq(&number2));
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -492,7 +490,7 @@ fn scaleway_kapsule_deploy_a_not_working_environment_and_then_working_environmen
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
|
||||
// env part generation
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -524,19 +522,19 @@ fn scaleway_kapsule_deploy_a_not_working_environment_and_then_working_environmen
|
||||
let env_action_delete = EnvironmentAction::Environment(environment_for_delete);
|
||||
|
||||
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),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -562,7 +560,7 @@ fn scaleway_kapsule_deploy_ok_fail_fail_ok_environment() {
|
||||
// working env
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::working_minimal_environment(
|
||||
let environment = working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -603,36 +601,36 @@ fn scaleway_kapsule_deploy_ok_fail_fail_ok_environment() {
|
||||
|
||||
// OK
|
||||
match deploy_environment(&context, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// FAIL and rollback
|
||||
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),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => {}
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// FAIL and Rollback again
|
||||
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),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => {}
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
// Should be working
|
||||
match deploy_environment(&context, env_action.clone(), SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -656,7 +654,7 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_no_failover() {
|
||||
|
||||
let context = context();
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let environment = test_utilities::common::non_working_environment(
|
||||
let environment = non_working_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
secrets
|
||||
@@ -674,15 +672,15 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_no_failover() {
|
||||
let env_action_delete = EnvironmentAction::Environment(delete_env);
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_delete, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(&context, vec![environment.clone()], secrets.clone(), SCW_TEST_ZONE) {
|
||||
@@ -712,21 +710,14 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_a_working_failover() {
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment =
|
||||
test_utilities::common::non_working_environment(&context, SCW_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment = test_utilities::common::working_minimal_environment(
|
||||
&context,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let environment = non_working_environment(&context, SCW_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment =
|
||||
working_minimal_environment(&context, SCW_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
|
||||
// context for deletion
|
||||
let context_deletion = context.clone_not_same_execution_id();
|
||||
let mut delete_env = test_utilities::common::working_minimal_environment(
|
||||
&context_deletion,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let mut delete_env =
|
||||
working_minimal_environment(&context_deletion, SCW_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
delete_env.action = Action::Delete;
|
||||
|
||||
let env_action_delete = EnvironmentAction::Environment(delete_env);
|
||||
@@ -734,15 +725,15 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_a_working_failover() {
|
||||
EnvironmentAction::EnvironmentWithFailover(environment.clone(), Box::new(failover_environment.clone()));
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match delete_environment(&context_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(
|
||||
@@ -776,17 +767,12 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_a_non_working_failover
|
||||
.as_ref()
|
||||
.expect("DEFAULT_TEST_DOMAIN is not set in secrets");
|
||||
|
||||
let environment =
|
||||
test_utilities::common::non_working_environment(&context, SCW_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment =
|
||||
test_utilities::common::non_working_environment(&context, SCW_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let environment = non_working_environment(&context, SCW_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
let failover_environment = non_working_environment(&context, SCW_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
|
||||
let context_for_deletion = context.clone_not_same_execution_id();
|
||||
let mut delete_env = test_utilities::common::non_working_environment(
|
||||
&context_for_deletion,
|
||||
SCW_QOVERY_ORGANIZATION_ID,
|
||||
test_domain.as_str(),
|
||||
);
|
||||
let mut delete_env =
|
||||
non_working_environment(&context_for_deletion, SCW_QOVERY_ORGANIZATION_ID, test_domain.as_str());
|
||||
delete_env.action = Action::Delete;
|
||||
|
||||
// environment action initialize
|
||||
@@ -795,15 +781,15 @@ fn scaleway_kapsule_deploy_a_non_working_environment_with_a_non_working_failover
|
||||
EnvironmentAction::EnvironmentWithFailover(environment.clone(), Box::new(failover_environment.clone()));
|
||||
|
||||
match deploy_environment(&context, env_action, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(false),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => panic!(),
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
match delete_environment(&context_for_deletion, env_action_delete, SCW_TEST_ZONE) {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(true),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => {}
|
||||
};
|
||||
|
||||
if let Err(e) = clean_environments(
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
extern crate test_utilities;
|
||||
pub use ::function_name::named;
|
||||
pub use tracing::{span, Level};
|
||||
|
||||
use self::test_utilities::cloudflare::dns_provider_cloudflare;
|
||||
use self::test_utilities::utilities::{context, engine_run_test, generate_cluster_id, init, FuncTestsSecrets};
|
||||
use ::function_name::named;
|
||||
use tracing::{span, Level};
|
||||
pub use qovery_engine::cloud_provider::scaleway::application::Zone;
|
||||
pub use qovery_engine::cloud_provider::scaleway::kubernetes::Kapsule;
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
|
||||
use qovery_engine::cloud_provider::scaleway::application::Zone;
|
||||
use qovery_engine::cloud_provider::scaleway::kubernetes::Kapsule;
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
|
||||
use test_utilities::scaleway::SCW_KUBERNETES_VERSION;
|
||||
pub use crate::helpers::cloudflare::dns_provider_cloudflare;
|
||||
pub use crate::helpers::scaleway::{
|
||||
cloud_provider_scaleway, docker_scw_cr_engine, scw_kubernetes_cluster_options, scw_kubernetes_nodes,
|
||||
SCW_KUBERNETES_VERSION,
|
||||
};
|
||||
pub use crate::helpers::utilities::{context, engine_run_test, generate_cluster_id, init, FuncTestsSecrets};
|
||||
|
||||
#[cfg(test)]
|
||||
fn create_upgrade_and_destroy_kapsule_cluster(
|
||||
@@ -26,12 +27,12 @@ fn create_upgrade_and_destroy_kapsule_cluster(
|
||||
let _enter = span.enter();
|
||||
|
||||
let context = context();
|
||||
let engine = test_utilities::scaleway::docker_scw_cr_engine(&context);
|
||||
let engine = docker_scw_cr_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let scw_cluster = test_utilities::scaleway::cloud_provider_scaleway(&context);
|
||||
let nodes = test_utilities::scaleway::scw_kubernetes_nodes();
|
||||
let scw_cluster = cloud_provider_scaleway(&context);
|
||||
let nodes = scw_kubernetes_nodes();
|
||||
let cloudflare = dns_provider_cloudflare(&context);
|
||||
|
||||
let cluster_id = generate_cluster_id(zone.as_str());
|
||||
@@ -46,7 +47,7 @@ fn create_upgrade_and_destroy_kapsule_cluster(
|
||||
&scw_cluster,
|
||||
&cloudflare,
|
||||
nodes,
|
||||
test_utilities::scaleway::scw_kubernetes_cluster_options(secrets),
|
||||
scw_kubernetes_cluster_options(secrets),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -55,9 +56,9 @@ fn create_upgrade_and_destroy_kapsule_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Upgrade
|
||||
@@ -67,9 +68,9 @@ fn create_upgrade_and_destroy_kapsule_cluster(
|
||||
// panic!("{:?}", err)
|
||||
// }
|
||||
// let _ = match tx.commit() {
|
||||
// TransactionResult::Ok => assert!(true),
|
||||
// TransactionResult::Rollback(_) => assert!(false),
|
||||
// TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
// TransactionResult::Ok => {},
|
||||
// TransactionResult::Rollback(_) => panic!(),
|
||||
// TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
// };
|
||||
|
||||
// Destroy
|
||||
@@ -77,9 +78,9 @@ fn create_upgrade_and_destroy_kapsule_cluster(
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
@@ -95,12 +96,12 @@ fn create_and_destroy_kapsule_cluster(zone: Zone, secrets: FuncTestsSecrets, tes
|
||||
let _enter = span.enter();
|
||||
|
||||
let context = context();
|
||||
let engine = test_utilities::scaleway::docker_scw_cr_engine(&context);
|
||||
let engine = docker_scw_cr_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let scw_cluster = test_utilities::scaleway::cloud_provider_scaleway(&context);
|
||||
let nodes = test_utilities::scaleway::scw_kubernetes_nodes();
|
||||
let scw_cluster = cloud_provider_scaleway(&context);
|
||||
let nodes = scw_kubernetes_nodes();
|
||||
let cloudflare = dns_provider_cloudflare(&context);
|
||||
|
||||
let cluster_id = generate_cluster_id(zone.as_str());
|
||||
@@ -115,7 +116,7 @@ fn create_and_destroy_kapsule_cluster(zone: Zone, secrets: FuncTestsSecrets, tes
|
||||
&scw_cluster,
|
||||
&cloudflare,
|
||||
nodes,
|
||||
test_utilities::scaleway::scw_kubernetes_cluster_options(secrets),
|
||||
scw_kubernetes_cluster_options(secrets),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -124,9 +125,9 @@ fn create_and_destroy_kapsule_cluster(zone: Zone, secrets: FuncTestsSecrets, tes
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
if test_infra_pause {
|
||||
@@ -135,9 +136,9 @@ fn create_and_destroy_kapsule_cluster(zone: Zone, secrets: FuncTestsSecrets, tes
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
// Resume
|
||||
@@ -145,9 +146,9 @@ fn create_and_destroy_kapsule_cluster(zone: Zone, secrets: FuncTestsSecrets, tes
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -156,9 +157,9 @@ fn create_and_destroy_kapsule_cluster(zone: Zone, secrets: FuncTestsSecrets, tes
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
extern crate test_utilities;
|
||||
|
||||
use self::test_utilities::utilities::{context, generate_id, FuncTestsSecrets};
|
||||
|
||||
use qovery_engine::cloud_provider::scaleway::application::Zone;
|
||||
|
||||
use qovery_engine::object_storage::scaleway_object_storage::{BucketDeleteStrategy, ScalewayOS};
|
||||
use qovery_engine::object_storage::ObjectStorage;
|
||||
use tempfile::NamedTempFile;
|
||||
pub use crate::helpers::utilities::{context, generate_id, FuncTestsSecrets};
|
||||
pub use qovery_engine::cloud_provider::scaleway::application::Zone;
|
||||
pub use qovery_engine::object_storage::scaleway_object_storage::{BucketDeleteStrategy, ScalewayOS};
|
||||
pub use qovery_engine::object_storage::ObjectStorage;
|
||||
pub use tempfile::NamedTempFile;
|
||||
|
||||
const TEST_ZONE: Zone = Zone::Paris1;
|
||||
|
||||
@@ -19,6 +15,8 @@ fn test_delete_bucket_hard_delete_strategy() {
|
||||
let scw_access_key = secrets.SCALEWAY_ACCESS_KEY.unwrap_or("undefined".to_string());
|
||||
let scw_secret_key = secrets.SCALEWAY_SECRET_KEY.unwrap_or("undefined".to_string());
|
||||
|
||||
let test = "";
|
||||
|
||||
let scaleway_os = ScalewayOS::new(
|
||||
context,
|
||||
generate_id(),
|
||||
@@ -40,7 +38,7 @@ fn test_delete_bucket_hard_delete_strategy() {
|
||||
let result = scaleway_os.delete_bucket(bucket_name.as_str());
|
||||
|
||||
// validate:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(false, scaleway_os.bucket_exists(bucket_name.as_str()))
|
||||
}
|
||||
|
||||
@@ -74,8 +72,8 @@ fn test_delete_bucket_empty_strategy() {
|
||||
let result = scaleway_os.delete_bucket(bucket_name.as_str());
|
||||
|
||||
// validate:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert_eq!(true, scaleway_os.bucket_exists(bucket_name.as_str()));
|
||||
assert!(result.is_ok());
|
||||
assert!(scaleway_os.bucket_exists(bucket_name.as_str()));
|
||||
|
||||
// clean-up:
|
||||
scaleway_os
|
||||
@@ -109,7 +107,7 @@ fn test_create_bucket() {
|
||||
let result = scaleway_os.create_bucket(bucket_name.as_str());
|
||||
|
||||
// validate:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
|
||||
// clean-up:
|
||||
scaleway_os
|
||||
@@ -154,7 +152,7 @@ fn test_put_file() {
|
||||
);
|
||||
|
||||
// validate:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(
|
||||
true,
|
||||
scaleway_os
|
||||
@@ -207,7 +205,7 @@ fn test_get_file() {
|
||||
let result = scaleway_os.get(bucket_name.as_str(), object_key.as_str(), false);
|
||||
|
||||
// validate:
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(
|
||||
true,
|
||||
scaleway_os
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
extern crate test_utilities;
|
||||
pub use ::function_name::named;
|
||||
pub use tracing::{span, Level};
|
||||
|
||||
use self::test_utilities::cloudflare::dns_provider_cloudflare;
|
||||
use self::test_utilities::utilities::{context, engine_run_test, init, FuncTestsSecrets};
|
||||
use ::function_name::named;
|
||||
use tracing::{span, Level};
|
||||
|
||||
use qovery_engine::cloud_provider::scaleway::kubernetes::Kapsule;
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
pub use crate::helpers::cloudflare::dns_provider_cloudflare;
|
||||
pub use crate::helpers::scaleway::{
|
||||
cloud_provider_scaleway, docker_scw_cr_engine, scw_kubernetes_cluster_options, scw_kubernetes_nodes,
|
||||
SCW_KUBERNETES_VERSION, SCW_KUBE_TEST_CLUSTER_ID, SCW_KUBE_TEST_CLUSTER_NAME, SCW_TEST_ZONE,
|
||||
};
|
||||
pub use crate::helpers::utilities::{context, engine_run_test, init, FuncTestsSecrets};
|
||||
pub use qovery_engine::cloud_provider::scaleway::kubernetes::Kapsule;
|
||||
pub use qovery_engine::transaction::TransactionResult;
|
||||
|
||||
// Warning: This test shouldn't be ran by CI
|
||||
// Note: this test creates the test cluster where all application tests will be ran
|
||||
@@ -26,25 +28,25 @@ fn create_scaleway_kubernetes_kapsule_test_cluster() {
|
||||
let _enter = span.enter();
|
||||
|
||||
let context = context();
|
||||
let engine = test_utilities::scaleway::docker_scw_cr_engine(&context);
|
||||
let engine = docker_scw_cr_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let scw_cluster = test_utilities::scaleway::cloud_provider_scaleway(&context);
|
||||
let nodes = test_utilities::scaleway::scw_kubernetes_nodes();
|
||||
let scw_cluster = cloud_provider_scaleway(&context);
|
||||
let nodes = scw_kubernetes_nodes();
|
||||
let cloudflare = dns_provider_cloudflare(&context);
|
||||
|
||||
let kubernetes = Kapsule::new(
|
||||
context,
|
||||
test_utilities::scaleway::SCW_KUBE_TEST_CLUSTER_ID.to_string(),
|
||||
SCW_KUBE_TEST_CLUSTER_ID.to_string(),
|
||||
uuid::Uuid::new_v4(),
|
||||
test_utilities::scaleway::SCW_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
test_utilities::scaleway::SCW_KUBERNETES_VERSION.to_string(),
|
||||
test_utilities::scaleway::SCW_TEST_ZONE,
|
||||
SCW_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
SCW_KUBERNETES_VERSION.to_string(),
|
||||
SCW_TEST_ZONE,
|
||||
&scw_cluster,
|
||||
&cloudflare,
|
||||
nodes,
|
||||
test_utilities::scaleway::scw_kubernetes_cluster_options(secrets),
|
||||
scw_kubernetes_cluster_options(secrets),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -53,9 +55,9 @@ fn create_scaleway_kubernetes_kapsule_test_cluster() {
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
let _ = match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
@@ -80,25 +82,25 @@ fn destroy_scaleway_kubernetes_kapsule_test_cluster() {
|
||||
let _enter = span.enter();
|
||||
|
||||
let context = context();
|
||||
let engine = test_utilities::scaleway::docker_scw_cr_engine(&context);
|
||||
let engine = docker_scw_cr_engine(&context);
|
||||
let session = engine.session().unwrap();
|
||||
let mut tx = session.transaction();
|
||||
|
||||
let scw_cluster = test_utilities::scaleway::cloud_provider_scaleway(&context);
|
||||
let nodes = test_utilities::scaleway::scw_kubernetes_nodes();
|
||||
let scw_cluster = cloud_provider_scaleway(&context);
|
||||
let nodes = scw_kubernetes_nodes();
|
||||
let cloudflare = dns_provider_cloudflare(&context);
|
||||
|
||||
let kubernetes = Kapsule::new(
|
||||
context,
|
||||
test_utilities::scaleway::SCW_KUBE_TEST_CLUSTER_ID.to_string(),
|
||||
SCW_KUBE_TEST_CLUSTER_ID.to_string(),
|
||||
uuid::Uuid::new_v4(),
|
||||
test_utilities::scaleway::SCW_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
test_utilities::scaleway::SCW_KUBERNETES_VERSION.to_string(),
|
||||
test_utilities::scaleway::SCW_TEST_ZONE,
|
||||
SCW_KUBE_TEST_CLUSTER_NAME.to_string(),
|
||||
SCW_KUBERNETES_VERSION.to_string(),
|
||||
SCW_TEST_ZONE,
|
||||
&scw_cluster,
|
||||
&cloudflare,
|
||||
nodes,
|
||||
test_utilities::scaleway::scw_kubernetes_cluster_options(secrets),
|
||||
scw_kubernetes_cluster_options(secrets),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -107,9 +109,9 @@ fn destroy_scaleway_kubernetes_kapsule_test_cluster() {
|
||||
panic!("{:?}", err)
|
||||
}
|
||||
match tx.commit() {
|
||||
TransactionResult::Ok => assert!(true),
|
||||
TransactionResult::Rollback(_) => assert!(false),
|
||||
TransactionResult::UnrecoverableError(_, _) => assert!(false),
|
||||
TransactionResult::Ok => {}
|
||||
TransactionResult::Rollback(_) => panic!(),
|
||||
TransactionResult::UnrecoverableError(_, _) => panic!(),
|
||||
};
|
||||
|
||||
test_name.to_string()
|
||||
|
||||
Reference in New Issue
Block a user