test(tsdb/tsm1): skip long tests in short mode
The tsdb/tsm1 package was one of the test suites that took the longest to run in platform with go test -short. The rule of thumb on the Go project is that short mode should skip any individual test that takes longer than one second. This change skips two such tests, and it eliminates a string concatenation loop in two other tests, so that they report completion in "0.00s" rather than about 0.94s, on my machine. These cumulative changes take `go test -short ./tsdb/tsm1` from about 14 seconds to about 7 seconds on my machine.pull/10616/head
parent
5b575143e6
commit
8ab01c99c0
|
@ -656,6 +656,10 @@ func TestEngine_DeleteSeriesRange_OutsideTime(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestEngine_LastModified(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping test in short mode")
|
||||
}
|
||||
|
||||
// Create a few points.
|
||||
p1 := MustParsePointString("cpu,host=A value=1.1 1000000000")
|
||||
p2 := MustParsePointString("cpu,host=B value=1.2 2000000000")
|
||||
|
|
|
@ -2418,6 +2418,10 @@ func TestFileStore_Remove(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestFileStore_Replace(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping test in short mode")
|
||||
}
|
||||
|
||||
dir := MustTempDir()
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
|
@ -2505,7 +2509,6 @@ func TestFileStore_Replace(t *testing.T) {
|
|||
if _, err := os.Stat(files[2]); err != nil {
|
||||
t.Fatalf("stat file: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestFileStore_Open_Deleted(t *testing.T) {
|
||||
|
|
|
@ -556,12 +556,8 @@ func TestTSMWriter_WriteBlock_MaxKey(t *testing.T) {
|
|||
t.Fatalf("unexpected error creating writer: %v", err)
|
||||
}
|
||||
|
||||
var key string
|
||||
for i := 0; i < 100000; i++ {
|
||||
key += "a"
|
||||
}
|
||||
|
||||
if err := w.WriteBlock([]byte(key), 0, 0, nil); err != tsm1.ErrMaxKeyLengthExceeded {
|
||||
key := bytes.Repeat([]byte("a"), 100000)
|
||||
if err := w.WriteBlock(key, 0, 0, nil); err != tsm1.ErrMaxKeyLengthExceeded {
|
||||
t.Fatalf("expected max key length error writing key: %v", err)
|
||||
}
|
||||
}
|
||||
|
@ -577,11 +573,8 @@ func TestTSMWriter_Write_MaxKey(t *testing.T) {
|
|||
t.Fatalf("unexpected error created writer: %v", err)
|
||||
}
|
||||
|
||||
var key string
|
||||
for i := 0; i < 100000; i++ {
|
||||
key += "a"
|
||||
}
|
||||
if err := w.Write([]byte(key), []tsm1.Value{tsm1.NewValue(0, 1.0)}); err != tsm1.ErrMaxKeyLengthExceeded {
|
||||
key := bytes.Repeat([]byte("a"), 100000)
|
||||
if err := w.Write(key, []tsm1.Value{tsm1.NewValue(0, 1.0)}); err != tsm1.ErrMaxKeyLengthExceeded {
|
||||
t.Fatalf("expected max key length error writing key: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue