mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
This will only fire if Claude adds `math/rand` as an import. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated code style guidelines and enhanced linting configuration to enforce stricter code quality standards. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1.1 KiB
1.1 KiB
Running Tests
# Quick Go tests (no external deps)
go test ./server/fleet/...
# Integration tests
MYSQL_TEST=1 go test ./server/datastore/mysql/...
MYSQL_TEST=1 REDIS_TEST=1 go test ./server/service/...
# Run a specific test
MYSQL_TEST=1 go test -run TestFunctionName ./server/datastore/mysql/...
# Generate boilerplate for a new frontend component, including associated stylesheet, tests, and storybook
./frontend/components/generate -n RequiredPascalCaseNameOfTheComponent -p optional/path/to/desired/parent/directory
Go code style
- Prefer
map[T]struct{}overmap[T]boolwhen the map represents a set. - Convert a map's keys to a slice with
slices.Collect(maps.Keys(m))instead of manually appending in a loop. - Avoid
time.Sleepin tests. Prefertesting/synctestto run code in a fake-clock bubble, or use polling helpers, channels, orrequire.Eventually. - Use
requireandassertfromgithub.com/stretchr/testifyin tests. - Use
t.Context()in tests instead ofcontext.Background(). - Use
anyinstead ofinterface{} - Use
math/rand/v2instead ofmath/rand.