Test using Go 1.8-1.10; official builds with 1.10 (#4041)

This commit is contained in:
Daniel Nelson 2018-04-18 16:14:06 -07:00 committed by GitHub
parent 571ce86d10
commit 78d4a95ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 89 additions and 25 deletions

View File

@ -1,46 +1,101 @@
--- ---
defaults:
defaults: &defaults defaults: &defaults
docker:
- image: 'circleci/golang:1.9.4'
working_directory: '/go/src/github.com/influxdata/telegraf' working_directory: '/go/src/github.com/influxdata/telegraf'
go-1_8: &go-1_8
docker:
- image: 'circleci/golang:1.8.7'
go-1_9: &go-1_9
docker:
- image: 'circleci/golang:1.9.5'
go-1_10: &go-1_10
docker:
- image: 'circleci/golang:1.10.1'
version: 2 version: 2
jobs: jobs:
build: deps:
<<: *defaults <<: [ *defaults, *go-1_10 ]
steps: steps:
- checkout - checkout
- run: 'make deps' - run: 'make deps'
- persist_to_workspace:
root: '/go/src'
paths:
- '*'
test-go-1.8:
<<: [ *defaults, *go-1_8 ]
steps:
- attach_workspace:
at: '/go/src'
- run: 'make test-ci'
test-go-1.9:
<<: [ *defaults, *go-1_9 ]
steps:
- attach_workspace:
at: '/go/src'
- run: 'make test-ci'
test-go-1.10:
<<: [ *defaults, *go-1_10 ]
steps:
- attach_workspace:
at: '/go/src'
- run: 'make test-ci' - run: 'make test-ci'
release: release:
<<: *defaults <<: [ *defaults, *go-1_10 ]
steps: steps:
- checkout - attach_workspace:
at: '/go/src'
- run: './scripts/release.sh' - run: './scripts/release.sh'
- store_artifacts: - store_artifacts:
path: './artifacts' path: './artifacts'
destination: '.' destination: '.'
nightly: nightly:
<<: *defaults <<: [ *defaults, *go-1_10 ]
steps: steps:
- checkout - attach_workspace:
at: '/go/src'
- run: './scripts/release.sh' - run: './scripts/release.sh'
- store_artifacts: - store_artifacts:
path: './artifacts' path: './artifacts'
destination: '.' destination: '.'
workflows: workflows:
version: 2 version: 2
build_and_release: build_and_release:
jobs: jobs:
- 'build' - 'deps'
- 'test-go-1.8':
requires:
- 'deps'
- 'test-go-1.9':
requires:
- 'deps'
- 'test-go-1.10':
requires:
- 'deps'
- 'release': - 'release':
requires: requires:
- 'build' - 'test-go-1.8'
- 'test-go-1.9'
- 'test-go-1.10'
nightly: nightly:
jobs: jobs:
- 'build' - 'deps'
- 'test-go-1.8':
requires:
- 'deps'
- 'test-go-1.9':
requires:
- 'deps'
- 'test-go-1.9':
requires:
- 'deps'
- 'nightly': - 'nightly':
requires: requires:
- 'build' - 'test-go-1.8'
- 'test-go-1.9'
- 'test-go-1.10'
triggers: triggers:
- schedule: - schedule:
cron: "0 18 * * *" cron: "0 18 * * *"

View File

@ -13,11 +13,11 @@ platform: x64
install: install:
- IF NOT EXIST "C:\Cache" mkdir C:\Cache - IF NOT EXIST "C:\Cache" mkdir C:\Cache
- IF NOT EXIST "C:\Cache\go1.9.4.msi" curl -o "C:\Cache\go1.9.4.msi" https://storage.googleapis.com/golang/go1.9.4.windows-amd64.msi - IF NOT EXIST "C:\Cache\go1.10.1.msi" curl -o "C:\Cache\go1.10.1.msi" https://storage.googleapis.com/golang/go1.10.1.windows-amd64.msi
- IF NOT EXIST "C:\Cache\gnuwin32-bin.zip" curl -o "C:\Cache\gnuwin32-bin.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-bin.zip - IF NOT EXIST "C:\Cache\gnuwin32-bin.zip" curl -o "C:\Cache\gnuwin32-bin.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-bin.zip
- IF NOT EXIST "C:\Cache\gnuwin32-dep.zip" curl -o "C:\Cache\gnuwin32-dep.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-dep.zip - IF NOT EXIST "C:\Cache\gnuwin32-dep.zip" curl -o "C:\Cache\gnuwin32-dep.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-dep.zip
- IF EXIST "C:\Go" rmdir /S /Q C:\Go - IF EXIST "C:\Go" rmdir /S /Q C:\Go
- msiexec.exe /i "C:\Cache\go1.9.4.msi" /quiet - msiexec.exe /i "C:\Cache\go1.10.1.msi" /quiet
- 7z x "C:\Cache\gnuwin32-bin.zip" -oC:\GnuWin32 -y - 7z x "C:\Cache\gnuwin32-bin.zip" -oC:\GnuWin32 -y
- 7z x "C:\Cache\gnuwin32-dep.zip" -oC:\GnuWin32 -y - 7z x "C:\Cache\gnuwin32-dep.zip" -oC:\GnuWin32 -y
- go version - go version

View File

@ -59,7 +59,7 @@ func TestConcurrentConns(t *testing.T) {
require.NoError(t, listener.Start(acc)) require.NoError(t, listener.Start(acc))
defer listener.Stop() defer listener.Stop()
time.Sleep(time.Millisecond * 25) time.Sleep(time.Millisecond * 250)
_, err := net.Dial("tcp", "127.0.0.1:8125") _, err := net.Dial("tcp", "127.0.0.1:8125")
assert.NoError(t, err) assert.NoError(t, err)
_, err = net.Dial("tcp", "127.0.0.1:8125") _, err = net.Dial("tcp", "127.0.0.1:8125")
@ -72,7 +72,7 @@ func TestConcurrentConns(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
_, err = conn.Write([]byte(testMsg)) _, err = conn.Write([]byte(testMsg))
assert.NoError(t, err) assert.NoError(t, err)
time.Sleep(time.Millisecond * 10) time.Sleep(time.Millisecond * 100)
assert.Zero(t, acc.NFields()) assert.Zero(t, acc.NFields())
} }
@ -89,7 +89,7 @@ func TestConcurrentConns1(t *testing.T) {
require.NoError(t, listener.Start(acc)) require.NoError(t, listener.Start(acc))
defer listener.Stop() defer listener.Stop()
time.Sleep(time.Millisecond * 25) time.Sleep(time.Millisecond * 250)
_, err := net.Dial("tcp", "127.0.0.1:8125") _, err := net.Dial("tcp", "127.0.0.1:8125")
assert.NoError(t, err) assert.NoError(t, err)
@ -100,7 +100,7 @@ func TestConcurrentConns1(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
_, err = conn.Write([]byte(testMsg)) _, err = conn.Write([]byte(testMsg))
assert.NoError(t, err) assert.NoError(t, err)
time.Sleep(time.Millisecond * 10) time.Sleep(time.Millisecond * 100)
assert.Zero(t, acc.NFields()) assert.Zero(t, acc.NFields())
} }
@ -116,7 +116,7 @@ func TestCloseConcurrentConns(t *testing.T) {
acc := &testutil.Accumulator{} acc := &testutil.Accumulator{}
require.NoError(t, listener.Start(acc)) require.NoError(t, listener.Start(acc))
time.Sleep(time.Millisecond * 25) time.Sleep(time.Millisecond * 250)
_, err := net.Dial("tcp", "127.0.0.1:8125") _, err := net.Dial("tcp", "127.0.0.1:8125")
assert.NoError(t, err) assert.NoError(t, err)
_, err = net.Dial("tcp", "127.0.0.1:8125") _, err = net.Dial("tcp", "127.0.0.1:8125")
@ -141,7 +141,7 @@ func BenchmarkUDP(b *testing.B) {
panic(err) panic(err)
} }
time.Sleep(time.Millisecond * 25) time.Sleep(time.Millisecond * 250)
conn, err := net.Dial("udp", "127.0.0.1:8125") conn, err := net.Dial("udp", "127.0.0.1:8125")
if err != nil { if err != nil {
panic(err) panic(err)
@ -172,7 +172,7 @@ func BenchmarkTCP(b *testing.B) {
panic(err) panic(err)
} }
time.Sleep(time.Millisecond * 25) time.Sleep(time.Millisecond * 250)
conn, err := net.Dial("tcp", "127.0.0.1:8125") conn, err := net.Dial("tcp", "127.0.0.1:8125")
if err != nil { if err != nil {
panic(err) panic(err)

View File

@ -29,6 +29,11 @@ const (
DefaultShutdownTimeout = 5 DefaultShutdownTimeout = 5
) )
var (
// DefaultNetwork is the network to listen on; use only in tests.
DefaultNetwork = "tcp"
)
// Recorder represents a type which can record zipkin trace data as well as // Recorder represents a type which can record zipkin trace data as well as
// any accompanying errors, and process that data. // any accompanying errors, and process that data.
type Recorder interface { type Recorder interface {
@ -94,7 +99,7 @@ func (z *Zipkin) Start(acc telegraf.Accumulator) error {
} }
addr := ":" + strconv.Itoa(z.Port) addr := ":" + strconv.Itoa(z.Port)
ln, err := net.Listen("tcp", addr) ln, err := net.Listen(DefaultNetwork, addr)
if err != nil { if err != nil {
return err return err
} }

View File

@ -557,6 +557,10 @@ func TestZipkinPlugin(t *testing.T) {
}, },
} }
// Workaround for Go 1.8
// https://github.com/golang/go/issues/18806
DefaultNetwork = "tcp4"
z := &Zipkin{ z := &Zipkin{
Path: "/api/v1/spans", Path: "/api/v1/spans",
Port: 0, Port: 0,

View File

@ -197,7 +197,7 @@ func TestUDP_SerializeError(t *testing.T) {
} }
func TestUDP_WriteWithRealConn(t *testing.T) { func TestUDP_WriteWithRealConn(t *testing.T) {
conn, err := net.ListenPacket("udp", ":0") conn, err := net.ListenPacket("udp", "127.0.0.0:0")
require.NoError(t, err) require.NoError(t, err)
metrics := []telegraf.Metric{ metrics := []telegraf.Metric{