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 11f5d478f6
commit 04d7e53700
6 changed files with 89 additions and 25 deletions

View File

@ -1,46 +1,101 @@
---
defaults: &defaults
docker:
- image: 'circleci/golang:1.9.4'
working_directory: '/go/src/github.com/influxdata/telegraf'
defaults:
defaults: &defaults
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
jobs:
build:
<<: *defaults
deps:
<<: [ *defaults, *go-1_10 ]
steps:
- checkout
- 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'
release:
<<: *defaults
<<: [ *defaults, *go-1_10 ]
steps:
- checkout
- attach_workspace:
at: '/go/src'
- run: './scripts/release.sh'
- store_artifacts:
path: './artifacts'
destination: '.'
nightly:
<<: *defaults
<<: [ *defaults, *go-1_10 ]
steps:
- checkout
- attach_workspace:
at: '/go/src'
- run: './scripts/release.sh'
- store_artifacts:
path: './artifacts'
destination: '.'
workflows:
version: 2
build_and_release:
jobs:
- 'build'
- 'deps'
- 'test-go-1.8':
requires:
- 'deps'
- 'test-go-1.9':
requires:
- 'deps'
- 'test-go-1.10':
requires:
- 'deps'
- 'release':
requires:
- 'build'
- 'test-go-1.8'
- 'test-go-1.9'
- 'test-go-1.10'
nightly:
jobs:
- 'build'
- 'deps'
- 'test-go-1.8':
requires:
- 'deps'
- 'test-go-1.9':
requires:
- 'deps'
- 'test-go-1.9':
requires:
- 'deps'
- 'nightly':
requires:
- 'build'
- 'test-go-1.8'
- 'test-go-1.9'
- 'test-go-1.10'
triggers:
- schedule:
cron: "0 18 * * *"

View File

@ -13,11 +13,11 @@ platform: x64
install:
- 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-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
- 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-dep.zip" -oC:\GnuWin32 -y
- go version

View File

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

View File

@ -29,6 +29,11 @@ const (
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
// any accompanying errors, and process that data.
type Recorder interface {
@ -94,7 +99,7 @@ func (z *Zipkin) Start(acc telegraf.Accumulator) error {
}
addr := ":" + strconv.Itoa(z.Port)
ln, err := net.Listen("tcp", addr)
ln, err := net.Listen(DefaultNetwork, addr)
if err != nil {
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{
Path: "/api/v1/spans",
Port: 0,

View File

@ -197,7 +197,7 @@ func TestUDP_SerializeError(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)
metrics := []telegraf.Metric{