Move compression benchmark test data to gist

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
This commit is contained in:
Maksym Pavlenko 2018-09-17 11:53:56 -07:00
parent 4d7d63f390
commit 003b27eff4
No known key found for this signature in database
GPG Key ID: 4B17AAB3098F26DA
2 changed files with 23 additions and 5903 deletions

View File

@ -23,6 +23,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"math/rand" "math/rand"
"net/http"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
@ -30,6 +31,27 @@ import (
"testing" "testing"
) )
const benchmarkTestDataURL = "https://git.io/fADcl"
var benchmarkTestData []byte
func TestMain(m *testing.M) {
// Download test data for benchmark from gist
resp, err := http.Get(benchmarkTestDataURL)
if err != nil {
panic(err)
}
defer resp.Body.Close()
benchmarkTestData, err = ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
os.Exit(m.Run())
}
// generateData generates data that composed of 2 random parts // generateData generates data that composed of 2 random parts
// and single zero-filled part within them. // and single zero-filled part within them.
// Typically, the compression ratio would be about 67%. // Typically, the compression ratio would be about 67%.
@ -184,7 +206,7 @@ func TestCmdStreamBad(t *testing.T) {
func generateCompressedData(b *testing.B, sizeInMb int) []byte { func generateCompressedData(b *testing.B, sizeInMb int) []byte {
sizeInBytes := sizeInMb * 1024 * 1024 sizeInBytes := sizeInMb * 1024 * 1024
data, _ := ioutil.ReadFile("testdata/test.json") data := benchmarkTestData
for len(data) < sizeInBytes { for len(data) < sizeInBytes {
data = append(data, data...) data = append(data, data...)

File diff suppressed because it is too large Load Diff