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

Run tests in parallel #250

Merged
merged 2 commits into from
Apr 4, 2022
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: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ lint:

.PHONY: test
test:
go test ./...
go test ./... -race -shuffle=on

.PHONY: container
container:
Expand Down
2 changes: 2 additions & 0 deletions client/nginx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
const validStabStats = "Active connections: 1457 \nserver accepts handled requests\n 6717066 6717066 65844359 \nReading: 1 Writing: 8 Waiting: 1448 \n"

func TestParseStubStatsValidInput(t *testing.T) {
t.Parallel()

tests := []struct {
input []byte
expectedResult StubStats
Expand Down
2 changes: 2 additions & 0 deletions collector/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
)

func TestMergeLabels(t *testing.T) {
t.Parallel()

tests := []struct {
name string
mapA, mapB, want map[string]string
Expand Down
3 changes: 2 additions & 1 deletion collector/nginx_plus.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ type VariableLabelNames struct {

// NewVariableLabels creates a new struct for VariableNames for the collector
func NewVariableLabelNames(upstreamServerVariableLabelNames []string, serverZoneVariableLabelNames []string, upstreamServerPeerVariableLabelNames []string,
streamUpstreamServerVariableLabelNames []string, streamServerZoneLabels []string, streamUpstreamServerPeerVariableLabelNames []string) VariableLabelNames {
streamUpstreamServerVariableLabelNames []string, streamServerZoneLabels []string, streamUpstreamServerPeerVariableLabelNames []string,
) VariableLabelNames {
return VariableLabelNames{
UpstreamServerVariableLabelNames: upstreamServerVariableLabelNames,
ServerZoneVariableLabelNames: serverZoneVariableLabelNames,
Expand Down
8 changes: 8 additions & 0 deletions exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
)

func TestCreateClientWithRetries(t *testing.T) {
t.Parallel()

type args struct {
client interface{}
err error
Expand Down Expand Up @@ -83,6 +85,8 @@ func TestCreateClientWithRetries(t *testing.T) {
}

func TestParsePositiveDuration(t *testing.T) {
t.Parallel()

tests := []struct {
name string
testInput string
Expand Down Expand Up @@ -123,6 +127,8 @@ func TestParsePositiveDuration(t *testing.T) {
}

func TestParseUnixSocketAddress(t *testing.T) {
t.Parallel()

tests := []struct {
name string
testInput string
Expand Down Expand Up @@ -177,6 +183,8 @@ func TestParseUnixSocketAddress(t *testing.T) {
}

func TestParseConstLabels(t *testing.T) {
t.Parallel()

tests := []struct {
name string
labels string
Expand Down