(t *testing.T)
| 117 | } |
| 118 | |
| 119 | func TestFileList_Exist(t *testing.T) { |
| 120 | if !testutils.IsSingleTesting() { |
| 121 | return |
| 122 | } |
| 123 | |
| 124 | var list = caches.NewSQLiteFileList(Tea.Root + "/data/cache-index/p1").(*caches.SQLiteFileList) |
| 125 | defer func() { |
| 126 | _ = list.Close() |
| 127 | }() |
| 128 | |
| 129 | err := list.Init() |
| 130 | if err != nil { |
| 131 | t.Fatal(err) |
| 132 | } |
| 133 | |
| 134 | total, _ := list.Count() |
| 135 | t.Log("total:", total) |
| 136 | |
| 137 | var before = time.Now() |
| 138 | defer func() { |
| 139 | t.Log(time.Since(before).Seconds()*1000, "ms") |
| 140 | }() |
| 141 | { |
| 142 | var hash = stringutil.Md5("123456") |
| 143 | exists, _, err := list.Exist(hash) |
| 144 | if err != nil { |
| 145 | t.Fatal(err) |
| 146 | } |
| 147 | t.Log(hash, "exists:", exists) |
| 148 | } |
| 149 | { |
| 150 | var hash = stringutil.Md5("http://edge.teaos.cn/1234561") |
| 151 | exists, _, err := list.Exist(hash) |
| 152 | if err != nil { |
| 153 | t.Fatal(err) |
| 154 | } |
| 155 | t.Log(hash, "exists:", exists) |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | func TestFileList_Exist_Many_DB(t *testing.T) { |
| 160 | if !testutils.IsSingleTesting() { |
nothing calls this directly
no test coverage detected