From de373eee73cbd42739da2d69ea1c0bf956f76611 Mon Sep 17 00:00:00 2001 From: tushar-saxena-yral Date: Fri, 6 Dec 2024 12:46:56 +0530 Subject: [PATCH 1/2] feat: add off chain agent as testcontainer --- ssr/src/consts/local.rs | 1 + ssr/src/init/containers.rs | 12 +++++++++++- ssr/src/init/mod.rs | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ssr/src/consts/local.rs b/ssr/src/consts/local.rs index b45b175d..be5f7e40 100644 --- a/ssr/src/consts/local.rs +++ b/ssr/src/consts/local.rs @@ -8,3 +8,4 @@ pub const AGENT_URL: &str = "http://localhost:4943"; pub const YRAL_BACKEND_CONTAINER_TAG: &str = "04b53277579d9370c13312a2833ca0b855cdad72"; pub const YRAL_METADATA_CONTAINER_TAG: &str = "a4879e2e711c17beeb12ed6987ba315c110be9e5"; +pub const OFF_CHAIN_AGENT_TAG: &str = "b24a935ff5c7c36062b5af5062d2949e6909f886"; diff --git a/ssr/src/init/containers.rs b/ssr/src/init/containers.rs index bcb8ffd9..8a4dc759 100644 --- a/ssr/src/init/containers.rs +++ b/ssr/src/init/containers.rs @@ -12,11 +12,15 @@ use yral_metadata_types::UserMetadata; use yral_testcontainers::{ backend::{self, YralBackend, ADMIN_SECP_BYTES}, metadata::{self, YralMetadata}, + off_chain_agent::{OffChainAgent, OFF_CHAIN_AGENT_PORT}, }; use crate::{ canister_ids::USER_INDEX_ID, - consts::{METADATA_API_BASE, YRAL_BACKEND_CONTAINER_TAG, YRAL_METADATA_CONTAINER_TAG}, + consts::{ + METADATA_API_BASE, OFF_CHAIN_AGENT_TAG, YRAL_BACKEND_CONTAINER_TAG, + YRAL_METADATA_CONTAINER_TAG, + }, state::admin_canisters::AdminCanisters, }; @@ -30,6 +34,7 @@ pub struct TestContainers { redis: MaybeContainer, metadata: MaybeContainer, backend: MaybeContainer, + off_chain_agent: MaybeContainer, } impl TestContainers { @@ -49,6 +54,11 @@ impl TestContainers { self.redis = Some(Self::start_image(redis_im, 6379.tcp()).await); } + pub async fn start_off_chain_agent(&mut self) { + let img = OffChainAgent::new(OFF_CHAIN_AGENT_TAG); + self.off_chain_agent = Some(Self::start_image(img, OFF_CHAIN_AGENT_PORT).await); + } + pub async fn start_metadata(&mut self) { let img = YralMetadata::new(YRAL_METADATA_CONTAINER_TAG.into()); self.metadata = Some(Self::start_image(img, metadata::REST_PORT).await); diff --git a/ssr/src/init/mod.rs b/ssr/src/init/mod.rs index e23317f2..0e44925c 100644 --- a/ssr/src/init/mod.rs +++ b/ssr/src/init/mod.rs @@ -282,6 +282,7 @@ impl AppStateBuilder { { self.containers.start_backend().await; self.containers.start_metadata().await; + self.containers.start_off_chain_agent().await; } let app_state = AppState { From e618428f6cd793777b5ca5c5c050c01f6167884b Mon Sep 17 00:00:00 2001 From: tushar-saxena-yral Date: Tue, 10 Dec 2024 17:59:45 +0530 Subject: [PATCH 2/2] feat: bump rev of yral-testcontainers --- Cargo.lock | 2 +- ssr/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2629e82..f920c6a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8040,7 +8040,7 @@ dependencies = [ [[package]] name = "yral-testcontainers" version = "0.1.0" -source = "git+https://github.com/yral-dapp/yral-testcontainers?rev=7438ba7cb281e7f195cf81f2a8532f63ce005771#7438ba7cb281e7f195cf81f2a8532f63ce005771" +source = "git+https://github.com/yral-dapp/yral-testcontainers?rev=99084e7b8e7170211e99d72a080c0e3ee2e491ca#99084e7b8e7170211e99d72a080c0e3ee2e491ca" dependencies = [ "anyhow", "gix", diff --git a/ssr/Cargo.toml b/ssr/Cargo.toml index b2d3912f..8d6803d8 100644 --- a/ssr/Cargo.toml +++ b/ssr/Cargo.toml @@ -89,7 +89,7 @@ gloo-utils = { version = "0.2.0", features = ["serde"] } hmac = { version = "0.12.1", optional = true } wasm-bindgen-futures = { version = "0.4.42" } testcontainers = { version = "0.20.0", optional = true } -yral-testcontainers = { git = "https://github.com/yral-dapp/yral-testcontainers", rev = "7438ba7cb281e7f195cf81f2a8532f63ce005771", optional = true } +yral-testcontainers = { git = "https://github.com/yral-dapp/yral-testcontainers", rev = "99084e7b8e7170211e99d72a080c0e3ee2e491ca", optional = true } sns-validation = { git = "https://github.com/yral-dapp/yral-common.git", rev = "5e4414a3f1e0644d93f181949d533c6a9991da04" } yral-grpc-traits = { git = "https://github.com/yral-dapp/yral-common.git", rev = "5e4414a3f1e0644d93f181949d533c6a9991da04" } js-sys = "0.3.69"