Skip to content

Commit

Permalink
test: use chaintestutil (backport #296) (#299)
Browse files Browse the repository at this point in the history
* test: use `chaintestutil` (#296)

* rename

* fix

* format

* workflow

* add basic test

* add targetss

* use commit

* workflow

* basic setup

* add keeper

* fix

* fix?

* update

* update

* update

* fix

* fix

* go work inti

(cherry picked from commit b48073d)

# Conflicts:
#	.github/workflows/test.yml
#	Makefile
#	go.mod
#	go.sum
#	tests/e2e/go.mod
#	tests/e2e/go.sum
#	x/blocksdk/client/cli/query.go

* fix

---------

Co-authored-by: Alex Johnson <[email protected]>
  • Loading branch information
mergify[bot] and Alex Johnson authored Dec 13, 2023
1 parent abee981 commit ed1928e
Show file tree
Hide file tree
Showing 12 changed files with 463 additions and 191 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.20.2
go-version: 1.21.5
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.20.3
go-version: 1.21.5
- name: Unshallow
run: git fetch --prune --unshallow
- name: Create release
Expand Down
39 changes: 35 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ concurrency:
cancel-in-progress: true

jobs:
test:
test-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.21.5
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
Expand All @@ -34,7 +34,38 @@ jobs:
if: env.GIT_DIFF
run: |
go work init
make test
make test-unit
- name: Test Coverage
run: |
make test-cover
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: cover.out

test-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.5
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
- name: tests
if: env.GIT_DIFF
run: |
go work init
make test-integration
test-e2e:
runs-on: ubuntu-latest
Expand All @@ -50,7 +81,7 @@ jobs:
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: "1.21"
go-version: 1.21.5
cache: true

# In this step, this action saves a list of existing images, the cache is
Expand Down
23 changes: 13 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,15 @@ build-and-start-app: build-test-app
###############################################################################

use-main:
go work edit -use .
go work edit -dropuse ./tests/e2e
@go work edit -use .
@go work edit -dropuse ./tests/e2e

use-e2e:
go work edit -dropuse .
go work edit -use ./tests/e2e
@go work edit -dropuse .
@go work edit -use ./tests/e2e

tidy:
go mod tidy
gofmt -s -w ./
tidy: format
@go mod tidy

.PHONY: docker-build docker-build-e2e
###############################################################################
Expand All @@ -131,9 +130,12 @@ test-e2e: $(TEST_E2E_DEPS)
@ echo "Running e2e tests..."
@go test ./tests/e2e/block_sdk_e2e_test.go -timeout 30m -p 1 -race -v -tags='$(TEST_E2E_TAGS)'

test: use-main
test-unit: use-main
@go test -v -race $(shell go list ./... | grep -v tests/)

test-integration: tidy
@go test -v -race ./tests/integration

test-cover: tidy
@echo Running unit tests and creating coverage report...
@go test -mod=readonly -v -timeout 30m -coverprofile=$(COVER_FILE) -covermode=atomic $(shell go list ./... | grep -v tests/)
Expand All @@ -142,8 +144,9 @@ test-cover: tidy
@sed -i '/.proto/d' $(COVER_FILE)
@sed -i '/.pb.gw.go/d' $(COVER_FILE)

test-all: test-unit test-integration test-e2e

.PHONY: test test-e2e test-cover
.PHONY: test-unit test-integration test-e2e test-all test-cover

###############################################################################
### Protobuf ###
Expand Down Expand Up @@ -186,7 +189,7 @@ lint: use-main
@echo "--> Running linter"
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --out-format=tab

lint-fix: use-main
lint-fix:
@echo "--> Running linter"
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --fix --out-format=tab --issues-exit-code=0

Expand Down
65 changes: 33 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/skip-mev/block-sdk

go 1.21
go 1.21.5

require (
cosmossdk.io/api v0.7.2
Expand All @@ -15,24 +15,25 @@ require (
cosmossdk.io/x/circuit v0.1.0
cosmossdk.io/x/feegrant v0.1.0
cosmossdk.io/x/tx v0.12.0
cosmossdk.io/x/upgrade v0.1.0
cosmossdk.io/x/upgrade v0.1.1
github.com/client9/misspell v0.3.4
github.com/cometbft/cometbft v0.38.2
github.com/cosmos/cosmos-db v1.0.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.50.1
github.com/cosmos/cosmos-sdk v0.50.2
github.com/cosmos/gogoproto v1.4.11
github.com/golang/protobuf v1.5.3
github.com/golangci/golangci-lint v1.55.2
github.com/golangci/golangci-lint v1.55.3-0.20231203192459-84442f26446b
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/huandu/skiplist v1.2.0
github.com/skip-mev/chaintestutil v0.0.0-20231212161650-5a0fb41c56cc
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4
golang.org/x/tools v0.16.0
google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
mvdan.cc/gofumpt v0.5.0
Expand All @@ -41,10 +42,10 @@ require (
require (
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
4d63.com/gochecknoglobals v0.2.1 // indirect
cloud.google.com/go v0.110.8 // indirect
cloud.google.com/go/compute v1.23.1 // indirect
cloud.google.com/go v0.110.9 // indirect
cloud.google.com/go/compute v1.23.2 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.3 // indirect
cloud.google.com/go/iam v1.1.4 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
cosmossdk.io/collections v0.4.0 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
Expand All @@ -54,13 +55,14 @@ require (
github.com/Abirdcfly/dupword v0.0.13 // indirect
github.com/Antonboom/errname v0.1.12 // indirect
github.com/Antonboom/nilnil v0.1.7 // indirect
github.com/Antonboom/testifylint v0.2.3 // indirect
github.com/Antonboom/testifylint v1.0.2 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect
github.com/alecthomas/go-check-sumtype v0.1.3 // indirect
github.com/alexkohler/nakedret/v2 v2.0.2 // indirect
github.com/alexkohler/prealloc v1.0.0 // indirect
Expand All @@ -74,13 +76,13 @@ require (
github.com/bits-and-blooms/bitset v1.8.0 // indirect
github.com/bkielbasa/cyclop v1.2.1 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
github.com/bombsimon/wsl/v4 v4.2.0 // indirect
github.com/breml/bidichk v0.2.7 // indirect
github.com/breml/errchkjson v0.3.6 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/butuzov/ireturn v0.2.2 // indirect
github.com/butuzov/mirror v1.1.0 // indirect
github.com/catenacyber/perfsprint v0.2.0 // indirect
github.com/catenacyber/perfsprint v0.4.0 // indirect
github.com/ccojocar/zxcvbn-go v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
Expand All @@ -94,7 +96,7 @@ require (
github.com/cockroachdb/pebble v0.0.0-20231101195458-481da04154d6 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.7.0 // indirect
github.com/cometbft/cometbft-db v0.9.1 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
Expand All @@ -118,14 +120,14 @@ require (
github.com/emicklei/dot v1.6.0 // indirect
github.com/esimonov/ifshort v1.0.4 // indirect
github.com/ettle/strcase v0.1.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fatih/structtag v1.2.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/firefart/nonamedreturns v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fzipp/gocyclo v0.6.0 // indirect
github.com/getsentry/sentry-go v0.25.0 // indirect
github.com/ghostiam/protogetter v0.2.3 // indirect
github.com/ghostiam/protogetter v0.3.3 // indirect
github.com/go-critic/go-critic v0.9.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
Expand All @@ -143,7 +145,7 @@ require (
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
Expand All @@ -163,7 +165,7 @@ require (
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect
github.com/gordonklaus/ineffassign v0.1.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
Expand All @@ -174,10 +176,10 @@ require (
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.1 // indirect
github.com/hashicorp/go-getter v1.7.3 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.5.1 // indirect
github.com/hashicorp/go-metrics v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.5.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
Expand All @@ -190,7 +192,7 @@ require (
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jgautheron/goconst v1.6.0 // indirect
github.com/jgautheron/goconst v1.7.0 // indirect
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand All @@ -199,7 +201,7 @@ require (
github.com/kisielk/errcheck v1.6.3 // indirect
github.com/kisielk/gotool v1.0.0 // indirect
github.com/kkHAIKE/contextcheck v1.1.4 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/kulti/thelper v0.6.3 // indirect
Expand All @@ -210,7 +212,7 @@ require (
github.com/leonklingele/grouper v1.1.1 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.8.4 // indirect
github.com/linxGnu/grocksdb v1.8.6 // indirect
github.com/lufeee/execinquery v1.2.1 // indirect
github.com/macabu/inamedparam v0.1.2 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand All @@ -231,7 +233,7 @@ require (
github.com/moricho/tparallel v0.3.1 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/nakabonne/nestif v0.3.1 // indirect
github.com/nishanths/exhaustive v0.11.0 // indirect
github.com/nishanths/exhaustive v0.12.0 // indirect
github.com/nishanths/predeclared v0.2.2 // indirect
github.com/nunnatsa/ginkgolinter v0.14.1 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
Expand All @@ -241,7 +243,7 @@ require (
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polyfloyd/go-errorlint v1.4.5 // indirect
github.com/polyfloyd/go-errorlint v1.4.6 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
Expand Down Expand Up @@ -280,29 +282,28 @@ require (
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
github.com/tdakkota/asciicheck v0.2.0 // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tetafro/godot v1.4.15 // indirect
github.com/tetafro/godot v1.4.16 // indirect
github.com/tidwall/btree v1.7.0 // indirect
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect
github.com/timonwong/loggercheck v0.9.4 // indirect
github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/ultraware/funlen v0.1.0 // indirect
github.com/ultraware/whitespace v0.0.5 // indirect
github.com/ultraware/whitespace v0.1.0 // indirect
github.com/uudashr/gocognit v1.1.2 // indirect
github.com/xen0n/gosmopolitan v1.2.2 // indirect
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.2.0 // indirect
github.com/ykadowak/zerologlint v0.1.3 // indirect
github.com/ykadowak/zerologlint v0.1.5 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
gitlab.com/bosi/decorder v0.4.1 // indirect
go-simpler.org/sloglint v0.1.2 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go-simpler.org/musttag v0.8.0 // indirect
go-simpler.org/sloglint v0.3.0 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.opencensus.io v0.24.0 // indirect
go.tmz.dev/musttag v0.7.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.24.0 // indirect
Expand All @@ -319,7 +320,7 @@ require (
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.143.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit ed1928e

Please sign in to comment.