Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shuffle tests #249

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
run: |
apk update && apk upgrade
apk add --no-cache git tar make
go version
go env
- name: Clone
uses: actions/checkout@v4
Expand All @@ -68,7 +67,6 @@ jobs:
# Run Dockerfile build and condense four actions into one step
run: |
apk add --no-cache docker docker-cli-buildx
docker version
docker login -u thingspect -p ${{ secrets.GHCR_PAT }} ghcr.io
git config --global --add safe.directory /__w/atlas/atlas
TAG=$(git rev-parse --short=8 HEAD)
Expand Down
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ install:

lint:
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck -version
# staticcheck defaults are all,-ST1000,-ST1003,-ST1016,-ST1020,-ST1021,-ST1022
staticcheck -checks all ./...

go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint version
golangci-lint run -E bidichk,durationcheck,errname,exportloopref \
-E forcetypeassert,godot,goerr113,gofumpt,gosec,nlreturn,prealloc \
-E protogetter,testifylint,unconvert,unparam,usestdlibvars \
Expand All @@ -51,11 +49,13 @@ init_db:
migrate -path config/db/atlas -database $(TEST_PG_URI) up

test: install lint unit_test integration_test
# -count 1 is the idiomatic way to disable test caching in package list mode
# -count=1 is the idiomatic way to disable test caching in package list mode
unit_test:
go test -count=1 -cover -cpu 1,4 -failfast $(RFLAG) -tags unit ./...
go test -count=1 -cover -cpu=1,4 -failfast -shuffle=on $(RFLAG) -tags unit \
./...
integration_test: init_db
go test -count=1 -cover -cpu 1,4 -failfast $(RFLAG) -tags integration ./...
go test -count=1 -cover -cpu=1,4 -failfast -shuffle=on $(RFLAG) -tags \
integration ./...

mod:
go get -t -u ./... || true
Expand All @@ -67,7 +67,6 @@ mod:

generate:
go install go.uber.org/mock/mockgen@latest
mockgen -version
go generate -x ./...
find . -type f -name 'mock_*.go' -exec sh -c \
'echo "//lint:file-ignore ST1000 Mockgen package comment" >> {}' \;
1 change: 0 additions & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ FROM golang:1.21-alpine AS build
# Add packages needed to support builds and tests
RUN apk update && apk upgrade
RUN apk add --no-cache make
RUN go version
RUN go env

COPY . /opt/atlas/
Expand Down