1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
From: Debian Go Packaging Team <team+pkg-go@tracker.debian.org>
Date: Fri, 11 Aug 2023 18:59:45 +0800
Subject: Remove geoip dependency for tests
Closes: #1034367
---
app/router/condition_geoip_test.go | 15 ++++++++++-----
app/router/condition_test.go | 11 ++++++-----
infra/conf/dns_test.go | 13 +++++++------
3 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/app/router/condition_geoip_test.go b/app/router/condition_geoip_test.go
index 9c73393..1a37b65 100644
--- a/app/router/condition_geoip_test.go
+++ b/app/router/condition_geoip_test.go
@@ -1,20 +1,20 @@
package router_test
import (
- "os"
- "path/filepath"
+// "os"
+// "path/filepath"
"testing"
"github.com/golang/protobuf/proto"
"v2ray.com/core/app/router"
"v2ray.com/core/common"
"v2ray.com/core/common/net"
- "v2ray.com/core/common/platform"
+// "v2ray.com/core/common/platform"
"v2ray.com/core/common/platform/filesystem"
)
func init() {
- wd, err := os.Getwd()
+/* wd, err := os.Getwd()
common.Must(err)
if _, err := os.Stat(platform.GetAssetLocation("geoip.dat")); err != nil && os.IsNotExist(err) {
@@ -22,10 +22,11 @@ func init() {
}
if _, err := os.Stat(platform.GetAssetLocation("geosite.dat")); err != nil && os.IsNotExist(err) {
common.Must(filesystem.CopyFile(platform.GetAssetLocation("geosite.dat"), filepath.Join(wd, "..", "..", "release", "config", "geosite.dat")))
- }
+ }*/
}
func TestGeoIPMatcherContainer(t *testing.T) {
+ t.Skip()
container := &router.GeoIPMatcherContainer{}
m1, err := container.Add(&router.GeoIP{
@@ -124,6 +125,7 @@ func TestGeoIPMatcher(t *testing.T) {
}
func TestGeoIPMatcher4CN(t *testing.T) {
+ t.Skip()
ips, err := loadGeoIP("CN")
common.Must(err)
@@ -136,6 +138,7 @@ func TestGeoIPMatcher4CN(t *testing.T) {
}
func TestGeoIPMatcher6US(t *testing.T) {
+ t.Skip()
ips, err := loadGeoIP("US")
common.Must(err)
@@ -167,6 +170,7 @@ func loadGeoIP(country string) ([]*router.CIDR, error) {
}
func BenchmarkGeoIPMatcher4CN(b *testing.B) {
+ b.Skip()
ips, err := loadGeoIP("CN")
common.Must(err)
@@ -181,6 +185,7 @@ func BenchmarkGeoIPMatcher4CN(b *testing.B) {
}
func BenchmarkGeoIPMatcher6US(b *testing.B) {
+ b.Skip()
ips, err := loadGeoIP("US")
common.Must(err)
diff --git a/app/router/condition_test.go b/app/router/condition_test.go
index 05d7346..0f4aad2 100644
--- a/app/router/condition_test.go
+++ b/app/router/condition_test.go
@@ -1,8 +1,8 @@
package router_test
import (
- "os"
- "path/filepath"
+// "os"
+// "path/filepath"
"strconv"
"testing"
@@ -12,7 +12,7 @@ import (
"v2ray.com/core/common"
"v2ray.com/core/common/errors"
"v2ray.com/core/common/net"
- "v2ray.com/core/common/platform"
+// "v2ray.com/core/common/platform"
"v2ray.com/core/common/platform/filesystem"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/protocol/http"
@@ -22,7 +22,7 @@ import (
)
func init() {
- wd, err := os.Getwd()
+/* wd, err := os.Getwd()
common.Must(err)
if _, err := os.Stat(platform.GetAssetLocation("geoip.dat")); err != nil && os.IsNotExist(err) {
@@ -30,7 +30,7 @@ func init() {
}
if _, err := os.Stat(platform.GetAssetLocation("geosite.dat")); err != nil && os.IsNotExist(err) {
common.Must(filesystem.CopyFile(platform.GetAssetLocation("geosite.dat"), filepath.Join(wd, "..", "..", "release", "config", "geosite.dat")))
- }
+ }*/
}
func withBackground() routing.Context {
@@ -353,6 +353,7 @@ func loadGeoSite(country string) ([]*Domain, error) {
}
func TestChinaSites(t *testing.T) {
+ t.Skip()
domains, err := loadGeoSite("CN")
common.Must(err)
diff --git a/infra/conf/dns_test.go b/infra/conf/dns_test.go
index 27ff084..514c4c6 100644
--- a/infra/conf/dns_test.go
+++ b/infra/conf/dns_test.go
@@ -3,21 +3,21 @@ package conf_test
import (
"encoding/json"
"os"
- "path/filepath"
+// "path/filepath"
"testing"
"github.com/golang/protobuf/proto"
"v2ray.com/core/app/dns"
- "v2ray.com/core/app/router"
- "v2ray.com/core/common"
+// "v2ray.com/core/app/router"
+// "v2ray.com/core/common"
"v2ray.com/core/common/net"
"v2ray.com/core/common/platform"
- "v2ray.com/core/common/platform/filesystem"
+// "v2ray.com/core/common/platform/filesystem"
. "v2ray.com/core/infra/conf"
)
func init() {
- wd, err := os.Getwd()
+/* wd, err := os.Getwd()
common.Must(err)
if _, err := os.Stat(platform.GetAssetLocation("geoip.dat")); err != nil && os.IsNotExist(err) {
@@ -43,10 +43,11 @@ func init() {
listBytes, err := proto.Marshal(list)
common.Must(err)
- common.Must2(geositeFile.Write(listBytes))
+ common.Must2(geositeFile.Write(listBytes))*/
}
func TestDNSConfigParsing(t *testing.T) {
+ t.Skip()
geositePath := platform.GetAssetLocation("geosite.dat")
defer func() {
os.Remove(geositePath)
|