Skip to content
Closed
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
10 changes: 10 additions & 0 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions packages/edge/infra/client/echo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ COPY . .
RUN \
--mount=type=cache,target=/root/.cargo/git \
--mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/app/packages/infra/client/target \
cd packages/infra/client && \
--mount=type=cache,target=/app/target \
RUSTFLAGS="--cfg tokio_unstable" cargo build --release --bin pegboard-echo-server && \
mkdir -p /app/dist && \
mv /app/target/x86_64-unknown-linux-musl/release/pegboard-echo-server /app/dist/pegboard-echo-server
Expand Down
2 changes: 1 addition & 1 deletion packages/edge/infra/client/manager/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ impl Ctx {
// Test bindings
#[cfg(feature = "test")]
impl Ctx {
pub fn actors(&self) -> &RwLock<HashMap<Uuid, Arc<Actor>>> {
pub fn actors(&self) -> &RwLock<HashMap<(Uuid, u32), Arc<Actor>>> {
&self.actors
}
}
25 changes: 8 additions & 17 deletions packages/edge/infra/client/manager/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub async fn start_echo_actor(
) {
let cmd = protocol::Command::StartActor {
actor_id,
generation: 0,
config: Box::new(protocol::ActorConfig {
image: protocol::Image {
id: Uuid::nil(),
Expand Down Expand Up @@ -101,10 +102,6 @@ pub async fn start_echo_actor(
memory_max: 15 * 1024 * 1024,
disk: 15,
},
owner: protocol::ActorOwner::DynamicServer {
server_id: actor_id,
workflow_id: Uuid::new_v4(),
},
metadata: protocol::Raw::new(&protocol::ActorMetadata {
actor: protocol::ActorMetadataActor {
actor_id,
Expand All @@ -131,6 +128,7 @@ pub async fn start_echo_actor(
build: protocol::ActorMetadataBuild {
build_id: Uuid::nil(),
},
network: None,
})
.unwrap(),
}),
Expand All @@ -145,6 +143,7 @@ pub async fn start_js_echo_actor(
) {
let cmd = protocol::Command::StartActor {
actor_id,
generation: 0,
config: Box::new(protocol::ActorConfig {
image: protocol::Image {
id: Uuid::nil(),
Expand Down Expand Up @@ -172,10 +171,6 @@ pub async fn start_js_echo_actor(
memory_max: 15 * 1024 * 1024,
disk: 15,
},
owner: protocol::ActorOwner::DynamicServer {
server_id: actor_id,
workflow_id: Uuid::new_v4(),
},
metadata: protocol::Raw::new(&protocol::ActorMetadata {
actor: protocol::ActorMetadataActor {
actor_id,
Expand All @@ -202,6 +197,7 @@ pub async fn start_js_echo_actor(
build: protocol::ActorMetadataBuild {
build_id: Uuid::nil(),
},
network: None,
})
.unwrap(),
}),
Expand Down Expand Up @@ -262,8 +258,7 @@ pub async fn init_client(gen_path: &Path, working_path: &Path) -> Config {
data_dir: Some(working_path.to_path_buf()),
cluster: Cluster {
client_id: Uuid::new_v4(),
datacenter_id: Uuid::new_v4(),
pegboard_endpoint: Url::parse("ws://127.0.0.1:5030").unwrap(),
ws_addresses: Addresses::Static(vec!["ws://127.0.0.1:5030".to_string()]),
// Not necessary for the test
api_endpoint: Url::parse("http://127.0.0.1").unwrap(),
},
Expand Down Expand Up @@ -328,11 +323,7 @@ pub async fn start_client(
url.set_port(Some(port)).unwrap();
url.set_path(&format!("/v{PROTOCOL_VERSION}"));
url.query_pairs_mut()
.append_pair("client_id", &config.client.cluster.client_id.to_string())
.append_pair(
"datacenter_id",
&config.client.cluster.datacenter_id.to_string(),
);
.append_pair("client_id", &config.client.cluster.client_id.to_string());

tracing::info!("connecting to ws: {url}");

Expand Down Expand Up @@ -375,7 +366,7 @@ pub async fn build_binaries(gen_path: &Path) {
.arg("pegboard-echo-server")
.arg("-f")
.arg(pkg_path.join(format!("echo")).join("Dockerfile"))
.arg(pkg_path.join("..").join("..").join(".."))
.arg(pkg_path.join("..").join("..").join("..").join(".."))
.status()
.await
.unwrap();
Expand Down Expand Up @@ -431,7 +422,7 @@ async fn build_runner(gen_path: &Path, variant: &str) {
.join(format!("{variant}-runner"))
.join("Dockerfile"),
)
.arg(pkg_path.join("..").join("..").join(".."))
.arg(pkg_path.join("..").join("..").join("..").join(".."))
.status()
.await
.unwrap();
Expand Down
10 changes: 5 additions & 5 deletions packages/edge/infra/client/manager/tests/container_lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async fn handle_connection(
// Verify client state
let actors = ctx.actors().read().await;
assert!(
actors.contains_key(&actor_id),
actors.contains_key(&(actor_id, 0)),
"actor not in client memory"
);
}
Expand All @@ -116,7 +116,7 @@ async fn handle_connection(
// Verify client state
let actors = ctx.actors().read().await;
assert!(
actors.contains_key(&actor_id),
actors.contains_key(&(actor_id, 0)),
"actor not in client memory"
);

Expand Down Expand Up @@ -147,9 +147,9 @@ async fn handle_connection(
&mut tx,
protocol::Command::SignalActor {
actor_id,
generation: 0,
signal: Signal::SIGKILL as i32,
persist_storage: false,
ignore_future_state: false,
},
)
.await;
Expand All @@ -166,7 +166,7 @@ async fn handle_connection(
// Verify client state
let actors = ctx.actors().read().await;
assert!(
actors.contains_key(&actor_id),
actors.contains_key(&(actor_id, 0)),
"actor not in client memory"
);
}
Expand All @@ -184,7 +184,7 @@ async fn handle_connection(
// Verify client state
let actors = ctx.actors().read().await;
assert!(
!actors.contains_key(&actor_id),
actors.contains_key(&(actor_id, 0)),
"actor still in client memory"
);

Expand Down
Loading