mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
* upgrade to fiber v2 * code format * remove redundant variables * remove useless exportable variables/functions * go mod replace use our own mirror now. * add test case for converter, use deferInit to make test more simple * remove useless file and fix typo * Makefile change * upgrade to go 1.15 * remove wrong go test comments * complete test case, coverage, coverage badge * Fix version typo * config struct fix * add banner, show version, add server header, remove fiber startup message Co-authored-by: n0vad3v <n0vad3v@riseup.net>
30 lines
584 B
Go
30 lines
584 B
Go
// webp_server_go - prefetch_test.go
|
|
// 2020-11-10 09:27
|
|
// Benny <benny.think@gmail.com>
|
|
|
|
package main
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestPrefetchImages(t *testing.T) {
|
|
// single thread
|
|
fp := "./prefetch"
|
|
_ = os.Mkdir(fp, 0755)
|
|
prefetchImages("./pics", "./prefetch", "80")
|
|
count := fileCount("./prefetch")
|
|
assert.Equal(t, 6, count)
|
|
_ = os.RemoveAll(fp)
|
|
|
|
// concurrency
|
|
jobs = 2
|
|
_ = os.Mkdir(fp, 0755)
|
|
prefetchImages("./pics", "./prefetch", "80")
|
|
count = fileCount("./prefetch")
|
|
assert.Equal(t, 4, count)
|
|
_ = os.RemoveAll(fp)
|
|
}
|