Merge pull request #9092 from influxdata/jenkinsfile

Initial jenkinsfile
pull/9115/head
Jonathan A. Sternberg 2017-11-14 11:12:32 -06:00 committed by GitHub
commit 97ab61addb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 9 deletions

View File

@ -0,0 +1,18 @@
FROM ioft/i386-ubuntu:xenial
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
wget \
mercurial \
git && \
rm -rf /var/lib/apt/lists/*
# Install go
ENV GOPATH /go
ENV GO_VERSION 1.9.2
ENV GO_ARCH 386
RUN wget -q https://storage.googleapis.com/golang/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
tar -C /usr/local/ -xf /go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" && \
rm /go${GO_VERSION}.linux-${GO_ARCH}.tar.gz
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

55
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,55 @@
readTrusted 'Dockerfile_jenkins_ubuntu32'
pipeline {
agent none
stages {
stage('64bit') {
agent {
docker {
image 'golang:1.9.2'
}
}
steps {
sh """
mkdir -p /go/src/github.com/influxdata
cp -a $WORKSPACE /go/src/github.com/influxdata/influxdb
cd /go/src/github.com/influxdata/influxdb
go get github.com/sparrc/gdm
gdm restore
"""
sh """
cd /go/src/github.com/influxdata/influxdb
go test -parallel=1 ./...
"""
}
}
stage('32bit') {
agent {
dockerfile {
filename 'Dockerfile_jenkins_ubuntu32'
}
}
steps {
sh """
mkdir -p /go/src/github.com/influxdata
cp -a $WORKSPACE /go/src/github.com/influxdata/influxdb
cd /go/src/github.com/influxdata/influxdb
go get github.com/sparrc/gdm
gdm restore
"""
sh """
cd /go/src/github.com/influxdata/influxdb
go test -parallel=1 ./...
"""
}
}
}
}

View File

@ -60,7 +60,7 @@ func TestService_OpenClose(t *testing.T) {
// This reproduces https://github.com/influxdata/influxdb/issues/8819
func TestService_8819_repro(t *testing.T) {
for i := 0; i < 1000; i++ {
s, errC := testService_8819_repro(t)
s, errC, done := testService_8819_repro(t)
if err := s.Open(); err != nil {
t.Fatal(err)
@ -70,6 +70,8 @@ func TestService_8819_repro(t *testing.T) {
if err := <-errC; err != nil {
t.Fatalf("%dth iteration: %v", i, err)
}
// Mark that we do not expect more errors in case it runs one more time.
close(done)
if err := s.Close(); err != nil {
t.Fatal(err)
@ -77,11 +79,12 @@ func TestService_8819_repro(t *testing.T) {
}
}
func testService_8819_repro(t *testing.T) (*Service, chan error) {
func testService_8819_repro(t *testing.T) (*Service, chan error, chan struct{}) {
c := retention.NewConfig()
c.CheckInterval = toml.Duration(time.Millisecond)
s := NewService(c)
errC := make(chan error, 1) // Buffer Important to prevent deadlock.
done := make(chan struct{})
// A database and a bunch of shards
var mu sync.Mutex
@ -110,6 +113,13 @@ func testService_8819_repro(t *testing.T) (*Service, chan error) {
},
}
sendError := func(err error) {
select {
case errC <- err:
case <-done:
}
}
s.MetaClient.DatabasesFn = func() []meta.DatabaseInfo {
mu.Lock()
defer mu.Unlock()
@ -118,13 +128,13 @@ func testService_8819_repro(t *testing.T) (*Service, chan error) {
s.MetaClient.DeleteShardGroupFn = func(database string, policy string, id uint64) error {
if database != "db0" {
errC <- fmt.Errorf("wrong db name: %s", database)
sendError(fmt.Errorf("wrong db name: %s", database))
return nil
} else if policy != "autogen" {
errC <- fmt.Errorf("wrong rp name: %s", policy)
sendError(fmt.Errorf("wrong rp name: %s", policy))
return nil
} else if id != 1 {
errC <- fmt.Errorf("wrong shard group id: %d", id)
sendError(fmt.Errorf("wrong shard group id: %d", id))
return nil
}
@ -162,17 +172,17 @@ func testService_8819_repro(t *testing.T) (*Service, chan error) {
}
if !found {
errC <- fmt.Errorf("local shard %d present, yet it's missing from meta store. %v -- %v ", lid, shards, localShards)
sendError(fmt.Errorf("local shard %d present, yet it's missing from meta store. %v -- %v ", lid, shards, localShards))
return nil
}
}
// We should have removed shards 3 and 9
if !reflect.DeepEqual(localShards, []uint64{5, 8, 11}) {
errC <- fmt.Errorf("removed shards still present locally: %v", localShards)
sendError(fmt.Errorf("removed shards still present locally: %v", localShards))
return nil
}
errC <- nil
sendError(nil)
return nil
}
@ -202,7 +212,7 @@ func testService_8819_repro(t *testing.T) (*Service, chan error) {
return nil
}
return s, errC
return s, errC, done
}
type Service struct {