Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
chore: simplify jUnit format generation with gotestsum (#549) | fix: …
Browse files Browse the repository at this point in the history
…use golangci-lint in favour of go-critic (#550) backport for 7.x (#553)

* chore: simplify jUnit format generation with gotestsum (#549)

* fix: use golangci-lint in favour of go-critic (#550)

* fix: remove var type as per golint's suggestion

* chore: add golangci-lint precommit hook

* chore: remove go-critic in fafvour of golangci-lint

* chore: remove TOML hook

* chore: add go-vet hook

* fix: remove unused variable

Detected by golangci-lint

* fix: remove unused Go file, which caused lint errors
  • Loading branch information
mdelapenya committed Jan 4, 2021
1 parent d63d585 commit 1f2c1b3
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 127 deletions.
9 changes: 4 additions & 5 deletions .ci/scripts/build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ set -euxo pipefail
#

# Prepare junit build context
mkdir -p outputs
export OUT_FILE="outputs/test-report.out"
mkdir -p $(pwd)/outputs

make -C cli install test | tee ${OUT_FILE}
go get -v -u gotest.tools/gotestsum

go get -v -u github.com/jstemmer/go-junit-report
go-junit-report > outputs/TEST-unit.xml < ${OUT_FILE}
# See https://pkg.go.dev/gotest.tools/gotestsum/#readme-junit-xml-output
GOTESTSUM_JUNITFILE="$(pwd)/outputs/TEST-unit.xml" make -C cli install test
5 changes: 2 additions & 3 deletions .ci/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ set -euxo pipefail
#

# Install some other dependencies required for the pre-commit
curl -sSfL https://github.com/raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.34.1

go get -v golang.org/x/lint/golint
go get -v github.com/go-lintpack/lintpack/...
go get -v github.com/go-critic/go-critic/...
lintpack build -o bin/gocritic -linter.version='v0.3.4' -linter.name='gocritic' github.com/go-critic/go-critic/checkers

# Install project dependencies
make -C cli install
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ repos:
hooks:
- id: go-fmt
- id: go-lint
- id: validate-toml
- id: go-vet
- id: no-go-testing
- id: go-critic
- id: golangci-lint

- repo: git@github.com:elastic/apm-pipeline-library
rev: current
Expand Down
2 changes: 1 addition & 1 deletion cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ notice:

.PHONY: test
test:
go test -v -timeout=$(TEST_TIMEOUT) ./...
gotestsum --format testname -- -count=1 -timeout=$(TEST_TIMEOUT) ./...
4 changes: 0 additions & 4 deletions cli/internal/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,13 @@ func Update(id string, workdir string, composeFilePaths []string, env map[string
}
}

args := []string{}
for i, f := range composeFilePaths {
args = append(args, "-f", f)

if i > 0 {
run.Services = append(run.Services, stateService{
Name: filepath.Base(filepath.Dir(f)),
})
}
}
args = append(args, "config")

bytes, err := yaml.Marshal(&run)
if err != nil {
Expand Down
110 changes: 0 additions & 110 deletions e2e/runner_test.go

This file was deleted.

3 changes: 1 addition & 2 deletions e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ import (
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

//nolint:unused
var seededRand *rand.Rand = rand.New(
rand.NewSource(time.Now().UnixNano()))
var seededRand = rand.New(rand.NewSource(time.Now().UnixNano()))

// GetExponentialBackOff returns a preconfigured exponential backoff instance
func GetExponentialBackOff(elapsedTime time.Duration) *backoff.ExponentialBackOff {
Expand Down

0 comments on commit 1f2c1b3

Please sign in to comment.