Skip to content

Commit

Permalink
Run Keep Client integration tests in CI (#3589)
Browse files Browse the repository at this point in the history
We add Keep Client's integration tests execution to the CI process. The
tests will be executed after the client build and unit tests pass.

Please note that with the current configuration, the integration tests
running command will execute also unit tests. To change this behavior we
will need to add `//go:build !integration` to all the non-integration
test files. (see: #3592)
  • Loading branch information
michalinacienciala authored May 31, 2023
2 parents 45e797f + 01fbbcc commit bfb505f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,23 @@ jobs:
cache-to: type=local,dest=/tmp/.buildx-cache-new
context: .

# Since build-push-action doesn't support outputing an image to multiple outputs
# we need to save it in a separate step. See: https://github.com/moby/buildkit/issues/1555
# Once multiple outputs are supported we can replace this step with
# `outputs` property configured in `Build Docker Build Image`:
# outputs: |
# type=image
# type=docker,dest=/tmp/go-build-env-image.tar
- name: Save Docker Build Image
run: |
docker save --output /tmp/go-build-env-image.tar go-build-env
- name: Upload Docker Build Image
uses: actions/upload-artifact@v3
with:
name: go-build-env-image
path: /tmp/go-build-env-image.tar

- name: Run Go tests
run: |
docker run \
Expand Down Expand Up @@ -263,3 +280,27 @@ jobs:
with:
version: "2022.1.3"
install-go: false

client-integration-test:
needs: client-build-test-publish
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Download Docker Build Image
uses: actions/download-artifact@v3
with:
name: go-build-env-image
path: /tmp

- name: Load Docker Build Image
run: |
docker load --input /tmp/go-build-env-image.tar
- name: Run Go Integration Tests
run: |
docker run \
--workdir /go/src/github.com/keep-network/keep-core \
go-build-env \
gotestsum -- -tags=integration ./...
10 changes: 5 additions & 5 deletions pkg/bitcoin/electrum/electrum_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ var testConfigs = map[string]testConfig{
"electrs-esplora tcp": {
clientConfig: Config{
URL: "tcp://electrum.blockstream.info:60001",
RequestTimeout: timeout,
RequestRetryTimeout: timeout * 5,
RequestTimeout: timeout * 3,
RequestRetryTimeout: timeout * 10,
},
errorMessages: expectedErrorMessages{
missingTransaction: "errNo: 0, errMsg: missing transaction",
Expand All @@ -61,8 +61,8 @@ var testConfigs = map[string]testConfig{
"electrs-esplora ssl": {
clientConfig: Config{
URL: "ssl://electrum.blockstream.info:60002",
RequestTimeout: timeout,
RequestRetryTimeout: timeout * 5,
RequestTimeout: timeout * 3,
RequestRetryTimeout: timeout * 10,
},
errorMessages: expectedErrorMessages{
missingTransaction: "errNo: 0, errMsg: missing transaction",
Expand All @@ -89,7 +89,7 @@ var testConfigs = map[string]testConfig{
RequestRetryTimeout: timeout * 2,
},
errorMessages: expectedErrorMessages{
missingTransaction: "errNo: 2, errMsg: daemon error: DaemonError({'message': 'Transaction not found.', 'code': -1})",
missingTransaction: "errNo: 2, errMsg: daemon error: DaemonError({'code': -5, 'message': 'No such mempool or blockchain transaction. Use gettransaction for wallet transactions.'})",
missingBlockHeader: "errNo: 1, errMsg: height 4,294,967,295 out of range",
missingTransactionInBlock: "errNo: 1, errMsg: tx aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa not in block at height 123,456",
},
Expand Down

0 comments on commit bfb505f

Please sign in to comment.