diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8044c63..49e5c40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,11 +8,11 @@ jobs: steps: - uses: actions/checkout@v2 - name: Setup Earthly - run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.23/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'" + run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.20/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'" - name: Test run: earthly --ci +test - name: Lint run: earthly --ci +lint - name: Integration - run: earthly -P --ci +integration + run: earthly -P --ci +integration-all diff --git a/Earthfile b/Earthfile index 648bae3..6c8cbd2 100644 --- a/Earthfile +++ b/Earthfile @@ -2,11 +2,13 @@ VERSION 0.6 FROM golang:1.19 WORKDIR /go/storj-up -lint: - WORKDIR /go/storj-up +lint-deps: RUN go install github.com/storj/ci/...@5286f52 RUN go install honnef.co/go/tools/cmd/staticcheck@2022.1.3 RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.3 + +lint: + FROM +lint-deps COPY . /go/storj-up RUN staticcheck ./... RUN golangci-lint --build-tags mage -j=2 run @@ -18,7 +20,19 @@ lint: RUN check-monkit ./... RUN check-mod-tidy +build-deps: + # Download deps before copying code. + COPY go.mod go.sum ./pkg/config/gen/go.mod ./pkg/config/gen/go.sum . + RUN go mod download + # Output these back in case go mod download changes them. + SAVE ARTIFACT go.mod AS LOCAL go.mod + SAVE ARTIFACT go.sum AS LOCAL go.sum + SAVE ARTIFACT ./pkg/config/gen/go.mod AS LOCAL ./pkg/config/gen/go.mod + SAVE ARTIFACT ./pkg/config/gen/go.sum AS LOCAL ./pkg/config/gen/go.sum + build: + FROM +build-deps + # Copy and build code. COPY . . RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg/mod \ @@ -40,22 +54,58 @@ test: ./scripts/test.sh SAVE ARTIFACT build/tests.json AS LOCAL build/tests.json -integration: - FROM earthly/dind:ubuntu - RUN apt-get update && apt-get install -y golang-go docker-compose-plugin gcc - ENV PATH=$PATH:/root/go/bin - COPY . . - WORKDIR /test - WITH DOCKER --pull img.dev.storj.io/storjup/storj:1.83.2 \ - --pull img.dev.storj.io/storjup/edge:1.58.1 \ - --pull cockroachdb/cockroach \ - --pull redis:6.0.9 \ - --pull img.dev.storj.io/storjup/storjscan:1.0.3 \ - --pull ethereum/client-go - RUN ./test.sh && \ - ./test-edge.sh && \ - ./test-storjscan.sh - END +integration-uplink: + FROM earthly/dind:ubuntu + WORKDIR /go/storj-up + COPY +build/storj-up . + RUN /go/storj-up/storj-up init minimal,db,uplink + COPY ./test/uplink/basic_upload_download.sh basic_upload_download.sh + WITH DOCKER --compose docker-compose.yaml + RUN docker compose exec -T -u 0 uplink bash -c 'storj-up health --host cockroach -d 90' && \ + docker compose exec -T -u 0 uplink bash -c 'storj-up credentials -s satellite-api:7777 -c satellite-api:10000 -e >> ~/.bashrc' && \ + < basic_upload_download.sh docker compose exec -T -u 0 uplink bash -i + END + +integration-edge: + FROM earthly/dind:ubuntu + WORKDIR /go/storj-up + COPY +build/storj-up . + RUN /go/storj-up/storj-up init minimal,edge,db,uplink && \ + /go/storj-up/storj-up image uplink img.dev.storj.io/dlm/storj:1 && \ + /go/storj-up/storj-up env set authservice STORJ_ENDPOINT=http://gateway-mt:9999 + COPY ./test/edge/basic_rclone.sh basic_rclone.sh + WITH DOCKER --compose docker-compose.yaml + RUN docker compose exec -T -u 0 uplink bash -c 'storj-up health --host cockroach -d 90' && \ + docker compose exec -T -u 0 uplink bash -c 'storj-up credentials -s satellite-api:7777 -c satellite-api:10000 -a http://authservice:8888 -e --s3 >> ~/.bashrc' && \ + < basic_rclone.sh docker compose exec -T -u 0 uplink bash -i + END + +integration-storjscan: + FROM earthly/dind:ubuntu + WORKDIR /go/storj-up + COPY +build/storj-up . + RUN /go/storj-up/storj-up init && \ + /go/storj-up/storj-up init minimal,satellite-core,edge,db,billing && \ + /go/storj-up/storj-up env setenv satellite-core STORJ_PAYMENTS_BILLING_CONFIG_INTERVAL=5s && \ + /go/storj-up/storj-up env setenv satellite-core STORJ_PAYMENTS_STORJSCAN_INTERVAL=5s && \ + /go/storj-up/storj-up env setenv satellite-core STORJ_PAYMENTS_STORJSCAN_CONFIRMATIONS=12 && \ + /go/storj-up/storj-up env setenv storjscan STORJ_TOKEN_PRICE_USE_TEST_PRICES=true && \ + /go/storj-up/storj-up image storjscan img.dev.storj.io/dlm/storjscan:1 + COPY ./test/storjscan/basic_storjscan.sh basic_storjscan.sh + WITH DOCKER --compose docker-compose.yaml + RUN docker compose exec -T -u 0 storjscan bash -c 'storj-up health --host cockroach -d 90' && \ + docker compose exec -T -u 0 storjscan bash -c 'storj-up credentials -s satellite-api:7777 -c satellite-api:10000 -a http://authservice:8888 -e >> ~/.bashrc' && \ + docker compose cp pk.json storjscan:/var/lib/storj/pk.json && \ + docker compose cp pass storjscan:/var/lib/storj/pass && \ + docker compose cp TestToken.abi storjscan:/var/lib/storj/TestToken.abi && \ + docker compose cp TestToken.bin storjscan:/var/lib/storj/TestToken.bin && \ + < basic_storjscan.sh docker compose exec -T -u 0 storjscan bash -i + END + +integration-all: + BUILD +integration-uplink + BUILD +integration-edge + BUILD +integration-storjscan check-format: COPY . . diff --git a/Jenkinsfile b/Jenkinsfile index 455abd1..fc06abf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ pipeline { agent { - label 'node4' + label('nomad || node4') } options { @@ -17,20 +17,43 @@ pipeline { checkout scm } } - stage('Lint') { - steps { - sh "earthly +lint" - } - } - stage('Test') { - steps { - sh "earthly +test" - } - } - stage('Integration') { - steps { - sh "earthly -P +integration" - } - } + stage('Lint') { + steps { + sh "earthly +lint" + } + } + stage('Test') { + steps { + sh "earthly +test" + } + } + stage('Integration') { + parallel { + stage('Uplink') { + steps { + withCredentials([usernamePassword(credentialsId: '67d52f80-1802-407a-a21a-ea24d4c28a83', passwordVariable: 'password', usernameVariable: 'username')]) { + sh 'docker login img.dev.storj.io -u $username -p $password' + } + sh "earthly -P +integration-uplink" + } + } + stage('Edge') { + steps { + withCredentials([usernamePassword(credentialsId: '67d52f80-1802-407a-a21a-ea24d4c28a83', passwordVariable: 'password', usernameVariable: 'username')]) { + sh 'docker login img.dev.storj.io -u $username -p $password' + } + sh "earthly -P +integration-edge" + } + } + stage('Storjscan') { + steps { + withCredentials([usernamePassword(credentialsId: '67d52f80-1802-407a-a21a-ea24d4c28a83', passwordVariable: 'password', usernameVariable: 'username')]) { + sh 'docker login img.dev.storj.io -u $username -p $password' + } + sh "earthly -P +integration-storjscan" + } + } + } + } } } diff --git a/pkg/files/docker/base.Dockerfile b/pkg/files/docker/base.Dockerfile index 226105a..3e23c53 100644 --- a/pkg/files/docker/base.Dockerfile +++ b/pkg/files/docker/base.Dockerfile @@ -7,7 +7,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ FROM --platform=$TARGETPLATFORM ubuntu:22.04 AS final RUN apt-get update -RUN apt-get -y install iproute2 ca-certificates +RUN apt-get -y install iproute2 ca-certificates curl jq unzip RUN useradd storj --uid 1000 -d /var/lib/storj && \ mkdir -p /var/lib/storj/shared && \ mkdir -p /var/lib/storj/go/bin && \ diff --git a/pkg/files/docker/storj.Dockerfile b/pkg/files/docker/storj.Dockerfile index 35ea2ad..ae42de3 100644 --- a/pkg/files/docker/storj.Dockerfile +++ b/pkg/files/docker/storj.Dockerfile @@ -42,7 +42,7 @@ RUN --mount=type=cache,target=/var/lib/storj/go/pkg/mod,mode=777,uid=1000 \ --mount=type=cache,target=/var/lib/storj/.cache/go-build,mode=777,uid=1000 \ go install ./cmd/... -FROM --platform=$TARGETPLATFORM img.dev.storj.io/storjup/base:20230825-1 AS final +FROM --platform=$TARGETPLATFORM img.dev.storj.io/storjup/base:20231005-1 AS final ENV STORJ_ADMIN_STATIC_DIR=/var/lib/storj/storj/satellite/admin/ui/build ENV STORJ_CONSOLE_STATIC_DIR=/var/lib/storj/storj/web/satellite/ ENV STORJ_MAIL_TEMPLATE_PATH=/var/lib/storj/storj/web/satellite/static/emails diff --git a/pkg/files/docker/storjscan.Dockerfile b/pkg/files/docker/storjscan.Dockerfile new file mode 100644 index 0000000..e59eccb --- /dev/null +++ b/pkg/files/docker/storjscan.Dockerfile @@ -0,0 +1,40 @@ +# syntax=docker/dockerfile:1.3 +ARG TYPE +ARG SOURCE +FROM --platform=$TARGETPLATFORM img.dev.storj.io/storjup/build:20230616-1 AS base + +FROM base AS commit +ARG BRANCH +ARG COMMIT +RUN git clone https://github.com/storj/storjscan.git --branch ${BRANCH} +RUN cd storjscan && git reset --hard ${COMMIT} +WORKDIR storjscan + +FROM base AS branch +ARG BRANCH +RUN git clone https://github.com/storj/storjscan.git --depth=1 --branch ${BRANCH} +WORKDIR storjscan + +FROM ${SOURCE} AS github + +FROM base AS gerrit +ARG REF +RUN git clone https://github.com/storj/storjscan.git +WORKDIR storjscan +RUN git fetch https://review.dev.storj.io/storj/storjscan ${REF} && git checkout FETCH_HEAD + +FROM base AS local +ARG PATH +WORKDIR /var/lib/storj/storjscan +COPY --chown=storj ${PATH} . + +FROM --platform=$TARGETPLATFORM ${TYPE} AS binaries +RUN --mount=type=cache,target=/var/lib/storj/go/pkg/mod,mode=777,uid=1000 \ + --mount=type=cache,target=/var/lib/storj/.cache/go-build,mode=777,uid=1000 \ + go install ./cmd/... +RUN go install github.com/elek/cethacea@main + +FROM img.dev.storj.io/storjup/base:20231005-1 AS final +COPY --from=binaries /var/lib/storj/go/bin /var/lib/storj/go/bin + + diff --git a/pkg/recipe/billing.yaml b/pkg/recipe/billing.yaml index ab1e3da..804a3f0 100644 --- a/pkg/recipe/billing.yaml +++ b/pkg/recipe/billing.yaml @@ -37,8 +37,6 @@ add: - --ws.addr=0.0.0.0 - --http.corsdomain - "*" - persistence: - - /tmp/blockchain file: - name: pk.json data: |- @@ -52,8 +50,6 @@ add: - name: TestToken.bin data: |- 60806040523480156200001157600080fd5b5060405162001b3738038062001b37833981810160405281019062000037919062000396565b6040518060400160405280600981526020017f54657374546f6b656e00000000000000000000000000000000000000000000008152506040518060400160405280600281526020017f54540000000000000000000000000000000000000000000000000000000000008152508160039080519060200190620000bb929190620002a6565b508060049080519060200190620000d4929190620002a6565b5050506200011333620000ec6200011a60201b60201c565b600a620000fa919062000558565b83620001079190620005a9565b6200012360201b60201c565b506200077d565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141562000196576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200018d906200066b565b60405180910390fd5b620001aa600083836200029c60201b60201c565b8060026000828254620001be91906200068d565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546200021591906200068d565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200027c9190620006fb565b60405180910390a36200029860008383620002a160201b60201c565b5050565b505050565b505050565b828054620002b49062000747565b90600052602060002090601f016020900481019282620002d8576000855562000324565b82601f10620002f357805160ff191683800117855562000324565b8280016001018555821562000324579182015b828111156200032357825182559160200191906001019062000306565b5b50905062000333919062000337565b5090565b5b808211156200035257600081600090555060010162000338565b5090565b600080fd5b6000819050919050565b62000370816200035b565b81146200037c57600080fd5b50565b600081519050620003908162000365565b92915050565b600060208284031215620003af57620003ae62000356565b5b6000620003bf848285016200037f565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b600185111562000456578086048111156200042e576200042d620003c8565b5b60018516156200043e5780820291505b80810290506200044e85620003f7565b94506200040e565b94509492505050565b60008262000471576001905062000544565b8162000481576000905062000544565b81600181146200049a5760028114620004a557620004db565b600191505062000544565b60ff841115620004ba57620004b9620003c8565b5b8360020a915084821115620004d457620004d3620003c8565b5b5062000544565b5060208310610133831016604e8410600b8410161715620005155782820a9050838111156200050f576200050e620003c8565b5b62000544565b62000524848484600162000404565b925090508184048111156200053e576200053d620003c8565b5b81810290505b9392505050565b600060ff82169050919050565b600062000565826200035b565b915062000572836200054b565b9250620005a17fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846200045f565b905092915050565b6000620005b6826200035b565b9150620005c3836200035b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615620005ff57620005fe620003c8565b5b828202905092915050565b600082825260208201905092915050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b600062000653601f836200060a565b915062000660826200061b565b602082019050919050565b60006020820190508181036000830152620006868162000644565b9050919050565b60006200069a826200035b565b9150620006a7836200035b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115620006df57620006de620003c8565b5b828201905092915050565b620006f5816200035b565b82525050565b6000602082019050620007126000830184620006ea565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200076057607f821691505b6020821081141562000777576200077662000718565b5b50919050565b6113aa806200078d6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610c3e565b60405180910390f35b6100e660048036038101906100e19190610cf9565b610308565b6040516100f39190610d54565b60405180910390f35b610104610326565b6040516101119190610d7e565b60405180910390f35b610134600480360381019061012f9190610d99565b610330565b6040516101419190610d54565b60405180910390f35b610152610428565b60405161015f9190610e08565b60405180910390f35b610182600480360381019061017d9190610cf9565b610431565b60405161018f9190610d54565b60405180910390f35b6101b260048036038101906101ad9190610e23565b6104dd565b6040516101bf9190610d7e565b60405180910390f35b6101d0610525565b6040516101dd9190610c3e565b60405180910390f35b61020060048036038101906101fb9190610cf9565b6105b7565b60405161020d9190610d54565b60405180910390f35b610230600480360381019061022b9190610cf9565b6106a2565b60405161023d9190610d54565b60405180910390f35b610260600480360381019061025b9190610e50565b6106c0565b60405161026d9190610d7e565b60405180910390f35b60606003805461028590610ebf565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610ebf565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610747565b848461074f565b6001905092915050565b6000600254905090565b600061033d84848461091a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610f63565b60405180910390fd5b61041c85610414610747565b85840361074f565b60019150509392505050565b60006012905090565b60006104d361043e610747565b84846001600061044c610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104ce9190610fb2565b61074f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053490610ebf565b80601f016020809104026020016040519081016040528092919081815260200182805461056090610ebf565b80156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b5050505050905090565b600080600160006105c6610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067a9061107a565b60405180910390fd5b61069761068e610747565b8585840361074f565b600191505092915050565b60006106b66106af610747565b848461091a565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b69061110c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561082f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108269061119e565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161090d9190610d7e565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098190611230565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f1906112c2565b60405180910390fd5b610a05838383610b9b565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8290611354565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e9190610fb2565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b829190610d7e565b60405180910390a3610b95848484610ba0565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610bdf578082015181840152602081019050610bc4565b83811115610bee576000848401525b50505050565b6000601f19601f8301169050919050565b6000610c1082610ba5565b610c1a8185610bb0565b9350610c2a818560208601610bc1565b610c3381610bf4565b840191505092915050565b60006020820190508181036000830152610c588184610c05565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c9082610c65565b9050919050565b610ca081610c85565b8114610cab57600080fd5b50565b600081359050610cbd81610c97565b92915050565b6000819050919050565b610cd681610cc3565b8114610ce157600080fd5b50565b600081359050610cf381610ccd565b92915050565b60008060408385031215610d1057610d0f610c60565b5b6000610d1e85828601610cae565b9250506020610d2f85828601610ce4565b9150509250929050565b60008115159050919050565b610d4e81610d39565b82525050565b6000602082019050610d696000830184610d45565b92915050565b610d7881610cc3565b82525050565b6000602082019050610d936000830184610d6f565b92915050565b600080600060608486031215610db257610db1610c60565b5b6000610dc086828701610cae565b9350506020610dd186828701610cae565b9250506040610de286828701610ce4565b9150509250925092565b600060ff82169050919050565b610e0281610dec565b82525050565b6000602082019050610e1d6000830184610df9565b92915050565b600060208284031215610e3957610e38610c60565b5b6000610e4784828501610cae565b91505092915050565b60008060408385031215610e6757610e66610c60565b5b6000610e7585828601610cae565b9250506020610e8685828601610cae565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610ed757607f821691505b60208210811415610eeb57610eea610e90565b5b50919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b6000610f4d602883610bb0565b9150610f5882610ef1565b604082019050919050565b60006020820190508181036000830152610f7c81610f40565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610fbd82610cc3565b9150610fc883610cc3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610ffd57610ffc610f83565b5b828201905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000611064602583610bb0565b915061106f82611008565b604082019050919050565b6000602082019050818103600083015261109381611057565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006110f6602483610bb0565b91506111018261109a565b604082019050919050565b60006020820190508181036000830152611125816110e9565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611188602283610bb0565b91506111938261112c565b604082019050919050565b600060208201905081810360008301526111b78161117b565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061121a602583610bb0565b9150611225826111be565b604082019050919050565b600060208201905081810360008301526112498161120d565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006112ac602383610bb0565b91506112b782611250565b604082019050919050565b600060208201905081810360008301526112db8161129f565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b600061133e602683610bb0565b9150611349826112e2565b604082019050919050565b6000602082019050818103600083015261136d81611331565b905091905056fea2646970667358221220cbdb13029d93c4cbb8dcc933d111eaebe30aebbcfcf83b28c76005cde185b38a64736f6c634300080c0033 - folder: - - name: ./blockchain port: - name: rpc1 target: 8545 diff --git a/test/test-pay-invoice.sh b/test/billing/test-pay-invoice.sh old mode 100755 new mode 100644 similarity index 100% rename from test/test-pay-invoice.sh rename to test/billing/test-pay-invoice.sh diff --git a/test/edge/basic_rclone.sh b/test/edge/basic_rclone.sh new file mode 100755 index 0000000..4501308 --- /dev/null +++ b/test/edge/basic_rclone.sh @@ -0,0 +1,16 @@ +dd if=/dev/random of=data count=10240 bs=1024 +sha256sum data > sha256.sum + +curl https://rclone.org/install.sh | bash +# shellcheck disable=SC2086 +rclone config create storjdevs3 s3 env_auth true provider Minio access_key_id $AWS_ACCESS_KEY_ID secret_access_key "$AWS_SECRET_ACCESS_KEY" endpoint "$STORJ_GATEWAY" chunk_size 64M upload_cutoff 64M + +BUCKET=bucket$RANDOM +rclone mkdir storjdevs3:$BUCKET +rclone copy data storjdevs3:$BUCKET/data +sha256sum -c sha256.sum + +rm data +rclone copy storjdevs3:$BUCKET/data download +mv download/data ./ +sha256sum -c sha256.sum \ No newline at end of file diff --git a/test/storjscan/basic_storjscan.sh b/test/storjscan/basic_storjscan.sh new file mode 100755 index 0000000..b9091f2 --- /dev/null +++ b/test/storjscan/basic_storjscan.sh @@ -0,0 +1,34 @@ +set -xueo pipefail + +export CETH_CHAIN=http://geth:8545 +export CETH_ACCOUNT=2e9a0761ce9815b95b2389634f6af66abe5fec2b1e04b772728442b4c35ea365 +export CETH_CONTRACT=$(cethacea contract deploy --quiet --name TOKEN TestToken.bin --abi TestToken.abi '(uint256)' 1000000000000) + +curl -X GET -u "eu1:eu1secret" http://127.0.0.1:12000/api/v0/auth/whoami +curl -X GET -u "us1:us1secret" http://127.0.0.1:12000/api/v0/auth/whoami + +storjscan mnemonic >.mnemonic +storjscan generate >.wallets +storjscan import --input-file .wallets --api-key us1 --api-secret us1secret --address http://127.0.0.1:12000 +storjscan mnemonic >.mnemonic +storjscan generate >.wallets +storjscan import --input-file .wallets --api-key eu1 --api-secret eu1secret --address http://127.0.0.1:12000 +rm -rf .mnemonic .wallets + +curl -X POST 'http://satellite-api:10000/api/v0/payments/wallet' --header "Cookie: _tokenKey=$_tokenKey" +ADDRESS=$(curl -X GET -s http://satellite-api:10000/api/v0/payments/wallet --header "Cookie: _tokenKey=$_tokenKey" | jq -r '.address') + +#ACCOUNT is defined with environment variables above +for i in {1..15}; do cethacea token transfer 1000 "$ADDRESS" && sleep 1; done +storj-up health --host cockroach -t billing_transactions -n 6 -d 12 + +RESPONSE=$(curl -X GET http://satellite-api:10000/api/v0/payments/wallet/payments --header "Cookie: _tokenKey=$_tokenKey") +STATUS=$(echo "$RESPONSE" | jq -r '.payments[-4].Status') +STATUS_BONUS=$(echo "$RESPONSE" | jq -r '.payments[-1].Status') + +if [ "${STATUS_BONUS}" != 'complete' ] || [ "${STATUS}" != 'confirmed' ]; then + echo "Test FAILED. Payment status: ${STATUS} Payment bonus status: ${STATUS_BONUS}" + exit 1 +else + echo "Test PASSED." +fi diff --git a/test/test-reorg.sh b/test/storjscan/reorg_storjscan.sh similarity index 98% rename from test/test-reorg.sh rename to test/storjscan/reorg_storjscan.sh index 217d1c9..07a0e03 100755 --- a/test/test-reorg.sh +++ b/test/storjscan/reorg_storjscan.sh @@ -22,14 +22,14 @@ cleanup() { } trap cleanup EXIT -go install storj.io/storj-up +go install storj.io/storj-up@main if [ ! "$(which storjscan )" ]; then go install storj.io/storjscan/cmd/storjscan@latest fi if [ ! "$(which cethacea)" ]; then - go install github.com/elek/cethacea@latest + go install github.com/elek/cethacea@main fi export STORJUP_NO_HISTORY=true diff --git a/test/test-storjscan.sh b/test/storjscan/test-storjscan-bak.sh similarity index 100% rename from test/test-storjscan.sh rename to test/storjscan/test-storjscan-bak.sh diff --git a/test/test-edge.sh b/test/test-edge.sh deleted file mode 100755 index 94b64e4..0000000 --- a/test/test-edge.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/bash -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" - -set -ex - -cleanup() { - if [ -f "docker-compose.yaml" ] - then - docker compose down - fi - rm -rf data download sha256.sum - rm -rf docker-compose.yaml -} - -trap cleanup EXIT - -go install -C ../ - -export STORJUP_NO_HISTORY=true - -storj-up init minimal,edge,db,uplink - -docker compose down -v -docker compose up -d - -storj-up health -d 90 - -docker compose exec -T -u 0 uplink bash <<-'EOF' - - dd if=/dev/random of=data count=10240 bs=1024 - sha256sum data > sha256.sum - - eval $(storj-up credentials -s satellite-api:7777 -c satellite-api:10000 -a http://authservice:8888 -e --s3) - #todo: add curl and unzip to base image - apt-get update - apt-get -y install curl unzip - curl https://rclone.org/install.sh | bash - rclone config create storjdevs3 s3 env_auth true provider Minio access_key_id $AWS_ACCESS_KEY_ID secret_access_key $AWS_SECRET_ACCESS_KEY endpoint http://gateway-mt:9999 chunk_size 64M upload_cutoff 64M - - BUCKET=bucket$RANDOM - rclone mkdir storjdevs3:$BUCKET - rclone copy data storjdevs3:$BUCKET/data - sha256sum -c sha256.sum - - rm data - rclone copy storjdevs3:$BUCKET/data download - mv download/data ./ - sha256sum -c sha256.sum - -EOF diff --git a/test/test.sh b/test/test.sh deleted file mode 100755 index 616070c..0000000 --- a/test/test.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" - -set -ex - -cleanup() { - if [ -f "docker-compose.yaml" ] - then - docker compose down - fi - rm -rf data sha256.sum - rm -rf docker-compose.yaml -} - -trap cleanup EXIT - -go install -C ../ - -export STORJUP_NO_HISTORY=true - -storj-up init minimal,db,uplink - -docker compose down -v -docker compose up -d - -storj-up health -d 90 - -docker compose exec -T uplink bash <<-'EOF' - - dd if=/dev/random of=data count=10240 bs=1024 - sha256sum data > sha256.sum - - eval $(storj-up credentials -s satellite-api:7777 -c satellite-api:10000 -e) - - BUCKET=bucket$RANDOM - uplink --interactive=false mb sj://$BUCKET - uplink --interactive=false cp data sj://$BUCKET/data - - rm data - uplink --interactive=false cp sj://$BUCKET/data data - sha256sum -c sha256.sum - -EOF diff --git a/test/uplink/basic_upload_download.sh b/test/uplink/basic_upload_download.sh new file mode 100755 index 0000000..a9f0809 --- /dev/null +++ b/test/uplink/basic_upload_download.sh @@ -0,0 +1,10 @@ +dd if=/dev/random of=data count=10240 bs=1024 +sha256sum data > sha256.sum + +BUCKET=buckett$RANDOM +uplink --interactive=false mb sj://$BUCKET +uplink --interactive=false cp data sj://$BUCKET/data + +rm data +uplink --interactive=false cp sj://$BUCKET/data data +sha256sum -c sha256.sum \ No newline at end of file