Skip to content

Commit

Permalink
docs: fix and update coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed Nov 19, 2022
1 parent 0c07f2b commit 2bc43f2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,18 @@ go run apt-proxy.go
```bash
# go test -cover ./...
? github.com/soulteary/apt-proxy [no test files]
ok github.com/soulteary/apt-proxy/cli (cached) coverage: 57.6% of statements
ok github.com/soulteary/apt-proxy/internal/benchmark (cached) coverage: 91.9% of statements
ok github.com/soulteary/apt-proxy/internal/mirrors (cached) coverage: 79.4% of statements
ok github.com/soulteary/apt-proxy/internal/rewriter (cached) coverage: 71.2% of statements
? github.com/soulteary/apt-proxy/internal/server [no test files]
ok github.com/soulteary/apt-proxy/internal/state (cached) coverage: 79.5% of statements
ok github.com/soulteary/apt-proxy/pkg/httpcache (cached) coverage: 82.5% of statements
ok github.com/soulteary/apt-proxy/cli 1.673s coverage: 57.6% of statements
ok github.com/soulteary/apt-proxy/internal/benchmark 4.996s coverage: 91.9% of statements
ok github.com/soulteary/apt-proxy/internal/define 0.143s coverage: 94.1% of statements
ok github.com/soulteary/apt-proxy/internal/mirrors 1.502s coverage: 72.6% of statements
ok github.com/soulteary/apt-proxy/internal/rewriter 5.725s coverage: 69.0% of statements
ok github.com/soulteary/apt-proxy/internal/server 0.491s coverage: 50.9% of statements
ok github.com/soulteary/apt-proxy/internal/state 0.415s coverage: 100.0% of statements
ok github.com/soulteary/apt-proxy/pkg/httpcache 0.891s coverage: 82.5% of statements
? github.com/soulteary/apt-proxy/pkg/httplog [no test files]
ok github.com/soulteary/apt-proxy/pkg/stream.v1 (cached) coverage: 100.0% of statements
ok github.com/soulteary/apt-proxy/pkg/stream.v1 0.596s coverage: 100.0% of statements
? github.com/soulteary/apt-proxy/pkg/system [no test files]
ok github.com/soulteary/apt-proxy/pkg/vfs (cached) coverage: 58.9% of statements
ok github.com/soulteary/apt-proxy/pkg/vfs 0.322s coverage: 58.9% of statements
```
View coverage report:
Expand Down
19 changes: 10 additions & 9 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,18 @@ go run apt-proxy.go
```bash
# go test -cover ./...
? github.com/soulteary/apt-proxy [no test files]
ok github.com/soulteary/apt-proxy/cli (cached) coverage: 57.6% of statements
ok github.com/soulteary/apt-proxy/internal/benchmark (cached) coverage: 91.9% of statements
ok github.com/soulteary/apt-proxy/internal/mirrors (cached) coverage: 79.4% of statements
ok github.com/soulteary/apt-proxy/internal/rewriter (cached) coverage: 71.2% of statements
? github.com/soulteary/apt-proxy/internal/server [no test files]
ok github.com/soulteary/apt-proxy/internal/state (cached) coverage: 79.5% of statements
ok github.com/soulteary/apt-proxy/pkg/httpcache (cached) coverage: 82.5% of statements
ok github.com/soulteary/apt-proxy/cli 1.673s coverage: 57.6% of statements
ok github.com/soulteary/apt-proxy/internal/benchmark 4.996s coverage: 91.9% of statements
ok github.com/soulteary/apt-proxy/internal/define 0.143s coverage: 94.1% of statements
ok github.com/soulteary/apt-proxy/internal/mirrors 1.502s coverage: 72.6% of statements
ok github.com/soulteary/apt-proxy/internal/rewriter 5.725s coverage: 69.0% of statements
ok github.com/soulteary/apt-proxy/internal/server 0.491s coverage: 50.9% of statements
ok github.com/soulteary/apt-proxy/internal/state 0.415s coverage: 100.0% of statements
ok github.com/soulteary/apt-proxy/pkg/httpcache 0.891s coverage: 82.5% of statements
? github.com/soulteary/apt-proxy/pkg/httplog [no test files]
ok github.com/soulteary/apt-proxy/pkg/stream.v1 (cached) coverage: 100.0% of statements
ok github.com/soulteary/apt-proxy/pkg/stream.v1 0.596s coverage: 100.0% of statements
? github.com/soulteary/apt-proxy/pkg/system [no test files]
ok github.com/soulteary/apt-proxy/pkg/vfs (cached) coverage: 58.9% of statements
ok github.com/soulteary/apt-proxy/pkg/vfs 0.322s coverage: 58.9% of statements
```
查看覆盖率报告:
Expand Down
13 changes: 9 additions & 4 deletions internal/rewriter/rewriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ import (

func TestGetRewriteRulesByMode(t *testing.T) {
rules := GetRewriteRulesByMode(Define.TYPE_LINUX_DISTROS_UBUNTU)
if rules[0].Pattern != Define.UBUNTU_DEFAULT_CACHE_RULES[0].Pattern {
if rules[0].OS != Define.TYPE_LINUX_DISTROS_UBUNTU {
t.Fatal("Pattern Not Match")
}

rules = GetRewriteRulesByMode(Define.TYPE_LINUX_DISTROS_DEBIAN)
if rules[0].Pattern != Define.DEBIAN_DEFAULT_CACHE_RULES[0].Pattern {
if rules[0].OS != Define.TYPE_LINUX_DISTROS_DEBIAN {
t.Fatal("Pattern Not Match")
}

rules = GetRewriteRulesByMode(Define.TYPE_LINUX_DISTROS_CENTOS)
if rules[0].OS != Define.TYPE_LINUX_DISTROS_CENTOS {
t.Fatal("Pattern Not Match")
}

rules = GetRewriteRulesByMode(Define.TYPE_LINUX_ALL_DISTROS)
if len(rules) != (len(Define.DEBIAN_DEFAULT_CACHE_RULES) + len(Define.UBUNTU_DEFAULT_CACHE_RULES)) {
t.Fatal("Pattern Length Not Match")
if rules[0].OS != Define.TYPE_LINUX_DISTROS_UBUNTU {
t.Fatal("Pattern Not Match")
}
}

Expand Down

0 comments on commit 2bc43f2

Please sign in to comment.