Allow filtering tests from mage (#1072)

This commit is contained in:
kolaente
2025-07-02 22:41:25 +02:00
committed by GitHub
parent 7f0e96aacf
commit e7a4d9f180
2 changed files with 12 additions and 3 deletions

View File

@@ -15,9 +15,9 @@ The project consists of:
### Backend (Go)
- **Build**: `mage build` - Builds the Go binary
- **Test**: `mage test:feature` - Runs feature tests
- **Test Features**: `mage test:feature` - Runs feature tests
- **Test Web**: `mage test:web` - Runs web tests
- **Test All**: `mage test:all` - Runs all tests
- You can run specific tests with `mage test:filter <filter>` where `<filter>` is a go test filter string.
- **Lint**: `mage lint` - Runs golangci-lint
- **Lint Fix**: `mage lint:fix` - Runs golangci-lint with auto-fix
- **Generate Swagger Docs**: `mage generate:swagger-docs` - Updates API documentation (Generally you won't need to run this unless the user tells you to. It is updated automatically in the CI workflow)

View File

@@ -396,7 +396,16 @@ func (Test) Coverage() {
func (Test) Web() {
mg.Deps(initVars)
// We run everything sequentially and not in parallel to prevent issues with real test databases
runAndStreamOutput("go", "test", Goflags[0], "-p", "1", "-timeout", "45m", PACKAGE+"/pkg/webtests")
args := []string{"test", Goflags[0], "-p", "1", "-timeout", "45m", PACKAGE + "/pkg/webtests"}
runAndStreamOutput("go", args...)
}
func (Test) Filter(filter string) {
mg.Deps(initVars)
setApiPackages()
// We run everything sequentially and not in parallel to prevent issues with real test databases
args := append([]string{"test", Goflags[0], "-p", "1", "-timeout", "45m", "-run", filter}, ApiPackages...)
runAndStreamOutput("go", args...)
}
func (Test) All() {