Skip to content

Commit

Permalink
RemoteNet -> ExistingNet (linera-io#2998)
Browse files Browse the repository at this point in the history
## Motivation

I think I originally implemented this, it was originally running tests against the devnet on GCP. I don't remember what the name was then.
Regardless, now this has changed, and it actually just connects to any existing/running network that has a faucet.
I thought `RunningNet` sounded weird, `ExistingNet` sounded better. A `WithFaucet` suffix or something like that also sounded wrong. So I landed on `ExistingNet`.

## Proposal

Rename all remote net things into existing net. The feature for this also had kubernetes related stuff as a dependency, even though it uses nothing kubernetes related.
So removed that.

## Test Plan

CI

## Release Plan

- Nothing to do / These changes follow the usual release cycle.
  • Loading branch information
ndr-ds authored Dec 4, 2024
1 parent d55bd04 commit 909b3e7
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ permissions:
contents: read

jobs:
remote-net-test:
existing-net-test:
runs-on: ubuntu-latest-8-cores
timeout-minutes: 40

Expand All @@ -65,9 +65,9 @@ jobs:
cargo run --bin linera -- resource-control-policy --block 0.0000001
cargo run --bin linera -- resource-control-policy --block 0.000000
cargo run --bin linera -- faucet --amount 1000 --port 8079 69705f85ac4c9fef6c02b4d83426aaaf05154c645ec1c61665f8e450f0468bc0 &
- name: Run the remote-net tests
- name: Run the existing-net tests
run: |
cargo test -p linera-service remote_net_grpc --features remote-net
cargo test -p linera-service existing_net_grpc --features existing-net
execution-wasmtime-test:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion linera-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ kubernetes = [
"dep:pathdiff",
"dep:fs_extra",
]
remote-net = ["dep:k8s-openapi", "dep:kube"]
existing-net = []
metrics = ["prometheus", "linera-base/metrics", "linera-client/metrics"]
storage-service = ["linera-client/storage-service", "linera-storage-service"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ use super::{
Network, OnClientDrop,
};

pub struct RemoteNetTestingConfig {
pub struct ExistingNetTestingConfig {
faucet: Faucet,
}

impl RemoteNetTestingConfig {
/// Creates a new [`RemoteNetTestingConfig`] for running tests with an external Linera
impl ExistingNetTestingConfig {
/// Creates a new [`ExistingNetTestingConfig`] for running tests with an existing Linera
/// network.
///
/// The `faucet_url` is used to connect to the network and obtain its configuration,
Expand All @@ -39,14 +39,14 @@ impl RemoteNetTestingConfig {
}

#[async_trait]
impl LineraNetConfig for RemoteNetTestingConfig {
type Net = RemoteNet;
impl LineraNetConfig for ExistingNetTestingConfig {
type Net = ExistingNet;

async fn instantiate(self) -> Result<(Self::Net, ClientWrapper)> {
let seed = 37;
let mut net = RemoteNet::new(Some(seed), &self.faucet)
let mut net = ExistingNet::new(Some(seed), &self.faucet)
.await
.expect("Creating RemoteNet should not fail");
.expect("Creating ExistingNet should not fail");

let client = net.make_client().await;
// The tests assume we've created a genesis config with 2
Expand Down Expand Up @@ -78,18 +78,18 @@ impl LineraNetConfig for RemoteNetTestingConfig {

/// Remote net
#[derive(Clone)]
pub struct RemoteNet {
pub struct ExistingNet {
network: Network,
testing_prng_seed: Option<u64>,
next_client_id: usize,
tmp_dir: Arc<TempDir>,
}

#[async_trait]
impl LineraNet for RemoteNet {
impl LineraNet for ExistingNet {
async fn ensure_is_running(&mut self) -> Result<()> {
// Leaving this just returning for now.
// We would have to connect to each validator in the remote net then run
// We would have to connect to each validator in the existing net then run
// ensure_connected_cluster_is_running
Ok(())
}
Expand All @@ -113,12 +113,12 @@ impl LineraNet for RemoteNet {
}

async fn terminate(&mut self) -> Result<()> {
// We're not killing the remote net :)
// We're not killing the existing network :)
Ok(())
}
}

impl RemoteNet {
impl ExistingNet {
async fn new(testing_prng_seed: Option<u64>, faucet: &Faucet) -> Result<Self> {
let tmp_dir = Arc::new(tempdir()?);
// Write json config to disk
Expand Down
6 changes: 3 additions & 3 deletions linera-service/src/cli_wrappers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
/// How to run docker operations
pub mod docker;

#[cfg(all(with_testing, feature = "existing-net"))]
/// How to connect to an existing/running network.
pub mod existing_net;
#[cfg(feature = "kubernetes")]
/// How to run helmfile operations
mod helmfile;
Expand All @@ -22,9 +25,6 @@ mod kubectl;
pub mod local_kubernetes_net;
/// How to run Linera validators locally as native processes.
pub mod local_net;
#[cfg(all(with_testing, feature = "remote-net"))]
/// How to connect to running GCP DevNet.
pub mod remote_net;
#[cfg(feature = "kubernetes")]
/// Util functions for the wrappers
mod util;
Expand Down
Loading

0 comments on commit 909b3e7

Please sign in to comment.