From 3a45461c1927a3a1c54f2bc8e50bc956c8b41d56 Mon Sep 17 00:00:00 2001 From: macie Date: Tue, 12 Mar 2024 08:39:48 +0100 Subject: [PATCH] test: Remove broken integration test This tests fails when there are no specific binary files, but there is no method to get the files during test. Marking the tests as a skipped will gives us a false sense of security. So it's better to remove it at all. --- go.mod | 3 -- ruleset/builtins/geo/v2geo/load_test.go | 54 ------------------------- 2 files changed, 57 deletions(-) delete mode 100644 ruleset/builtins/geo/v2geo/load_test.go diff --git a/go.mod b/go.mod index e3e739e..75e54ef 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/quic-go/quic-go v0.41.0 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 - github.com/stretchr/testify v1.8.4 go.uber.org/zap v1.26.0 golang.org/x/crypto v0.19.0 golang.org/x/sys v0.17.0 @@ -22,7 +21,6 @@ require ( ) require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -32,7 +30,6 @@ require ( github.com/mdlayher/socket v0.1.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect diff --git a/ruleset/builtins/geo/v2geo/load_test.go b/ruleset/builtins/geo/v2geo/load_test.go deleted file mode 100644 index e9c901a..0000000 --- a/ruleset/builtins/geo/v2geo/load_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package v2geo - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestLoadGeoIP(t *testing.T) { - m, err := LoadGeoIP("geoip.dat") - assert.NoError(t, err) - - // Exact checks since we know the data. - assert.Len(t, m, 252) - assert.Equal(t, m["cn"].CountryCode, "CN") - assert.Len(t, m["cn"].Cidr, 10407) - assert.Equal(t, m["us"].CountryCode, "US") - assert.Len(t, m["us"].Cidr, 193171) - assert.Equal(t, m["private"].CountryCode, "PRIVATE") - assert.Len(t, m["private"].Cidr, 18) - assert.Contains(t, m["private"].Cidr, &CIDR{ - Ip: []byte("\xc0\xa8\x00\x00"), - Prefix: 16, - }) -} - -func TestLoadGeoSite(t *testing.T) { - m, err := LoadGeoSite("geosite.dat") - assert.NoError(t, err) - - // Exact checks since we know the data. - assert.Len(t, m, 1204) - assert.Equal(t, m["netflix"].CountryCode, "NETFLIX") - assert.Len(t, m["netflix"].Domain, 25) - assert.Contains(t, m["netflix"].Domain, &Domain{ - Type: Domain_Full, - Value: "netflix.com.edgesuite.net", - }) - assert.Contains(t, m["netflix"].Domain, &Domain{ - Type: Domain_RootDomain, - Value: "fast.com", - }) - assert.Len(t, m["google"].Domain, 1066) - assert.Contains(t, m["google"].Domain, &Domain{ - Type: Domain_RootDomain, - Value: "ggpht.cn", - Attribute: []*Domain_Attribute{ - { - Key: "cn", - TypedValue: &Domain_Attribute_BoolValue{BoolValue: true}, - }, - }, - }) -}