Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add off chain agent as testcontainer #550

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ssr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions ssr/src/consts/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
12 changes: 11 additions & 1 deletion ssr/src/init/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand All @@ -30,6 +34,7 @@ pub struct TestContainers {
redis: MaybeContainer<GenericImage>,
metadata: MaybeContainer<YralMetadata>,
backend: MaybeContainer<YralBackend>,
off_chain_agent: MaybeContainer<OffChainAgent>,
}

impl TestContainers {
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions ssr/src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading