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

Mutation tests only #38

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .github/mut_blacklist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
54f1ea08e7395cf6768c102d5677d764
bc6bebd9df1b01a984c0ffab3c50b8de
d7ce4ca9bca24c65de535f680084fdeb
00a067ff2145e46f285ddf7f0f842788
cebc341f1ea73b8dc8907be3bb97a1a0
d18e7ef6485ad32dd1b4935777f433e0
7 changes: 7 additions & 0 deletions .github/mut_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
skip_without_test: false
skip_with_build_tags: false
json_output: true
silent_mode: false
min_msi: 0.90 # should be >0.95
exclude_dirs:
- messages/proto
25 changes: 23 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
submodules: recursive

- name: Go test
run: go test -covermode=atomic -shuffle=on -coverprofile coverage.out -timeout 2m ./...
run: go test -test.short -covermode=atomic -shuffle=on -coverprofile coverage.out -timeout 10m ./...

- name: Upload coverage file to Codecov
uses: codecov/codecov-action@v3
Expand All @@ -45,7 +45,28 @@ jobs:
submodules: recursive

- name: Run Go Test with race
run: go test -race -shuffle=on -timeout 2m ./...
run: go test -test.short -race -shuffle=on -timeout 10m ./...

mutating:
name: Mutation tests
runs-on: ubuntu-latest
if: false # skipped, should be restored and fixed
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x

- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install dependencies
run: make install-deps

- name: Mutating testing
run: make mut

reproducible-builds:
runs-on: ubuntu-latest
Expand Down
15 changes: 9 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ linters:
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- unused # Checks Go code for unused constants, variables, functions and types
- containedctx # containedctx is a linter that detects struct contained context.Context field
- cyclop # checks function and package cyclomatic complexity
- durationcheck # check for two durations multiplied together
- errchkjson
- gochecknoglobals # check that no global variables exist
- goerr113 # Golang linter to check the errors handling expressions
- gomnd # An analyzer to detect magic numbers.
- ireturn # Accept Interfaces, Return Concrete Types
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL.
- promlinter # Check Prometheus metrics naming via promlint
Expand Down Expand Up @@ -167,7 +165,7 @@ linters-settings:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#add-constant
- name: add-constant
severity: warning
disabled: false
disabled: true
arguments:
- maxLitCount: "3"
allowStrs: '""'
Expand Down Expand Up @@ -206,7 +204,7 @@ linters-settings:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cognitive-complexity
- name: cognitive-complexity
severity: warning
disabled: false
disabled: true
arguments: [ 7 ]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-naming
- name: confusing-naming
Expand All @@ -233,7 +231,7 @@ linters-settings:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cyclomatic
- name: cyclomatic
severity: warning
disabled: false
disabled: true
arguments: [ 3 ]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#datarace
- name: datarace
Expand Down Expand Up @@ -310,7 +308,7 @@ linters-settings:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#function-length
- name: function-length
severity: warning
disabled: false
disabled: true
arguments: [ 10, 0 ]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#get-return
- name: get-return
Expand Down Expand Up @@ -495,6 +493,11 @@ issues:
- gosec
- unparam
- lll
- containedctx
- goerr113
- revive
- gochecknoglobals
- exhaustive
include:
- EXC0012 # Exported (.+) should have comment( \(or a comment on this block\))? or be unexported
- EXC0013 # Package comment should be of the form "(.+)...
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: lint lint-all build-dummy install-deps
.PHONY: lint lint-all build-dummy install-deps mut

FIRST_COMMIT ?= $(shell git rev-list --max-parents=0 HEAD)

Expand All @@ -13,4 +13,10 @@ lint-all:
./build/bin/golangci-lint run --config ./.golangci.yml --new-from-rev=$(FIRST_COMMIT)

install-deps:
go get github.com/JekaMas/go-mutesting/cmd/[email protected]
vcastellm marked this conversation as resolved.
Show resolved Hide resolved
go install github.com/JekaMas/go-mutesting/...
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.50.1

mut:
MUTATION_TEST=on go-mutesting --blacklist=".github/mut_blacklist" --config=".github/mut_config.yml" ./...
@echo MSI: `jq '.stats.msi' report.json`
Loading