From 80580c070f7d466dfc4562e52b0b94fbbc4685e8 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Tue, 18 Jan 2022 13:45:03 -0700 Subject: [PATCH] fix: ensure CI tests runs against i386 (#10457) --- .circleci/config.yml | 36 +++++++++++++++++++++++--- plugins/inputs/phpfpm/phpfpm_test.go | 4 +++ plugins/processors/noise/noise_test.go | 14 +++++----- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8493fd090..4fe4939a1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,6 +42,9 @@ commands: os: type: string default: "linux" + arch: + type: string + default: "amd64" gotestsum: type: string default: "gotestsum" @@ -78,7 +81,7 @@ commands: - run: ./scripts/install_gotestsum.sh << parameters.os >> << parameters.gotestsum >> - run: | PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname) - ./<< parameters.gotestsum >> --junitfile test-results/gotestsum-report.xml -- -short $PACKAGE_NAMES + GOARCH=<< parameters.arch >> ./<< parameters.gotestsum >> --junitfile test-results/gotestsum-report.xml -- -short $PACKAGE_NAMES - store_test_results: path: test-results - when: @@ -166,6 +169,28 @@ jobs: root: '/go' paths: - '*' + test-go-linux-386: + executor: go-1_17 + parallelism: 4 + steps: + - checkout + - restore_cache: + key: go-mod-v1-{{ checksum "go.sum" }} + - check-changed-files-or-halt + - run: 'GOARCH=386 make deps' + - run: 'GOARCH=386 make tidy' + - run: 'GOARCH=386 make check' + - test-go: + arch: "386" + - save_cache: + name: 'go module cache' + key: go-mod-v1-{{ checksum "go.sum" }} + paths: + - '/go/pkg/mod' + - persist_to_workspace: + root: '/go' + paths: + - '*' test-go-mac: executor: mac steps: @@ -415,6 +440,10 @@ workflows: filters: tags: only: /.*/ + - 'test-go-linux-386': + filters: + tags: + only: /.*/ - 'test-go-mac': filters: tags: # only runs on tags if you specify this filter @@ -443,7 +472,7 @@ workflows: only: /.*/ - 'i386-package': requires: - - 'test-go-linux' + - 'test-go-linux-386' filters: tags: only: /.*/ @@ -585,6 +614,7 @@ workflows: nightly: jobs: - 'test-go-linux' + - 'test-go-linux-386' - 'test-go-mac' - 'test-go-windows' - 'windows-package': @@ -606,7 +636,7 @@ workflows: name: 'i386-package-nightly' nightly: true requires: - - 'test-go-linux' + - 'test-go-linux-386' - 'ppc64le-package': name: 'ppc64le-package-nightly' nightly: true diff --git a/plugins/inputs/phpfpm/phpfpm_test.go b/plugins/inputs/phpfpm/phpfpm_test.go index cf207fec9..14d03dd3f 100644 --- a/plugins/inputs/phpfpm/phpfpm_test.go +++ b/plugins/inputs/phpfpm/phpfpm_test.go @@ -287,6 +287,10 @@ func TestPhpFpmDefaultGetFromLocalhost(t *testing.T) { } func TestPhpFpmGeneratesMetrics_Throw_Error_When_Fpm_Status_Is_Not_Responding(t *testing.T) { + if testing.Short() { + t.Skip("Skipping long test in short mode") + } + r := &phpfpm{ Urls: []string{"http://aninvalidone"}, } diff --git a/plugins/processors/noise/noise_test.go b/plugins/processors/noise/noise_test.go index f491d1f09..bab0dea75 100644 --- a/plugins/processors/noise/noise_test.go +++ b/plugins/processors/noise/noise_test.go @@ -190,7 +190,7 @@ func TestAddNoiseOverflowCheck(t *testing.T) { input: []telegraf.Metric{ testutil.MustMetric("underflow_int64", map[string]string{}, - map[string]interface{}{"value": math.MinInt64}, + map[string]interface{}{"value": int64(math.MinInt64)}, time.Unix(0, 0), ), testutil.MustMetric("underflow_uint64_1", @@ -207,7 +207,7 @@ func TestAddNoiseOverflowCheck(t *testing.T) { expected: []telegraf.Metric{ testutil.MustMetric("underflow_int64", map[string]string{}, - map[string]interface{}{"value": math.MinInt64}, + map[string]interface{}{"value": int64(math.MinInt64)}, time.Unix(0, 0), ), testutil.MustMetric("underflow_uint64_1", @@ -228,12 +228,12 @@ func TestAddNoiseOverflowCheck(t *testing.T) { input: []telegraf.Metric{ testutil.MustMetric("overflow_int64", map[string]string{}, - map[string]interface{}{"value": math.MaxInt64}, + map[string]interface{}{"value": int64(math.MaxInt64)}, time.Unix(0, 0), ), testutil.MustMetric("overflow_uint", map[string]string{}, - map[string]interface{}{"value": uint(math.MaxUint)}, + map[string]interface{}{"value": uint64(math.MaxUint)}, time.Unix(0, 0), ), testutil.MustMetric("overflow_uint64", @@ -245,12 +245,12 @@ func TestAddNoiseOverflowCheck(t *testing.T) { expected: []telegraf.Metric{ testutil.MustMetric("overflow_int64", map[string]string{}, - map[string]interface{}{"value": math.MaxInt64}, + map[string]interface{}{"value": int64(math.MaxInt64)}, time.Unix(0, 0), ), testutil.MustMetric("overflow_uint", map[string]string{}, - map[string]interface{}{"value": uint(math.MaxUint)}, + map[string]interface{}{"value": uint64(math.MaxUint)}, time.Unix(0, 0), ), testutil.MustMetric("overflow_uint64", @@ -259,7 +259,7 @@ func TestAddNoiseOverflowCheck(t *testing.T) { time.Unix(0, 0), ), }, - distribution: &testDistribution{value: 1.0}, + distribution: &testDistribution{value: 0.0}, }, { name: "non-numeric fields",