mirror of
https://github.com/jlengrand/engine.git
synced 2026-03-10 08:11:21 +00:00
Fix test for CI
This commit is contained in:
@@ -26,6 +26,7 @@ pub struct DOCR {
|
||||
pub name: String,
|
||||
pub api_key: String,
|
||||
pub id: String,
|
||||
pub registry_info: Option<ContainerRegistryInfo>,
|
||||
pub listeners: Listeners,
|
||||
pub logger: Box<dyn Logger>,
|
||||
}
|
||||
@@ -37,6 +38,7 @@ impl DOCR {
|
||||
name: name.into(),
|
||||
api_key: api_key.into(),
|
||||
id: id.into(),
|
||||
registry_info: None,
|
||||
listeners: vec![],
|
||||
logger,
|
||||
}
|
||||
|
||||
@@ -183,10 +183,52 @@ impl<'a> Transaction<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// This function is a wrapper to correctly revert all changes of an attempted deployment AND
|
||||
/// if a failover environment is provided, then rollback.
|
||||
fn rollback_environment(&self, _environment_action: &EnvironmentAction) -> Result<(), RollbackError> {
|
||||
Ok(())
|
||||
// Warning: This function function does not revert anything, it just there to grab info from kube and services if it fails
|
||||
// FIXME: Cleanup this, qe_environment should not be rebuilt at this step
|
||||
fn rollback_environment(&self, environment_action: &EnvironmentAction) -> Result<(), RollbackError> {
|
||||
let registry_info = self
|
||||
.engine
|
||||
.container_registry()
|
||||
.login()
|
||||
.map_err(|err| RollbackError::CommitError(err))?;
|
||||
|
||||
let qe_environment = |environment: &Environment| {
|
||||
let qe_environment = environment.to_qe_environment(
|
||||
self.engine.context(),
|
||||
self.engine.cloud_provider(),
|
||||
®istry_info,
|
||||
self.logger.clone(),
|
||||
);
|
||||
|
||||
qe_environment
|
||||
};
|
||||
|
||||
match environment_action {
|
||||
EnvironmentAction::Environment(te) => {
|
||||
// revert changes but there is no failover environment
|
||||
let target_qe_environment = qe_environment(te);
|
||||
|
||||
let action = match te.action {
|
||||
Action::Create => self
|
||||
.engine
|
||||
.kubernetes()
|
||||
.deploy_environment_error(&target_qe_environment),
|
||||
Action::Pause => self.engine.kubernetes().pause_environment_error(&target_qe_environment),
|
||||
Action::Delete => self
|
||||
.engine
|
||||
.kubernetes()
|
||||
.delete_environment_error(&target_qe_environment),
|
||||
Action::Nothing => Ok(()),
|
||||
};
|
||||
|
||||
let _ = match action {
|
||||
Ok(_) => {}
|
||||
Err(err) => return Err(RollbackError::CommitError(err)),
|
||||
};
|
||||
|
||||
Err(RollbackError::NoFailoverEnvironment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn commit(mut self) -> TransactionResult {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
extern crate test_utilities;
|
||||
|
||||
use self::test_utilities::aws::{AWS_KUBERNETES_MAJOR_VERSION, AWS_KUBERNETES_MINOR_VERSION};
|
||||
use self::test_utilities::utilities::{
|
||||
context, engine_run_test, generate_cluster_id, generate_id, logger, FuncTestsSecrets,
|
||||
};
|
||||
use self::test_utilities::utilities::{context, engine_run_test, generate_cluster_id, generate_id, logger};
|
||||
use ::function_name::named;
|
||||
use qovery_engine::cloud_provider::aws::kubernetes::VpcQoveryNetworkMode;
|
||||
use qovery_engine::cloud_provider::aws::kubernetes::VpcQoveryNetworkMode::{WithNatGateways, WithoutNatGateways};
|
||||
@@ -98,9 +96,7 @@ fn create_and_destroy_eks_cluster_in_us_east_2() {
|
||||
#[named]
|
||||
#[test]
|
||||
fn create_pause_and_destroy_eks_cluster_in_us_east_2() {
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let region = "us-east-2".to_string();
|
||||
let aws_region = AwsRegion::from_str(®ion).expect("Wasn't able to convert the desired region");
|
||||
create_and_destroy_eks_cluster(
|
||||
region,
|
||||
ClusterTestType::WithPause,
|
||||
|
||||
Reference in New Issue
Block a user