增加刷新、预热缓存任务管理

This commit is contained in:
刘祥超
2022-06-05 17:13:56 +08:00
parent 95a2187f95
commit 71677a8638
20 changed files with 1362 additions and 78 deletions

View File

@@ -0,0 +1,23 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package services
import (
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestHTTPCacheTaskService_CountHTTPCacheTasks(t *testing.T) {
var a = assert.NewAssertion(t)
var service = &HTTPCacheTaskService{}
a.IsTrue(service.parseDomain("aaa") == "aaa")
a.IsTrue(service.parseDomain("AAA") == "aaa")
a.IsTrue(service.parseDomain("a.b-c.com") == "a.b-c.com")
a.IsTrue(service.parseDomain("a.b-c.com/hello/world") == "a.b-c.com")
a.IsTrue(service.parseDomain("https://a.b-c.com") == "a.b-c.com")
a.IsTrue(service.parseDomain("http://a.b-c.com/hello/world") == "a.b-c.com")
a.IsTrue(service.parseDomain("http://a.B-c.com/hello/world") == "a.b-c.com")
a.IsTrue(service.parseDomain("http:/aaaa.com") == "http")
a.IsTrue(service.parseDomain("北京") == "")
}