Skip to content

Commit

Permalink
Chore: Drop dead code in test (#4012)
Browse files Browse the repository at this point in the history
  • Loading branch information
zonescape authored Nov 13, 2024
1 parent 7b4a686 commit 83ae384
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions infra/conf/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"testing"

"github.com/xtls/xray-core/app/dns"
"github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/platform"
Expand All @@ -24,32 +23,11 @@ func init() {
common.Must(filesystem.CopyFile(platform.GetAssetLocation("geoip.dat"), filepath.Join(wd, "..", "..", "resources", "geoip.dat")))
}

geositeFilePath := filepath.Join(wd, "geosite.dat")
os.Setenv("xray.location.asset", wd)
geositeFile, err := os.OpenFile(geositeFilePath, os.O_CREATE|os.O_WRONLY, 0o600)
common.Must(err)
defer geositeFile.Close()

list := &router.GeoSiteList{
Entry: []*router.GeoSite{
{
CountryCode: "TEST",
Domain: []*router.Domain{
{Type: router.Domain_Full, Value: "example.com"},
},
},
},
}

listBytes, err := proto.Marshal(list)
common.Must(err)
common.Must2(geositeFile.Write(listBytes))
}

func TestDNSConfigParsing(t *testing.T) {
geositePath := platform.GetAssetLocation("geosite.dat")
defer func() {
os.Remove(geositePath)
os.Unsetenv("xray.location.asset")
}()

Expand Down

0 comments on commit 83ae384

Please sign in to comment.