Skip to content
Merged
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
14 changes: 13 additions & 1 deletion engine/packages/engine/tests/common/test_envoy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,19 @@ impl Envoy {
token: Some(self.config.token.clone()),
namespace: self.config.namespace.clone(),
pool_name: self.config.pool_name.clone(),
prepopulate_actor_names: HashMap::new(),
prepopulate_actor_names: self
.inner
.actor_factories
.keys()
.map(|name| {
(
name.clone(),
rivet_test_envoy::ActorName {
metadata: serde_json::Value::Object(serde_json::Map::new()),
},
)
})
.collect(),
metadata: self.config.metadata.clone(),
not_global: true,
debug_latency_ms: None,
Expand Down
25 changes: 25 additions & 0 deletions engine/packages/engine/tests/common/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,31 @@ pub async fn setup_test_namespace_with_envoy(
(namespace_name, namespace_id, envoy)
}

/// Like `setup_test_namespace_with_envoy`, but pre-declares the given actor names on the envoy.
///
/// Each name is registered with an `EchoActor` behavior. The envoy advertises these via
/// `prepopulate_actor_names` on connect, which is what populates the `ActorNameKey` index used
/// by the `actors/names` listing API.
pub async fn setup_test_namespace_with_envoy_for_names(
dc: &super::TestDatacenter,
actor_names: Vec<String>,
) -> (String, rivet_util::Id, super::test_envoy::TestEnvoy) {
let (namespace_name, namespace_id) = setup_test_namespace(dc).await;

let envoy = setup_envoy(dc, &namespace_name, move |mut builder| {
builder = builder.with_pool_name(super::TEST_RUNNER_NAME);
for name in actor_names {
builder = builder.with_actor_behavior(&name, |_config| {
Box::new(super::test_envoy::EchoActor::new())
});
}
builder
})
.await;

(namespace_name, namespace_id, envoy)
}

pub async fn cleanup_test_namespace(namespace_id: rivet_util::Id, _guard_port: u16) {
// TODO: implement namespace deletion when available
tracing::info!(?namespace_id, "namespace cleanup (not implemented)");
Expand Down
2 changes: 1 addition & 1 deletion engine/sdks/rust/test-envoy/src/lib.rs

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

Loading