Skip to content

Commit

Permalink
use space
Browse files Browse the repository at this point in the history
  • Loading branch information
chenpeng02 committed Feb 20, 2019
1 parent b371df6 commit 6314676
Show file tree
Hide file tree
Showing 19 changed files with 2,272 additions and 2,230 deletions.
425 changes: 212 additions & 213 deletions backend/backends.go

Large diffs are not rendered by default.

76 changes: 38 additions & 38 deletions backend/backends_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,51 @@
package backend

import (
"testing"
"time"
"testing"
"time"
)

func TestCache(t *testing.T) {
cfg, ts := CreateTestBackendConfig("test")
defer ts.Close()
bs, err := NewBackends(cfg, "test", ".")
if err != nil {
t.Errorf("error: %s", err)
return
}
defer bs.Close()
cfg, ts := CreateTestBackendConfig("test")
defer ts.Close()
bs, err := NewBackends(cfg, "test", ".")
if err != nil {
t.Errorf("error: %s", err)
return
}
defer bs.Close()

err = bs.Write([]byte("cpu,host=server01,region=uswest value=1 1434055562000000000"))
if err != nil {
t.Errorf("error: %s", err)
return
}
err = bs.Write([]byte("cpu,host=server01,region=uswest value=1 1434055562000000000"))
if err != nil {
t.Errorf("error: %s", err)
return
}

err = bs.Write([]byte("cpu value=3,value2=4 1434055562000010000"))
if err != nil {
t.Errorf("error: %s", err)
return
}
err = bs.Write([]byte("cpu value=3,value2=4 1434055562000010000"))
if err != nil {
t.Errorf("error: %s", err)
return
}

time.Sleep(time.Second)
// FIXME: just once?
time.Sleep(time.Second)
// FIXME: just once?
}

func TestRewrite(t *testing.T) {
cfg, ts := CreateTestBackendConfig("test")
defer ts.Close()
bs, err := NewBackends(cfg, "test", ".")
if err != nil {
t.Errorf("error: %s", err)
return
}
defer bs.Close()
for i := 0; i < 100; i++ {
err := bs.fb.Write([]byte("cpu value=3,value2=4 1434055562000010000"))
if err != nil {
t.Errorf("error: %s", err)
return
}
}
time.Sleep(2 * time.Second)
cfg, ts := CreateTestBackendConfig("test")
defer ts.Close()
bs, err := NewBackends(cfg, "test", ".")
if err != nil {
t.Errorf("error: %s", err)
return
}
defer bs.Close()
for i := 0; i < 100; i++ {
err := bs.fb.Write([]byte("cpu value=3,value2=4 1434055562000010000"))
if err != nil {
t.Errorf("error: %s", err)
return
}
}
time.Sleep(2 * time.Second)
}
Loading

0 comments on commit 6314676

Please sign in to comment.