Skip to content

Commit 3e897d2

Browse files
2xburntclaude
andauthored
Chore/release v22 tests (#410)
This pull request introduces significant improvements to the project's developer workflow and test coverage. The most important changes are the addition of comprehensive unit tests for the ante and post handler constructors, a major overhaul of the `README.md` to better document the Makefile targets and development process, and minor dependency import updates. These changes collectively enhance reliability, maintainability, and ease of onboarding for new contributors. **Testing improvements:** * Added exhaustive unit tests in `app/ante_test.go` to validate error handling and coverage for `NewAnteHandler` and `NewPostHandler`, ensuring all configuration errors are caught and all code paths are exercised for 100% coverage. **Documentation and developer workflow:** * Revamped the `README.md` to provide detailed documentation of Makefile targets, modular organization, prerequisites, and example workflows, making it easier for developers to understand and use the build and test system. * Updated the pre-commit hook in `.husky/hooks/pre-commit` to use `make test-cover` for consistency with the new Makefile-based workflow. **Dependency management:** * Added missing imports in `app/app_test.go` to support new testing and API features, improving test reliability and code clarity. --------- Co-authored-by: Claude <[email protected]>
1 parent 3db9b67 commit 3e897d2

39 files changed

+3819
-623
lines changed

.husky/hooks/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
./scripts/test-coverage.sh
2+
make test-cover

Makefile

Lines changed: 48 additions & 376 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 151 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -7,153 +7,202 @@ compatibility with the latest cosmos-sdk and CosmWasm releases.
77
## Table of Contents
88

99
- [Prerequisites](#prerequisites)
10-
- [Installation](#installation)
11-
- [Build](#build)
12-
- [Testing Prerequisites](#testing-prerequisites)
13-
- [Testing](#testing)
14-
- [Tools & Dependencies](#tools--dependencies)
15-
- [Linting](#linting)
16-
- [Protobuf](#protobuf)
17-
- [Cleaning](#cleaning)
10+
- [Quick Start](#quick-start)
11+
- [Build Targets](#build-targets)
12+
- [Test Targets](#test-targets)
13+
- [Coverage Targets](#coverage-targets)
14+
- [Protobuf Targets](#protobuf-targets)
15+
- [Linting Targets](#linting-targets)
16+
- [Development Targets](#development-targets)
17+
- [Utility Targets](#utility-targets)
18+
- [Help](#help)
1819

1920
## Prerequisites
2021

21-
- [golang](https://golang.org)
22+
- [golang](https://golang.org) - Go programming language
23+
- [docker](https://docs.docker.com/get-docker/) - Required for protobuf generation and some build targets
24+
- [heighliner](https://github.com/strangelove-ventures/heighliner) - Required for integration testing
2225

23-
## Installation
26+
## Quick Start
2427

25-
To build locally and install the `xiond` binary:
26-
27-
```sh
28+
```bash
29+
# Build and install xiond
2830
make install
29-
```
30-
31-
To install a prebuilt package via homebrew/apt/yum/apk see [INSTALLERS.md](INSTALLERS.md)
3231

33-
## Build
32+
# Run tests with coverage
33+
make test-cover
3434

35-
To build the project:
36-
37-
```sh
38-
make build
35+
# Get help
36+
make help
3937
```
4038

41-
## Testing Prerequisites
42-
43-
- [golang](https://golang.org)
44-
- [docker](https://docs.docker.com/get-docker/)
45-
- [heighliner](https://github.com/strangelove-ventures/heighliner)
46-
47-
## Testing
48-
49-
There are various test targets available:
50-
51-
- `make test` - Run unit tests
52-
- `make test-all` - Run all tests including unit, race, and coverage
53-
- `make test-unit` - Run unit tests
54-
- `make test-integration` - Run integration tests
55-
- `make test-race` - Run tests with race condition detection
56-
- `make test-cover` - Run tests with coverage
57-
- `make benchmark` - Run benchmarks
58-
59-
## Specific Integration Tests
60-
61-
You can run specific integration tests by using the following commands:
62-
63-
```sh
64-
make test-integration-dungeon-transfer-block
65-
make test-integration-mint-module-no-inflation-no-fees
39+
## Build Targets
40+
41+
| Target | Description |
42+
|--------|-------------|
43+
| `make install` | Install the xiond binary |
44+
| `make build` | Build the xiond binary |
45+
| `make build-all` | Build all platforms using Docker |
46+
| `make build-local` | Build for local platform using Docker |
47+
| `make build-linux-amd64` | Build for Linux AMD64 |
48+
| `make build-linux-arm64` | Build for Linux ARM64 |
49+
| `make build-darwin-amd64` | Build for Darwin AMD64 |
50+
| `make build-darwin-arm64` | Build for Darwin ARM64 |
51+
| `make build-windows-amd64` | Build for Windows AMD64 |
52+
| `make build-docker` | Build Docker image |
53+
| `make build-heighliner` | Build using Heighliner |
54+
| `make release-snapshot` | Create release snapshot |
55+
| `make release` | Create production release |
56+
57+
## Test Targets
58+
59+
| Target | Description |
60+
|--------|-------------|
61+
| `make test` | Run unit tests |
62+
| `make test-unit` | Run unit tests |
63+
| `make test-race` | Run tests with race detection |
64+
| `make test-integration` | Run integration tests |
65+
| `make compile-integration-tests` | Compile integration test binary |
66+
| `make run-integration-test` | Run specific integration test |
67+
| `make test-sim` | Run simulation tests |
68+
| `make test-sim-import-export` | Run simulation import/export tests |
69+
| `make test-sim-multi-seed-short` | Run multi-seed simulation tests |
70+
| `make test-sim-deterministic` | Run deterministic simulation tests |
71+
72+
### Specific Integration Tests
73+
74+
```bash
75+
make test-integration-min-fee
6676
make test-integration-mint-module-inflation-high-fees
6777
make test-integration-mint-module-inflation-low-fees
68-
make test-integration-jwt-abstract-account
78+
make test-integration-mint-module-inflation-no-fees
79+
make test-integration-mint-module-no-inflation-no-fees
6980
make test-integration-register-jwt-abstract-account
70-
make test-integration-xion-send-platform-fee
81+
make test-integration-simulate
82+
make test-integration-single-aa-mig
83+
make test-integration-treasury-contract
84+
make test-integration-treasury-multi
85+
make test-integration-upgrade-ibc
86+
make test-integration-upgrade-network
87+
make test-integration-web-auth-n-abstract-account
7188
make test-integration-xion-abstract-account
89+
make test-integration-xion-abstract-account-event
7290
make test-integration-xion-min-default
91+
make test-integration-xion-min-multi-denom
92+
make test-integration-xion-min-multi-denom-ibc
7393
make test-integration-xion-min-zero
94+
make test-integration-xion-send-platform-fee
7495
make test-integration-xion-token-factory
7596
make test-integration-xion-treasury-grants
76-
make test-integration-min
77-
make test-integration-web-auth-n-abstract-account
78-
make test-integration-upgrade
79-
make test-integration-upgrade-network
80-
make test-integration-xion-mig
97+
make test-integration-xion-update-treasury-configs
98+
make test-integration-xion-update-treasury-configs-aa
99+
make test-integration-xion-update-treasury-params
81100
```
82101

83-
## Tools & Dependencies
102+
## Coverage Targets
84103

85-
To ensure all Go modules are downloaded:
104+
| Target | Description |
105+
|--------|-------------|
106+
| `make test-cover` | Run coverage analysis (development) |
107+
| `make test-cover-ci` | Run coverage analysis (CI) |
108+
| `make test-cover-validate` | Validate coverage thresholds |
109+
| `make test-cover-html` | Generate HTML coverage report |
110+
| `make test-cover-summary` | Show coverage summary |
111+
| `make test-cover-analyze` | Detailed coverage analysis |
112+
| `make test-cover-run` | Run tests with coverage |
113+
| `make test-cover-filter` | Filter coverage report |
114+
| `make test-cover-clean` | Clean coverage files |
86115

87-
```sh
88-
make go-mod-cache
89-
```
116+
### Coverage Configuration
90117

91-
To verify dependencies:
118+
The coverage system excludes certain packages and has configurable thresholds:
92119

93-
```sh
94-
make go.sum
95-
```
120+
- **Threshold**: 85% total coverage required
121+
- **Excluded packages**: `api/`, `cmd/` packages
122+
- **Reports**: HTML, filtered, and detailed analysis available
96123

97-
To draw dependencies graph (requires Graphviz):
124+
## Protobuf Targets
98125

99-
```sh
100-
make draw-deps
101-
```
126+
**Note**: All protobuf commands require Docker
102127

103-
## Linting
128+
| Target | Description |
129+
|--------|-------------|
130+
| `make proto-all` | Full protobuf pipeline |
131+
| `make proto-gen` | Generate protobuf files |
132+
| `make proto-gen-gogo` | Generate gogo protobuf files |
133+
| `make proto-gen-openapi` | Generate OpenAPI specs |
134+
| `make proto-gen-swagger` | Generate Swagger specs |
135+
| `make proto-gen-pulsar` | Generate pulsar protobuf files |
136+
| `make proto-format` | Format protobuf files |
137+
| `make proto-lint` | Lint protobuf files |
138+
| `make proto-check-breaking` | Check for breaking changes |
104139

105-
To format and lint the code:
140+
## Linting Targets
106141

107-
```sh
108-
make format
109-
```
142+
| Target | Description |
143+
|--------|-------------|
144+
| `make lint` | Lint Go code |
145+
| `make format` | Format Go code |
146+
| `make format-tools` | Install formatting tools |
110147

111-
To just lint the code:
148+
## Development Targets
112149

113-
```sh
114-
make lint
115-
```
150+
| Target | Description |
151+
|--------|-------------|
152+
| `make go-mod-cache` | Download go modules to cache |
153+
| `make draw-deps` | Generate dependency graph (requires Graphviz) |
154+
| `make all` | Default target: install, lint, test |
116155

117-
## Protobuf
156+
## Utility Targets
118157

119-
*** Note: The prorobuf commands require Docker
158+
| Target | Description |
159+
|--------|-------------|
160+
| `make clean` | Clean build artifacts |
161+
| `make distclean` | Deep clean (includes vendor/) |
162+
| `make guard-%` | Check environment variable is set |
120163

121-
To generate protobuf files:
164+
## Help
122165

123-
```sh
124-
make proto-gen
125-
```
166+
The makefile includes comprehensive help documentation:
126167

127-
To format protobuf files:
168+
```bash
169+
# Brief help with common targets
170+
make help
128171

129-
```sh
130-
make proto-format
172+
# Complete help with all available targets
173+
make help-full
131174
```
132175

133-
To lint protobuf files:
176+
### Modular Organization
134177

135-
```sh
136-
make proto-lint
137-
```
178+
The makefile is organized into modular components:
138179

139-
To check for breaking changes in protobuf files:
180+
- `make/build.mk` - Build and release targets
181+
- `make/test.mk` - Testing and simulation targets
182+
- `make/coverage.mk` - Coverage analysis targets
183+
- `make/proto.mk` - Protobuf generation targets
184+
- `make/lint.mk` - Code formatting and linting targets
140185

141-
```sh
142-
make proto-check-breaking
143-
```
186+
Each module maintains its own help documentation to ensure targets and documentation stay synchronized.
144187

145-
## Cleaning
188+
## Examples
146189

147-
To clean build artifacts:
190+
```bash
191+
# Development workflow
192+
make install && make test-cover
148193

149-
```sh
150-
make clean
151-
```
194+
# CI workflow
195+
make build && make test-cover-ci
152196

153-
To perform a full clean including vendor directory:
197+
# Full protobuf regeneration
198+
make proto-all
154199

155-
```sh
156-
make distclean
157-
```
200+
# Build for multiple platforms
201+
make build-all
158202

159-
For more detailed usage, refer to the individual make targets in the Makefile.
203+
# Run specific integration test
204+
make test-integration-xion-abstract-account
205+
206+
# Generate dependency visualization
207+
make draw-deps
208+
```

0 commit comments

Comments
 (0)