Skip to content

Commit

Permalink
ExistingNet -> FaucetNet
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-ds committed Dec 20, 2024
1 parent 8464e81 commit e721d6e
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:
existing-net-test:
faucet-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 existing-net tests
- name: Run the faucet-net tests
run: |
cargo test -p linera-service existing_net_grpc --features existing-net
cargo test -p linera-service faucet_net_grpc --features faucet-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 @@ -54,7 +54,7 @@ kubernetes = [
"dep:pathdiff",
"dep:fs_extra",
]
existing-net = []
faucet-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,18 +15,18 @@ use super::{
Network, OnClientDrop,
};

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

impl ExistingNetTestingConfig {
/// Creates a new [`ExistingNetTestingConfig`] for running tests with an existing Linera
/// network.
impl FaucetNetTestingConfig {
/// Creates a new [`FaucetNetTestingConfig`] for running tests with a Linera
/// network that has a faucet.
///
/// The `faucet_url` is used to connect to the network and obtain its configuration,
/// as well as to create microchains used for testing. If the parameter is [`None`],
/// then it falls back to the URL specified in the `LINERA_FAUCET_URL` environment
/// variable, or the default devnet faucet URL.
/// variable.
pub fn new(faucet_url: Option<String>) -> Self {
Self {
faucet: Faucet::new(
Expand All @@ -39,14 +39,14 @@ impl ExistingNetTestingConfig {
}

#[async_trait]
impl LineraNetConfig for ExistingNetTestingConfig {
type Net = ExistingNet;
impl LineraNetConfig for FaucetNetTestingConfig {
type Net = FaucetNet;

async fn instantiate(self) -> Result<(Self::Net, ClientWrapper)> {
let seed = 37;
let mut net = ExistingNet::new(Some(seed), &self.faucet)
let mut net = FaucetNet::new(Some(seed), &self.faucet)
.await
.expect("Creating ExistingNet should not fail");
.expect("Creating FaucetNet 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,15 +78,15 @@ impl LineraNetConfig for ExistingNetTestingConfig {

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

#[async_trait]
impl LineraNet for ExistingNet {
impl LineraNet for FaucetNet {
async fn ensure_is_running(&mut self) -> Result<()> {
// Leaving this just returning for now.
// We would have to connect to each validator in the existing net then run
Expand Down Expand Up @@ -118,7 +118,7 @@ impl LineraNet for ExistingNet {
}
}

impl ExistingNet {
impl FaucetNet {
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,9 +8,6 @@
/// How to run docker operations

Check warning on line 8 in linera-service/src/cli_wrappers/mod.rs

View workflow job for this annotation

GitHub Actions / lint-cargo-fmt

Diff in /home/runner/work/linera-protocol/linera-protocol/linera-service/src/cli_wrappers/mod.rs
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 @@ -25,6 +22,9 @@ mod kubectl;
pub mod local_kubernetes_net;

Check warning on line 22 in linera-service/src/cli_wrappers/mod.rs

View workflow job for this annotation

GitHub Actions / lint-cargo-fmt

Diff in /home/runner/work/linera-protocol/linera-protocol/linera-service/src/cli_wrappers/mod.rs
/// How to run Linera validators locally as native processes.
pub mod local_net;
#[cfg(all(with_testing, feature = "faucet-net"))]
/// How to connect to network that has a faucet.
pub mod faucet_net;
#[cfg(feature = "kubernetes")]
/// Util functions for the wrappers
mod util;
Expand Down
Loading

0 comments on commit e721d6e

Please sign in to comment.