mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
62dabd67a2
Consistently using t.Fatal* simplifies the test code and makes it less fragile, since it is common error
to forget to make proper cleanup after t.Error* call. Also t.Error* calls do not provide any practical
benefits when some tests fail. They just clutter test output with additional noise information,
which do not help in fixing failing tests most of the time.
While at it, improve errors generated at app/victoria-metrics tests, so they contain more useful information
when debugging failed tests.
This is a follow-up for a9525da8a4
17 lines
290 B
Go
17 lines
290 B
Go
package test
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/golang/snappy"
|
|
)
|
|
|
|
// Compress marshals and compresses wr.
|
|
func Compress(wr WriteRequest) []byte {
|
|
data, err := wr.Marshal()
|
|
if err != nil {
|
|
panic(fmt.Errorf("BUG: cannot compress WriteRequest: %s", err))
|
|
}
|
|
return snappy.Encode(nil, data)
|
|
}
|