Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run integration tests as part of CI #111

Merged
merged 12 commits into from
Sep 6, 2023
30 changes: 29 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
- main
workflow_dispatch:

name: Test
name: Tests
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -25,3 +25,31 @@ jobs:
run: |
go test ./... -covermode=count -coverprofile=coverage.out
go tool cover -func=coverage.out -o=coverage.out

integration-tests:
name: integration tests
# Run on older Ubuntu version because of older LibSSL dependency.
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

- name: Set up Go 1.21.0
uses: actions/setup-go@v2
with:
go-version: "1.21.0"

- name: Install Blockless Runtime
run: |
mkdir -p /tmp/blockless-runtime
curl -L -o runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.3.1/blockless-runtime.ubuntu-20.04.x86_64.tar.gz
tar xzf runtime.tar.gz -C /tmp/blockless-runtime
rm runtime.tar.gz

- name: Run integration tests
run: |
export B7S_INTEG_RUNTIME_DIR=/tmp/blockless-runtime
go test --tags=integration ./...
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ clean:
setup:
@echo "\n📥 Downloading and extracting runtime...\n"
mkdir -p /tmp/runtime
wget -O /tmp/blockless-runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.0.12/blockless-runtime.linux-latest.x86_64.tar.gz
wget -O /tmp/blockless-runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.3.1/blockless-runtime.linux-latest.x86_64.tar.gz
tar -xzf /tmp/blockless-runtime.tar.gz -C /tmp/runtime
@echo "\n✅ Done.\n"
2 changes: 1 addition & 1 deletion cmd/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Database used to persist Node data between runs will be created in the `peer-dat
On the other hand, Node will persist function data in the default database, in the `function-db` subdirectory.

Blockless Runtime path is given as `~/.local/bin`.
At startup, node will check if the Blockless Runtime is actually found there, namely the [blockless-cli](https://blockless.network/docs/cli).
At startup, node will check if the Blockless Runtime is actually found there, namely the [bls-runtime](https://blockless.network/docs/protocol/runtime).

Node Identity will be determined by the private key found in `priv.bin` file in the `keys` subdirectory.

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN curl -o ./gomplate -sSL https://github.com/hairyhenderson/gomplate/releases/
RUN chmod 755 gomplate

# get the runtime
RUN curl -o ./runtime.tar.gz -sSL https://github.com/blocklessnetwork/runtime/releases/download/v0.0.13/blockless-runtime.ubuntu-20.04.x86_64.tar.gz
RUN curl -o ./runtime.tar.gz -sSL https://github.com/blocklessnetwork/runtime/releases/download/v0.3.1/blockless-runtime.ubuntu-20.04.x86_64.tar.gz
RUN mkdir /app/runtime && tar -xvkf ./runtime.tar.gz -C /app/runtime

# install blockchain client
Expand Down
2 changes: 1 addition & 1 deletion docker/integration-tests/Dockerfile.testing
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin

# get the runtime
RUN curl -o ./runtime.tar.gz -sSL https://github.com/blocklessnetwork/runtime/releases/download/v0.0.12/blockless-runtime.linux-latest.x86_64.tar.gz
RUN curl -o ./runtime.tar.gz -sSL https://github.com/blocklessnetwork/runtime/releases/download/v0.3.1/blockless-runtime.linux-latest.x86_64.tar.gz
RUN mkdir /app/runtime && tar -xvkf ./runtime.tar.gz -C /app/runtime


Expand Down
3 changes: 1 addition & 2 deletions executor/execute_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ func (e *Executor) ExecuteFunction(requestID string, req execute.Request) (execu
}

// executeFunction handles the actual execution of the Blockless function. It returns the
// standard output of the blockless-cli that handled the execution. `Function`
// typically takes this output and uses it to create the appropriate execution response.
// execution information like standard output, standard error, exit code and resource usage.
func (e *Executor) executeFunction(requestID string, req execute.Request) (execute.RuntimeOutput, execute.Usage, error) {

log := e.log.With().Str("request", requestID).Str("function", req.FunctionID).Logger()
Expand Down
2 changes: 1 addition & 1 deletion models/blockless/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

const (
runtimeCLI = "blockless-cli"
runtimeCLI = "bls-runtime"
)

// RuntimeCLI returns the name of the Blockless Runtime executable.
Expand Down