mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
commit
97b211c8ba
@ -50,5 +50,4 @@ func (h *handler) Txn(ctx context.Context, r *pb.TxnRequest) (*pb.TxnResponse, e
|
||||
|
||||
func (h *handler) Compact(ctx context.Context, r *pb.CompactionRequest) (*pb.CompactionResponse, error) {
|
||||
panic("not implemented")
|
||||
return nil, nil
|
||||
}
|
||||
|
@ -35,12 +35,10 @@ func (ph *PauseableHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
hj, ok := w.(http.Hijacker)
|
||||
if !ok {
|
||||
panic("webserver doesn't support hijacking")
|
||||
return
|
||||
}
|
||||
conn, _, err := hj.Hijack()
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
return
|
||||
}
|
||||
conn.Close()
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ func TestNetworkDrop(t *testing.T) {
|
||||
|
||||
drop := sent - received
|
||||
if drop > int((droprate+0.1)*float64(sent)) || drop < int((droprate-0.1)*float64(sent)) {
|
||||
t.Errorf("drop = %d, want around %d", drop, droprate*float64(sent))
|
||||
t.Errorf("drop = %d, want around %.2f", drop, droprate*float64(sent))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ func (ki *keyIndex) get(atRev int64) (modified, created revision, ver int64, err
|
||||
// If a generation becomes empty during compaction, it will be removed.
|
||||
func (ki *keyIndex) compact(atRev int64, available map[revision]struct{}) {
|
||||
if ki.isEmpty() {
|
||||
log.Panic("store.keyindex: unexpected compact on empty keyIndex %s", string(ki.key))
|
||||
log.Panicf("store.keyindex: unexpected compact on empty keyIndex %s", string(ki.key))
|
||||
}
|
||||
|
||||
// walk until reaching the first revision that has an revision smaller or equal to
|
||||
|
@ -293,14 +293,14 @@ func TestKeyIndexCompact(t *testing.T) {
|
||||
|
||||
// Jump Compaction
|
||||
for i, tt := range tests {
|
||||
if (i%2 == 0 && i < 6) && (i%2 == 1 && i > 6) {
|
||||
if (i%2 == 0 && i < 6) || (i%2 == 1 && i > 6) {
|
||||
am := make(map[revision]struct{})
|
||||
ki.compact(tt.compact, am)
|
||||
if !reflect.DeepEqual(ki, tt.wki) {
|
||||
t.Errorf("#%d: ki = %+v, want %+v", i, ki, tt.wki)
|
||||
}
|
||||
if !reflect.DeepEqual(am, tt.wam) {
|
||||
t.Errorf("#%d: am = %+v, want %+v", am, tt.wam)
|
||||
t.Errorf("#%d: am = %+v, want %+v", i, am, tt.wam)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ func TestWorkflow(t *testing.T) {
|
||||
// check existing keys
|
||||
kvs, rev, err := s.Range([]byte("bar"), []byte("bas"), 0, 0)
|
||||
if err != nil {
|
||||
t.Errorf("#%d: range error (%v)", err)
|
||||
t.Errorf("#%d: range error (%v)", i, err)
|
||||
}
|
||||
if len(kvs) != len(wkvs) {
|
||||
t.Fatalf("#%d: len(kvs) = %d, want %d", i, len(kvs), len(wkvs))
|
||||
|
Loading…
x
Reference in New Issue
Block a user