Compare commits
10 Commits
79c998d91a
...
333b9f2656
Author | SHA1 | Date |
---|---|---|
Sam Batschelet | 333b9f2656 | |
Sam Batschelet | 7436c63a48 | |
Sam Batschelet | 5caf504f40 | |
Sam Batschelet | 7dc07f2a9b | |
Manjunath A Kumatagi | 7ec9c48a45 | |
Piotr Tabor | 8ce82ff877 | |
Sam Batschelet | 6064a0e39c | |
Sam Batschelet | 78f1a05493 | |
Sam Batschelet | 7a07e9f3b3 | |
Sahdev P. Zala | 8d4ab97008 |
|
@ -6,12 +6,15 @@ sudo: required
|
|||
services: docker
|
||||
|
||||
go:
|
||||
- 1.8.7
|
||||
- 1.12.17
|
||||
|
||||
notifications:
|
||||
on_success: never
|
||||
on_failure: never
|
||||
|
||||
env:
|
||||
- GO111MODULE=off
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- TARGET=linux-amd64-integration
|
||||
|
@ -23,7 +26,7 @@ env:
|
|||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- go: 1.8.7
|
||||
- go: 1.12.17
|
||||
env: TARGET=linux-386-unit
|
||||
exclude:
|
||||
- go: tip
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM ubuntu:16.10
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
|
||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||
|
@ -29,6 +29,7 @@ RUN apt-get -y update \
|
|||
&& apt-get -y autoremove \
|
||||
&& apt-get -y autoclean
|
||||
|
||||
ENV GO111MODULE=off
|
||||
ENV GOROOT /usr/local/go
|
||||
ENV GOPATH /go
|
||||
ENV PATH ${GOPATH}/bin:${GOROOT}/bin:${PATH}
|
||||
|
@ -46,11 +47,18 @@ ADD ./scripts/install-marker.sh /tmp/install-marker.sh
|
|||
|
||||
RUN go get -v -u -tags spell github.com/chzchzchz/goword \
|
||||
&& go get -v -u github.com/coreos/license-bill-of-materials \
|
||||
&& go get -v -u honnef.co/go/tools/cmd/gosimple \
|
||||
&& go get -v -u honnef.co/go/tools/cmd/unused \
|
||||
&& go get -v -u honnef.co/go/tools/cmd/staticcheck \
|
||||
&& go get -v -u github.com/wadey/gocovmerge \
|
||||
&& go get -v -u github.com/gordonklaus/ineffassign \
|
||||
&& mkdir -p $GOPATH/src/honnef.co/go/tools \
|
||||
&& git clone https://github.com/dominikh/go-tools.git $GOPATH/src/honnef.co/go/tools \
|
||||
&& cd $GOPATH/src/honnef.co/go/tools/cmd/staticcheck \
|
||||
&& git checkout 2017.2.2 \
|
||||
&& go get \
|
||||
&& go install \
|
||||
&& cd $GOPATH/src/honnef.co/go/tools/cmd/gosimple \
|
||||
&& go install \
|
||||
&& cd $GOPATH/src/honnef.co/go/tools/cmd/unused \
|
||||
&& go install \
|
||||
&& /tmp/install-marker.sh amd64 \
|
||||
&& rm -f /tmp/install-marker.sh \
|
||||
&& curl -s https://codecov.io/bash >/codecov \
|
||||
|
|
|
@ -24,7 +24,7 @@ func TestMarshaler(t *testing.T) {
|
|||
data := []byte("test data")
|
||||
m := &fakeMarshaler{data: data}
|
||||
if g := MustMarshal(m); !reflect.DeepEqual(g, data) {
|
||||
t.Errorf("data = %s, want %s", g, m)
|
||||
t.Errorf("data = %s, want %s", g, m.data)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ func TestUnmarshaler(t *testing.T) {
|
|||
m := &fakeUnmarshaler{}
|
||||
MustUnmarshal(m, data)
|
||||
if !reflect.DeepEqual(m.data, data) {
|
||||
t.Errorf("data = %s, want %s", m.data, m)
|
||||
t.Errorf("data = %s, want %s", m.data, data)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ func (l *DefaultLogger) Fatalf(format string, v ...interface{}) {
|
|||
}
|
||||
|
||||
func (l *DefaultLogger) Panic(v ...interface{}) {
|
||||
l.Logger.Panic(v)
|
||||
l.Logger.Panic(v...)
|
||||
}
|
||||
|
||||
func (l *DefaultLogger) Panicf(format string, v ...interface{}) {
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
var (
|
||||
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
|
||||
MinClusterVersion = "3.0.0"
|
||||
Version = "3.2.31"
|
||||
Version = "3.2.32"
|
||||
APIVersion = "unknown"
|
||||
|
||||
// Git SHA Value will be set during build
|
||||
|
|
|
@ -61,6 +61,7 @@ var (
|
|||
ErrSnapshotNotFound = errors.New("wal: snapshot not found")
|
||||
ErrSliceOutOfRange = errors.New("wal: slice bounds out of range")
|
||||
ErrMaxWALEntrySizeLimitExceeded = errors.New("wal: max entry size limit exceeded")
|
||||
ErrDecoderNotFound = errors.New("wal: decoder not found")
|
||||
crcTable = crc32.MakeTable(crc32.Castagnoli)
|
||||
)
|
||||
|
||||
|
@ -91,7 +92,8 @@ type WAL struct {
|
|||
}
|
||||
|
||||
// Create creates a WAL ready for appending records. The given metadata is
|
||||
// recorded at the head of each WAL file, and can be retrieved with ReadAll.
|
||||
// recorded at the head of each WAL file, and can be retrieved with ReadAll
|
||||
// after the file is Open.
|
||||
func Create(dirpath string, metadata []byte) (*WAL, error) {
|
||||
if Exist(dirpath) {
|
||||
return nil, os.ErrExist
|
||||
|
@ -262,6 +264,10 @@ func (w *WAL) ReadAll() (metadata []byte, state raftpb.HardState, ents []raftpb.
|
|||
defer w.mu.Unlock()
|
||||
|
||||
rec := &walpb.Record{}
|
||||
|
||||
if w.decoder == nil {
|
||||
return nil, state, nil, ErrDecoderNotFound
|
||||
}
|
||||
decoder := w.decoder
|
||||
|
||||
var match bool
|
||||
|
|
|
@ -823,3 +823,23 @@ func TestOpenOnTornWrite(t *testing.T) {
|
|||
t.Fatalf("expected len(ents) = %d, got %d", wEntries, len(ents))
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadAllFail(t *testing.T) {
|
||||
dir, err := ioutil.TempDir(os.TempDir(), "waltest")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
// create initial WAL
|
||||
f, err := Create(dir, []byte("metadata"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
f.Close()
|
||||
// try to read without opening the WAL
|
||||
_, _, _, err = f.ReadAll()
|
||||
if err == nil || err != ErrDecoderNotFound {
|
||||
t.Fatalf("err = %v, want ErrDecoderNotFound", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue