mirror of
https://github.com/rclone/rclone.git
synced 2025-02-22 03:33:09 +08:00
sia: setup docker with sia-antfarm for test #4514
Always pull the latest Sia Antfarm docker image Add wait for Sia renter to become upload ready Co-authored-by: Filip Rysavy <fil@siasky.net>
This commit is contained in:
parent
3351b1e6ae
commit
0d1e017e09
@ -4,8 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/rclone/rclone/fs/config"
|
|
||||||
"github.com/rclone/rclone/lib/encoder"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -13,6 +11,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/rclone/rclone/fs/config"
|
||||||
|
"github.com/rclone/rclone/lib/encoder"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/rclone/rclone/backend/sia/api"
|
"github.com/rclone/rclone/backend/sia/api"
|
||||||
"github.com/rclone/rclone/fs"
|
"github.com/rclone/rclone/fs"
|
||||||
|
45
fstest/testserver/init.d/TestSia
Executable file
45
fstest/testserver/init.d/TestSia
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NAME=Sia
|
||||||
|
|
||||||
|
. $(dirname "$0")/docker.bash
|
||||||
|
|
||||||
|
start() {
|
||||||
|
docker run --rm -d --name $NAME \
|
||||||
|
--publish 127.0.0.1:9980:9980 \
|
||||||
|
nebulouslabs/siaantfarm
|
||||||
|
|
||||||
|
# pull latest remote image (do not use latest local image)
|
||||||
|
docker pull nebulouslabs/siaantfarm:latest
|
||||||
|
|
||||||
|
# start antfarm with the default config
|
||||||
|
docker run --rm -d --name "$NAME" \
|
||||||
|
-p "${SIA_CONN}:${SIA_PORT}" \
|
||||||
|
nebulouslabs/siaantfarm:latest
|
||||||
|
|
||||||
|
# wait until Sia test network is up, the Sia renter forms contracts on the
|
||||||
|
# blockchain and the renter is upload ready
|
||||||
|
until wget --user-agent="Sia-Agent" -q -O - "${SIA_CONN}/renter/uploadready" | grep '"ready":true'
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# confirm backend type in the generated rclone.conf
|
||||||
|
echo "type=sia"
|
||||||
|
# override keys in the Sia section of generated rclone.conf
|
||||||
|
echo "api_url=http://${SIA_CONN}/"
|
||||||
|
# hint test harness where to probe for connection
|
||||||
|
echo "_connect=${SIA_CONN}"
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
if status ; then
|
||||||
|
docker logs "$NAME" >> sia-test.log 2>&1
|
||||||
|
docker kill "$NAME"
|
||||||
|
echo "${NAME} stopped"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
. $(dirname "$0")/run.bash
|
Loading…
x
Reference in New Issue
Block a user