mirror of
https://github.com/logos-storage/logos-storage-local-harness.git
synced 2026-01-02 13:33:11 +00:00
feat: add launching for whole Codex network
This commit is contained in:
parent
4ac77597eb
commit
a7d12ba1ff
@ -102,7 +102,9 @@ cdx_get_spr() {
|
||||
}
|
||||
|
||||
cdx_launch_node() {
|
||||
_cdx_ensure_outputs 0 || return 1
|
||||
local node_index="$1"
|
||||
|
||||
_cdx_ensure_outputs "${node_index}" || return 1
|
||||
|
||||
local codex_cmd
|
||||
codex_cmd=$(cdx_cmdline "$@") || return 1
|
||||
@ -112,9 +114,19 @@ cdx_launch_node() {
|
||||
pm_job_exit $?
|
||||
)&
|
||||
pm_track_last_job
|
||||
_cdx_pids[$1]=$!
|
||||
_cdx_pids[$node_index]=$!
|
||||
|
||||
cdx_ensure_ready "$@"
|
||||
cdx_ensure_ready "$node_index"
|
||||
}
|
||||
|
||||
cdx_launch_network() {
|
||||
local node_count="$1" bootstrap_spr
|
||||
cdx_launch_node 0 || return 1
|
||||
bootstrap_spr=$(cdx_get_spr 0) || return 1
|
||||
for i in $(seq 1 "$node_count"); do
|
||||
cdx_launch_node "$i" "--bootstrap-node" "$bootstrap_spr" || return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
cdx_pid() {
|
||||
|
||||
@ -38,6 +38,13 @@ await() {
|
||||
return 0
|
||||
}
|
||||
|
||||
await_all() {
|
||||
local pids=("$@") timeout=${2:-30}
|
||||
for pid in "${pids[@]}"; do
|
||||
await "$pid" "$timeout" || return 1
|
||||
done
|
||||
}
|
||||
|
||||
sha1() {
|
||||
sha1sum "$1" | cut -d ' ' -f 1 || return 1
|
||||
}
|
||||
@ -121,6 +121,28 @@ setup() {
|
||||
pm_stop
|
||||
}
|
||||
|
||||
@test "should launch a Codex network and allow uploading and downloading" {
|
||||
pm_start
|
||||
|
||||
assert cdx_launch_network 5
|
||||
|
||||
filename=$(cdx_generate_file 10)
|
||||
cid=$(cdx_upload_file 0 "$filename")
|
||||
|
||||
handles=()
|
||||
for i in {1..4}; do
|
||||
handles+=($(cdx_download_file_async "$i" "$cid"))
|
||||
done
|
||||
|
||||
assert await_all "${handles[@]}"
|
||||
|
||||
for i in {1..4}; do
|
||||
assert cdx_check_download 0 "$i" "$cid"
|
||||
done
|
||||
|
||||
pm_stop
|
||||
}
|
||||
|
||||
teardown() {
|
||||
clh_clear_outputs
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user