Skip to content
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ on:
pull_request:
branches: [ main ]

permissions:
# Least-privilege default, as in release.yaml. This workflow only checks
# out the tree and runs tests, so it never needs to write. That matters
# more here than elsewhere: it runs on pull_request, so the test code it
# executes comes from the pull request itself, and a token that can write
# would be handed to code the repository has not merged yet.
contents: read

jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -46,6 +54,9 @@ jobs:
- name: Run query, diff, and repair unit tests
run: go test -count=1 -v ./db/queries ./internal/consistency/diff ./internal/consistency/repair

- name: Run schema-structure comparison unit tests
run: go test -count=1 -v ./internal/consistency/schema
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Run mtree missing-tree fail-fast test
run: go test -count=1 -v ./tests/integration -run 'TestMtreeDiffFailsFastWhenTreeNotBuilt'

Expand All @@ -71,6 +82,15 @@ jobs:
- name: Run schema-diff tests
run: go test -count=1 -v ./tests/integration -run 'TestSchemaDiff_'

- name: Run schema-diff --compare=structure tests
run: go test -count=1 -v ./tests/integration -run 'TestSchemaDiffStructure_'

- name: Run scope resolution tests
run: go test -count=1 -v ./tests/integration -run 'TestSchemaProvider_'

- name: Run table-diff schema-mismatch diagnosis tests
run: go test -count=1 -v ./tests/integration -run 'TestTableDiffSchemaMismatch_'

- name: Run spock-diff comparison unit tests
run: go test -count=1 -v ./internal/consistency/diff -run 'TestCompareSubscriptions'

Expand Down
10 changes: 10 additions & 0 deletions cmd/ace/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package main

import (
"context"
"errors"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -69,6 +70,15 @@ func main() {
err := app.Run(context.Background(), os.Args)
if err != nil {
logger.Error("%v", err)

// Default exit code is 1. A command can carry a more specific
// code by wrapping its error in pkg/common.ExitCodeError.
code := 1
var withCode interface{ ExitCode() int }
if errors.As(err, &withCode) {
code = withCode.ExitCode()
}
os.Exit(code)
}
}

Expand Down
Loading
Loading