Add long_id for applications (#702)

This commit is contained in:
Erèbe - Romain Gerard
2022-04-29 13:50:53 +02:00
committed by GitHub
parent 6cffa9fc9a
commit f276b1c4e7
27 changed files with 98 additions and 96 deletions

View File

@@ -6,6 +6,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
@@ -29,6 +30,7 @@ spec:
template:
metadata:
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}

View File

@@ -7,6 +7,7 @@ metadata:
labels:
envId: {{ environment_id }}
appId: {{ id }}
appLongId: {{ long_id }}
spec:
scaleTargetRef:
apiVersion: apps/v1

View File

@@ -5,6 +5,7 @@ metadata:
name: {{ sanitized_name }}-default
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
appId: {{ id }}
app: {{ sanitized_name }}
@@ -26,6 +27,7 @@ metadata:
name: {{ sanitized_name }}-app-access
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
appId: {{ id }}
app: {{ sanitized_name }}
@@ -76,6 +78,7 @@ metadata:
name: {{ sanitized_name }}-deny-aws-metadata-server
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
appId: {{ id }}
app: {{ sanitized_name }}

View File

@@ -6,6 +6,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}

View File

@@ -5,6 +5,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}

View File

@@ -9,6 +9,7 @@ metadata:
appId: {{ id }}
app: {{ sanitized_name }}
envId: {{ environment_id }}
appLongId: {{ long_id }}
spec:
type: ClusterIP
ports:

View File

@@ -9,6 +9,7 @@ metadata:
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
appLongId: {{ long_id }}
app: {{ sanitized_name }}
annotations:
releaseTime: {% raw %}{{ dateInZone "2006-01-02 15:04:05Z" (now) "UTC"| quote }}{% endraw %}
@@ -27,6 +28,7 @@ spec:
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
appLongId: {{ long_id }}
app: {{ sanitized_name }}
annotations:
checksum/config: {% raw %}{{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}{% endraw %}
@@ -91,27 +93,6 @@ spec:
{%- endfor %}
volumeClaimTemplates:
{%- for s in storage %}
{% if clone %}
- metadata:
name: {{ s.id }}
labels:
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
app: {{ sanitized_name }}
diskId: {{ s.id }}
diskType: {{ s.storage_type }}
spec:
accessModes:
- ReadWriteOnce
storageClassName: aws-ebs-{{ s.storage_type }}-0
dataSource:
name: {{ s.id }}
kind: PersistentVolumeClaim
resources:
requests:
storage: {{ disk.size_in_gib }}Gi
{% else %}
- metadata:
name: {{ s.id }}
labels:
@@ -127,6 +108,5 @@ spec:
resources:
requests:
storage: {{ s.size_in_gib }}Gi
{%- endif %}
{%- endfor %}
{%- endif %}

View File

@@ -6,6 +6,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
@@ -29,6 +30,7 @@ spec:
template:
metadata:
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}

View File

@@ -5,6 +5,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
envId: {{ environment_id }}
appId: {{ id }}
spec:

View File

@@ -6,6 +6,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}

View File

@@ -5,6 +5,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}

View File

@@ -5,6 +5,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
appId: {{ id }}
app: {{ sanitized_name }}

View File

@@ -6,6 +6,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
@@ -24,6 +25,7 @@ spec:
template:
metadata:
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
@@ -91,27 +93,6 @@ spec:
{%- endfor %}
volumeClaimTemplates:
{%- for s in storage %}
{% if clone %}
- metadata:
name: {{ s.id }}
labels:
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
app: {{ sanitized_name }}
diskId: {{ s.id }}
diskType: {{ s.storage_type }}
spec:
accessModes:
- ReadWriteOnce
storageClassName: {{ s.storage_type }}
dataSource:
name: {{ s.id }}
kind: PersistentVolumeClaim
resources:
requests:
storage: {{ disk.size_in_gib }}Gi
{% else %}
- metadata:
name: {{ s.id }}
labels:
@@ -127,6 +108,5 @@ spec:
resources:
requests:
storage: {{ s.size_in_gib }}Gi
{%- endif %}
{%- endfor %}
{%- endif %}

View File

@@ -6,6 +6,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
@@ -28,6 +29,7 @@ spec:
template:
metadata:
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}

View File

@@ -5,6 +5,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
envId: {{ environment_id }}
appId: {{ id }}
spec:

View File

@@ -5,6 +5,7 @@ metadata:
name: {{ sanitized_name }}-default
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
appId: {{ id }}
app: {{ sanitized_name }}
@@ -26,6 +27,7 @@ metadata:
name: {{ sanitized_name }}-app-access
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
appId: {{ id }}
app: {{ sanitized_name }}

View File

@@ -6,6 +6,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}

View File

@@ -5,6 +5,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
@@ -23,6 +24,7 @@ metadata:
name: {{ registry_secret_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
envId: {{ environment_id }}
appId: {{ id }}
app: {{ sanitized_name }}

View File

@@ -5,6 +5,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
appId: {{ id }}
app: {{ sanitized_name }}

View File

@@ -6,6 +6,7 @@ metadata:
name: {{ sanitized_name }}
namespace: {{ namespace }}
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
@@ -24,6 +25,7 @@ spec:
template:
metadata:
labels:
appLongId: {{ long_id }}
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
@@ -91,27 +93,6 @@ spec:
{%- endfor %}
volumeClaimTemplates:
{%- for s in storage %}
{% if clone %}
- metadata:
name: {{ s.id }}
labels:
ownerId: {{ owner_id }}
envId: {{ environment_id }}
appId: {{ id }}
app: {{ sanitized_name }}
diskId: {{ s.id }}
diskType: {{ s.storage_type }}
spec:
accessModes:
- ReadWriteOnce
storageClassName: {{ s.storage_type }}
dataSource:
name: {{ s.id }}
kind: PersistentVolumeClaim
resources:
requests:
storage: {{ disk.size_in_gib }}Gi
{% else %}
- metadata:
name: {{ s.id }}
labels:
@@ -127,6 +108,5 @@ spec:
resources:
requests:
storage: {{ s.size_in_gib }}Gi
{%- endif %}
{%- endfor %}
{%- endif %}

View File

@@ -12,6 +12,7 @@ use rand::distributions::Alphanumeric;
use rand::Rng;
use serde::{Deserialize, Serialize};
use url::Url;
use uuid::Uuid;
use crate::build_platform::{Build, Credentials, GitRepository, Image, SshKey};
use crate::cloud_provider::environment::Environment;
@@ -29,6 +30,7 @@ use crate::models::digital_ocean::{DoAppExtraSettings, DoRouterExtraSettings, Do
use crate::models::router::RouterError;
use crate::models::scaleway::{ScwAppExtraSettings, ScwRouterExtraSettings, ScwStorageType};
use crate::models::types::{CloudProvider as CP, VersionsNumber, AWS, DO, SCW};
use crate::utilities::to_short_id;
#[derive(Clone, Debug, PartialEq)]
pub struct QoveryIdentifier {
@@ -201,7 +203,7 @@ impl Default for ApplicationAdvanceSettings {
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
pub struct Application {
pub id: String,
pub long_id: Uuid,
pub name: String,
pub action: Action,
pub git_url: String,
@@ -240,7 +242,7 @@ impl Application {
match cloud_provider.kind() {
CPKind::Aws => Ok(Box::new(models::application::Application::<AWS>::new(
context.clone(),
self.id.as_str(),
self.long_id,
self.action.to_service_action(),
self.name.as_str(),
self.ports.clone(),
@@ -259,7 +261,7 @@ impl Application {
)?)),
CPKind::Do => Ok(Box::new(models::application::Application::<DO>::new(
context.clone(),
self.id.as_str(),
self.long_id,
self.action.to_service_action(),
self.name.as_str(),
self.ports.clone(),
@@ -278,7 +280,7 @@ impl Application {
)?)),
CPKind::Scw => Ok(Box::new(models::application::Application::<SCW>::new(
context.clone(),
self.id.as_str(),
self.long_id,
self.action.to_service_action(),
self.name.as_str(),
self.ports.clone(),
@@ -300,7 +302,7 @@ impl Application {
fn to_image(&self, cr_info: &ContainerRegistryInfo) -> Image {
Image {
application_id: self.id.clone(),
application_id: to_short_id(&self.long_id),
name: (cr_info.get_image_name)(&self.name),
tag: "".to_string(), // It needs to be compute after creation
commit_id: self.commit_id.clone(),
@@ -439,6 +441,7 @@ pub struct GitCredentials {
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
pub struct Storage {
pub id: String,
pub long_id: Uuid,
pub name: String,
pub storage_type: StorageType,
pub size_in_gib: u16,

View File

@@ -15,9 +15,11 @@ use crate::events::{EnvironmentStep, EventDetails, Stage, ToTransmitter, Transmi
use crate::io_models::{ApplicationAdvanceSettings, Context, Listen, Listener, Listeners, Port, QoveryIdentifier};
use crate::logger::Logger;
use crate::models::types::{CloudProvider, ToTeraContext};
use crate::utilities::to_short_id;
use function_name::named;
use std::marker::PhantomData;
use tera::Context as TeraContext;
use uuid::Uuid;
#[derive(thiserror::Error, Debug)]
pub enum ApplicationError {
@@ -29,6 +31,7 @@ pub struct Application<T: CloudProvider> {
_marker: PhantomData<T>,
pub(super) context: Context,
pub(super) id: String,
pub(super) long_id: Uuid,
pub(super) action: Action,
pub(super) name: String,
pub(super) ports: Vec<Port>,
@@ -50,7 +53,7 @@ pub struct Application<T: CloudProvider> {
impl<T: CloudProvider> Application<T> {
pub fn new(
context: Context,
id: &str,
long_id: Uuid,
action: Action,
name: &str,
ports: Vec<Port>,
@@ -72,7 +75,8 @@ impl<T: CloudProvider> Application<T> {
Ok(Self {
_marker: PhantomData,
context,
id: id.to_string(),
id: to_short_id(&long_id),
long_id,
action,
name: name.to_string(),
ports,
@@ -94,6 +98,7 @@ impl<T: CloudProvider> Application<T> {
pub(super) fn default_tera_context(&self, kubernetes: &dyn Kubernetes, environment: &Environment) -> TeraContext {
let mut context = TeraContext::new();
context.insert("id", self.id());
context.insert("long_id", &self.long_id);
context.insert("owner_id", environment.owner_id.as_str());
context.insert("project_id", environment.project_id.as_str());
context.insert("organization_id", environment.organization_id.as_str());
@@ -140,9 +145,6 @@ impl<T: CloudProvider> Application<T> {
context.insert("is_registry_secret", &true);
context.insert("registry_secret", self.build().image.registry_host());
// TODO: Remove this
context.insert("clone", &false);
if self.context.resource_expiration_in_seconds().is_some() {
context.insert("resource_expiration_in_seconds", &self.context.resource_expiration_in_seconds())
}

View File

@@ -5,6 +5,7 @@ use std::path::Path;
use reqwest::header;
use reqwest::header::{HeaderMap, HeaderValue};
use uuid::Uuid;
// generate the right header for digital ocean with token
pub fn get_header_with_bearer(token: &str) -> HeaderMap<HeaderValue> {
@@ -48,6 +49,10 @@ pub fn compute_image_tag<P: AsRef<Path> + Hash, T: AsRef<Path> + Hash>(
tag
}
pub fn to_short_id(id: &Uuid) -> String {
format!("z{}", id.to_string().split_at(8).0)
}
#[cfg(test)]
mod tests_utilities {
use crate::utilities::compute_image_tag;

View File

@@ -39,12 +39,14 @@ use qovery_engine::logger::Logger;
use qovery_engine::models::digital_ocean::DoRegion;
use qovery_engine::models::scaleway::ScwZone;
use qovery_engine::transaction::{DeploymentOption, Transaction, TransactionResult};
use qovery_engine::utilities::to_short_id;
use std::collections::BTreeMap;
use std::path::Path;
use std::rc::Rc;
use std::str::FromStr;
use std::sync::Arc;
use tracing::{span, Level};
use uuid::Uuid;
pub enum RegionActivationStatus {
Deactivated,
@@ -255,7 +257,7 @@ pub fn environment_3_apps_3_routers_3_databases(
action: Action::Create,
applications: vec![
Application {
id: generate_id(),
long_id: Uuid::new_v4(),
name: app_name_1.clone(),
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
commit_id: "5990752647af11ef21c3d46a51abbde3da1ab351".to_string(),
@@ -270,6 +272,7 @@ pub fn environment_3_apps_3_routers_3_databases(
}),
storage: vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: 10,
@@ -301,7 +304,7 @@ pub fn environment_3_apps_3_routers_3_databases(
advance_settings: Default::default(),
},
Application {
id: generate_id(),
long_id: Uuid::new_v4(),
name: app_name_2.clone(),
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
commit_id: "5990752647af11ef21c3d46a51abbde3da1ab351".to_string(),
@@ -316,6 +319,7 @@ pub fn environment_3_apps_3_routers_3_databases(
}),
storage: vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: 10,
@@ -347,7 +351,7 @@ pub fn environment_3_apps_3_routers_3_databases(
advance_settings: Default::default(),
},
Application {
id: generate_id(),
long_id: Uuid::new_v4(),
name: app_name_3.clone(),
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
commit_id: "158ea8ebc9897c50a7c56b910db33ce837ac1e61".to_string(),
@@ -362,6 +366,7 @@ pub fn environment_3_apps_3_routers_3_databases(
}),
storage: vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: 10,
@@ -523,7 +528,7 @@ pub fn working_minimal_environment(context: &Context, test_domain: &str) -> Envi
organization_id: context.organization_id().to_string(),
action: Action::Create,
applications: vec![Application {
id: application_id,
long_id: Uuid::new_v4(),
name: application_name,
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
commit_id: "fc575a2f3be0b9100492c8a463bf18134a8698a5".to_string(),
@@ -575,7 +580,6 @@ pub fn working_minimal_environment(context: &Context, test_domain: &str) -> Envi
pub fn database_test_environment(context: &Context) -> EnvironmentRequest {
let suffix = generate_id();
let application_id = generate_id();
let application_name = format!("{}-{}", "simple-app".to_string(), &suffix);
EnvironmentRequest {
@@ -586,7 +590,7 @@ pub fn database_test_environment(context: &Context) -> EnvironmentRequest {
organization_id: context.organization_id().to_string(),
action: Action::Create,
applications: vec![Application {
id: application_id,
long_id: Uuid::new_v4(),
name: application_name,
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
commit_id: "fc575a2f3be0b9100492c8a463bf18134a8698a5".to_string(),
@@ -678,7 +682,7 @@ pub fn environnement_2_app_2_routers_1_psql(
}],
applications: vec![
Application {
id: generate_id(),
long_id: Uuid::new_v4(),
name: application_name1.to_string(),
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
commit_id: "680550d1937b3f90551849c0da8f77c39916913b".to_string(),
@@ -693,6 +697,7 @@ pub fn environnement_2_app_2_routers_1_psql(
}),
storage: vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: 10,
@@ -724,7 +729,7 @@ pub fn environnement_2_app_2_routers_1_psql(
advance_settings: Default::default(),
},
Application {
id: generate_id(),
long_id: Uuid::new_v4(),
name: application_name2.to_string(),
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
commit_id: "680550d1937b3f90551849c0da8f77c39916913b".to_string(),
@@ -739,6 +744,7 @@ pub fn environnement_2_app_2_routers_1_psql(
}),
storage: vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: 10,
@@ -831,7 +837,7 @@ pub fn echo_app_environment(context: &Context, test_domain: &str) -> Environment
organization_id: context.organization_id().to_string(),
action: Action::Create,
applications: vec![Application {
id: generate_id(),
long_id: Uuid::new_v4(),
name: format!("{}-{}", "echo-app".to_string(), &suffix),
/*name: "simple-app".to_string(),*/
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
@@ -894,7 +900,7 @@ pub fn environment_only_http_server(context: &Context) -> EnvironmentRequest {
organization_id: context.organization_id().to_string(),
action: Action::Create,
applications: vec![Application {
id: generate_id(),
long_id: Uuid::new_v4(),
name: format!("{}-{}", "mini-http".to_string(), &suffix),
/*name: "simple-app".to_string(),*/
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
@@ -935,6 +941,7 @@ pub fn environment_only_http_server(context: &Context) -> EnvironmentRequest {
pub fn environment_only_http_server_router(context: &Context, test_domain: &str) -> EnvironmentRequest {
let suffix = generate_id();
let id = Uuid::new_v4();
EnvironmentRequest {
execution_id: context.execution_id().to_string(),
id: generate_id(),
@@ -943,7 +950,7 @@ pub fn environment_only_http_server_router(context: &Context, test_domain: &str)
organization_id: context.organization_id().to_string(),
action: Action::Create,
applications: vec![Application {
id: generate_id(),
long_id: id,
name: format!("{}-{}", "mini-http".to_string(), &suffix),
/*name: "simple-app".to_string(),*/
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
@@ -1045,7 +1052,7 @@ pub fn test_db(
let _enter = span.enter();
let context_for_delete = context.clone_not_same_execution_id();
let app_id = generate_id();
let app_id = Uuid::new_v4();
let database_username = "superuser".to_string();
let database_password = generate_password(provider_kind.clone(), database_mode.clone());
let db_kind_str = db_kind.name().to_string();
@@ -1107,8 +1114,8 @@ pub fn test_db(
.applications
.into_iter()
.map(|mut app| {
app.id = app_id.clone();
app.name = app_id.clone();
app.long_id = app_id.clone();
app.name = to_short_id(&app_id);
app.branch = app_name.clone();
app.commit_id = db_infos.app_commit.clone();
app.ports = vec![Port {

View File

@@ -9,12 +9,14 @@ use qovery_engine::cloud_provider::Kind;
use qovery_engine::cmd::kubectl::kubernetes_get_all_pdbs;
use qovery_engine::io_models::{Action, CloneForTest, Port, Protocol, Storage, StorageType};
use qovery_engine::transaction::TransactionResult;
use qovery_engine::utilities::to_short_id;
use std::collections::BTreeMap;
use std::thread;
use std::time::Duration;
use test_utilities::aws::aws_default_engine_config;
use test_utilities::utilities::{context, init, kubernetes_config_path};
use tracing::{span, Level};
use uuid::Uuid;
#[cfg(feature = "test-aws-minimal")]
#[named]
@@ -159,7 +161,7 @@ fn deploy_a_working_environment_and_pause_it_eks() {
);
let ea = environment.clone();
let selector = format!("appId={}", environment.applications[0].id);
let selector = format!("appId={}", to_short_id(&environment.applications[0].long_id));
let ret = environment.deploy_environment(&ea, logger.clone(), &engine_config);
assert!(matches!(ret, TransactionResult::Ok));
@@ -220,7 +222,12 @@ fn deploy_a_working_environment_and_pause_it_eks() {
None,
);
for pdb in pdbs.expect("Unable to get pdbs").items.expect("Unable to get pdbs") {
assert_eq!(pdb.metadata.name.contains(&environment.applications[0].id), false)
assert_eq!(
pdb.metadata
.name
.contains(&to_short_id(&environment.applications[0].long_id)),
false
)
}
// Check we can resume the env
@@ -265,7 +272,11 @@ fn deploy_a_working_environment_and_pause_it_eks() {
);
let mut filtered_pdb = false;
for pdb in pdbs.expect("Unable to get pdbs").items.expect("Unable to get pdbs") {
if pdb.metadata.name.contains(&environment.applications[0].id) {
if pdb
.metadata
.name
.contains(&to_short_id(&environment.applications[0].long_id))
{
filtered_pdb = true;
break;
}
@@ -575,6 +586,7 @@ fn deploy_a_working_environment_with_storage_on_aws_eks() {
.map(|mut app| {
app.storage = vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: storage_size,
@@ -657,6 +669,7 @@ fn redeploy_same_app_with_ebs() {
.map(|mut app| {
app.storage = vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: storage_size,

View File

@@ -9,6 +9,7 @@ use ::function_name::named;
use qovery_engine::cloud_provider::Kind;
use qovery_engine::io_models::{Action, CloneForTest, Port, Protocol, Storage, StorageType};
use qovery_engine::transaction::TransactionResult;
use qovery_engine::utilities::to_short_id;
use std::collections::BTreeMap;
use std::thread;
use std::time::Duration;
@@ -16,6 +17,7 @@ use test_utilities::common::Infrastructure;
use test_utilities::digitalocean::do_default_engine_config;
use test_utilities::utilities::context;
use tracing::{span, warn, Level};
use uuid::Uuid;
// 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.
@@ -222,7 +224,7 @@ fn digitalocean_doks_deploy_a_working_environment_and_pause() {
);
let env_action = environment.clone();
let selector = format!("appId={}", environment.applications[0].id);
let selector = format!("appId={}", to_short_id(&environment.applications[0].long_id));
let ret = environment.deploy_environment(&env_action, logger.clone(), &engine_config);
assert!(matches!(ret, TransactionResult::Ok));
@@ -451,6 +453,7 @@ fn digitalocean_doks_deploy_a_working_environment_with_storage() {
.map(|mut app| {
app.storage = vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: storage_size,
@@ -534,6 +537,7 @@ fn digitalocean_doks_redeploy_same_app() {
.map(|mut app| {
app.storage = vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: storage_size,

View File

@@ -9,12 +9,14 @@ use ::function_name::named;
use qovery_engine::cloud_provider::Kind;
use qovery_engine::io_models::{Action, CloneForTest, Port, Protocol, Storage, StorageType};
use qovery_engine::transaction::TransactionResult;
use qovery_engine::utilities::to_short_id;
use std::collections::BTreeMap;
use std::thread;
use std::time::Duration;
use test_utilities::common::Infrastructure;
use test_utilities::scaleway::scw_default_engine_config;
use tracing::{span, warn, Level};
use uuid::Uuid;
// 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.
@@ -230,7 +232,7 @@ fn scaleway_kapsule_deploy_a_working_environment_and_pause() {
);
let env_action = environment.clone();
let selector = format!("appId={}", environment.applications[0].id);
let selector = format!("appId={}", to_short_id(&environment.applications[0].long_id));
let result = environment.deploy_environment(&env_action, logger.clone(), &engine_config);
assert!(matches!(result, TransactionResult::Ok));
@@ -466,6 +468,7 @@ fn scaleway_kapsule_deploy_a_working_environment_with_storage() {
.map(|mut app| {
app.storage = vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: storage_size,
@@ -541,7 +544,7 @@ fn deploy_a_working_environment_and_pause_it() {
);
let ea = environment.clone();
let selector = format!("appId={}", environment.applications[0].id);
let selector = format!("appId={}", to_short_id(&environment.applications[0].long_id));
let result = environment.deploy_environment(&ea, logger.clone(), &engine_config);
assert!(matches!(result, TransactionResult::Ok));
@@ -634,6 +637,7 @@ fn scaleway_kapsule_redeploy_same_app() {
.map(|mut app| {
app.storage = vec![Storage {
id: generate_id(),
long_id: Uuid::new_v4(),
name: "photos".to_string(),
storage_type: StorageType::Ssd,
size_in_gib: storage_size,