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

ExistingNet -> NetWithFaucet #3067

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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,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(all(with_testing, feature = "faucet-net"))]
/// How to connect to network that has a faucet.
pub mod faucet_net;
#[cfg(feature = "kubernetes")]
/// How to run helmfile operations
mod helmfile;
Expand Down
Loading
Loading