Skip to content

Commit d479c04

Browse files
ndr-dsma2bd
authored andcommitted
Properly wait for things that are spawned as bg processes (linera-io#4408)
## Motivation Right now we have a lot of stuff in CI that gets started as a bg process. However, the issue is that if these things start taking slightly longer to start up for some reason, it'll make the test fail, because the test will try to submig requests to something that isn't ready yet. ## Proposal Explicitly wait for things to be actually up before proceeding. ## Test Plan CI ## Release Plan - Nothing to do / These changes follow the usual release cycle.
1 parent 84aecfb commit d479c04

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

.github/workflows/rust.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,25 @@ jobs:
7171
- name: Run the storage-service instance
7272
run: |
7373
cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE &
74+
- name: Wait for storage service to be ready
75+
run: |
76+
until nc -z 127.0.0.1 1235; do sleep 1; done
77+
- name: Build binaries
78+
run: |
79+
cargo build --features storage-service --bin linera-server --bin linera-proxy --bin linera
7480
- name: Run the validators
7581
run: |
76-
cargo build --features storage-service
7782
mkdir /tmp/local-linera-net
78-
cargo run --features storage-service --bin linera -- net up --storage service:tcp:$LINERA_STORAGE_SERVICE:table --policy-config testnet --path /tmp/local-linera-net --validators 4 --shards 4 &
83+
cargo run --features storage-service --bin linera -- net up --storage service:tcp:$LINERA_STORAGE_SERVICE:table --policy-config testnet --path /tmp/local-linera-net --validators 2 --shards 2 &
7984
- name: Create two epochs and run the faucet
8085
# See https://github.com/linera-io/linera-protocol/pull/2835 for details.
8186
run: |
82-
cargo build --bin linera
8387
cargo run --bin linera -- resource-control-policy --http-request-timeout-ms 1000
8488
cargo run --bin linera -- resource-control-policy --http-request-timeout-ms 500
8589
cargo run --bin linera -- faucet --amount 1000 --port 8079 &
90+
- name: Wait for faucet to be ready
91+
run: |
92+
until curl -s http://localhost:8079 >/dev/null; do sleep 1; done
8693
- name: Run the remote-net tests
8794
run: |
8895
cargo test -p linera-service remote_net_grpc --features remote-net
@@ -193,6 +200,9 @@ jobs:
193200
- name: Run the storage-service instance
194201
run: |
195202
cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE &
203+
- name: Wait for storage service to be ready
204+
run: |
205+
until nc -z 127.0.0.1 1235; do sleep 1; done
196206
- name: Run the benchmark test
197207
run: |
198208
cargo build --locked -p linera-service --bin linera-benchmark --features storage-service
@@ -250,6 +260,9 @@ jobs:
250260
- name: Run the storage-service instance
251261
run: |
252262
cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE &
263+
- name: Wait for storage service to be ready
264+
run: |
265+
until nc -z 127.0.0.1 1235; do sleep 1; done
253266
- name: Run Ethereum tests
254267
run: |
255268
cargo test -p linera-ethereum --features ethereum
@@ -274,9 +287,14 @@ jobs:
274287
run: |
275288
cd examples
276289
cargo build --locked --release --target wasm32-unknown-unknown
277-
- name: Run the storage-service instance and the storage-service tests
290+
- name: Run the storage-service instance
278291
run: |
279292
cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE &
293+
- name: Wait for storage service to be ready
294+
run: |
295+
until nc -z 127.0.0.1 1235; do sleep 1; done
296+
- name: Run the storage-service tests
297+
run: |
280298
cargo test --features storage-service -- storage_service --nocapture
281299
282300
web:

0 commit comments

Comments
 (0)