Skip to content

Commit 615962f

Browse files
committed
test
1 parent a2112fb commit 615962f

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
run: |
128128
mkdir /tmp/local-linera-net
129129
FAUCET_PORT=$(echo "$LINERA_FAUCET_URL" | cut -d: -f3)
130-
cargo run --bin linera --features kubernetes -- net up --kubernetes --policy-config testnet --path /tmp/local-linera-net --validators 2 --shards 2 --with-faucet --faucet-port $FAUCET_PORT --faucet-amount 1000 &
130+
cargo run --bin linera --features kubernetes -- net up --kubernetes --policy-config testnet --path /tmp/local-linera-net --validators 1 --shards 2 --with-faucet --faucet-port $FAUCET_PORT --faucet-amount 100 &
131131
- name: Wait for faucet to be ready
132132
run: |
133133
until curl -s $LINERA_FAUCET_URL >/dev/null; do sleep 1; done

linera-service/src/cli/net_up_utils.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -317,18 +317,23 @@ async fn print_messages_and_create_faucet(
317317

318318
// Run the faucet,
319319
let faucet_service = if with_faucet {
320-
let faucet_chain_idx = faucet_chain.unwrap_or(0);
321-
assert!(
322-
num_other_initial_chains > faucet_chain_idx,
323-
"num_other_initial_chains must be strictly greater than the faucet chain index if \
320+
let faucet_chain = if let Some(faucet_chain_idx) = faucet_chain {
321+
assert!(
322+
num_other_initial_chains > faucet_chain_idx,
323+
"num_other_initial_chains must be strictly greater than the faucet chain index if \
324324
with_faucet is true"
325-
);
326-
// This picks a lexicographically faucet_chain_idx-th non-admin chain.
327-
let faucet_chain = chains
328-
.into_iter()
329-
.filter(|chain_id| *chain_id != wallet.genesis_admin_chain())
330-
.nth(faucet_chain_idx as usize)
331-
.unwrap(); // we checked that there are enough chains above, so this should be safe
325+
);
326+
// This picks a lexicographically faucet_chain_idx-th non-admin chain.
327+
Some(
328+
chains
329+
.into_iter()
330+
.filter(|chain_id| *chain_id != wallet.genesis_admin_chain())
331+
.nth(faucet_chain_idx as usize)
332+
.unwrap(),
333+
) // we checked that there are enough chains above, so this should be safe
334+
} else {
335+
None
336+
};
332337
let service = client
333338
.run_faucet(Some(faucet_port.into()), faucet_chain, faucet_amount)
334339
.await?;

linera-service/src/cli_wrappers/wallet.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -540,17 +540,19 @@ impl ClientWrapper {
540540
pub async fn run_faucet(
541541
&self,
542542
port: impl Into<Option<u16>>,
543-
chain_id: ChainId,
543+
chain_id: Option<ChainId>,
544544
amount: Amount,
545545
) -> Result<FaucetService> {
546546
let port = port.into().unwrap_or(8080);
547547
let mut command = self.command().await?;
548-
let child = command
548+
let command = command
549549
.arg("faucet")
550-
.arg(chain_id.to_string())
551550
.args(["--port".to_string(), port.to_string()])
552-
.args(["--amount".to_string(), amount.to_string()])
553-
.spawn_into()?;
551+
.args(["--amount".to_string(), amount.to_string()]);
552+
if let Some(chain_id) = chain_id {
553+
command.arg(chain_id.to_string());
554+
}
555+
let child = command.spawn_into()?;
554556
let client = reqwest_client();
555557
for i in 0..10 {
556558
linera_base::time::timer::sleep(Duration::from_secs(i)).await;

0 commit comments

Comments
 (0)