ci: optimize benchmarks

We are not using the benchmark results for anything, they are mostly
there to ensure that we don't break the benchmarks. So we can disable
CockroachDB for them.

Similarly add short versions of other tests.

Also try to precompile test/benchmark code.

Change-Id: I60b501789f70c289af68c37a052778dc75ae2b69
This commit is contained in:
Egon Elbre 2021-10-08 16:36:58 +03:00
parent f837551d76
commit 9fd091831d
5 changed files with 23 additions and 12 deletions

View File

@ -51,11 +51,13 @@ pipeline {
stage('go') {
steps {
sh 'go build -v ./...'
sh 'go test -v -p 16 -bench XYZXYZXYZXYZ -run XYZXYZXYZXYZ ./...'
}
}
stage('go -race') {
steps {
sh 'go build -v -race ./...'
sh 'go test -v -p 16 -bench XYZXYZXYZXYZ -run XYZXYZXYZXYZ -race ./...'
// install storj-sim
sh 'go install -race -v storj.io/storj/cmd/satellite '+
@ -92,11 +94,9 @@ pipeline {
steps {
dir('web/satellite') {
sh 'npm ci --prefer-offline --no-audit'
sh 'npm run wasm-dev'
sh 'npm run build'
}
sh 'cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" web/satellite/static/wasm/wasm_exec.js'
sh 'GOOS=js GOARCH=wasm go build -o web/satellite/static/wasm/access.wasm storj.io/storj/satellite/console/wasm'
}
}
stage('web/storagenode') {
@ -212,11 +212,10 @@ pipeline {
stage('Check Benchmark') {
environment {
STORJ_TEST_COCKROACH = 'cockroach://root@localhost:26256/benchcockroach?sslmode=disable'
STORJ_TEST_COCKROACH = 'omit'
STORJ_TEST_POSTGRES = 'postgres://postgres@localhost/benchstorj?sslmode=disable'
}
steps {
sh 'cockroach sql --insecure --host=localhost:26256 -e \'create database benchcockroach;\''
sh 'psql -U postgres -c \'create database benchstorj;\''
sh 'go test -parallel 1 -p 1 -vet=off -timeout 20m -short -run XYZXYZXYZXYZ -bench . -benchtime 1x ./...'
}

View File

@ -48,7 +48,7 @@ func (handler *SleepyHandler) Handle(ctx context.Context, node storj.NodeURL, qu
}
func BenchmarkCombiner(b *testing.B) {
const (
var (
// currently nodes are picked uniformly, however total piece distribution is not
// hence we use a lower number to simulate frequent nodes
nodeCount = 500
@ -58,17 +58,18 @@ func BenchmarkCombiner(b *testing.B) {
// we cannot use realistic values here due to sleep granularity
minWait = 1 * time.Millisecond
maxWait = 20 * time.Millisecond
// add few variations to test
activeLimits = []int{8, 32, 64, -1}
queueSizes = []int{1, 8, 64, 128, -1}
)
var activeLimits []int
var queueSizes []int
if testing.Short() {
// use values to make tests run faster
nodeCount = 5
requestCount = 5
callsPerRequest = 5
activeLimits = []int{8, 64, -1}
queueSizes = []int{8, 128, -1}
} else {
activeLimits = []int{8, 32, 64, -1}
queueSizes = []int{1, 8, 64, 128, -1}
}
nodes := []storj.NodeURL{}

View File

@ -24,6 +24,9 @@ func RunBenchmarks(b *testing.B, store storage.KeyValueStore) {
}
words = words[:20] // branching factor
if testing.Short() {
words = words[:2]
}
var items storage.Items

View File

@ -8,6 +8,7 @@
"lint-ci": "vue-cli-service lint --max-warnings 0 --no-fix && stylelint . --max-warnings 0 --no-fix",
"build": "vue-cli-service build",
"wasm": "chmod +x ./scripts/build-wasm.sh && ./scripts/build-wasm.sh",
"wasm-dev": "chmod +x ./scripts/build-wasm-dev.sh && ./scripts/build-wasm-dev.sh",
"dev": "vue-cli-service build --mode development --watch",
"test": "vue-cli-service test:unit"
},

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Copy wasm javascript to match the go version
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./static/wasm
# Build wasm code
GOOS=js GOARCH=wasm go build -o ./static/wasm/access.wasm storj.io/storj/satellite/console/wasm