summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-02-19 01:04:26 +0100
committerkali kaneko (leap communications) <kali@leap.se>2021-05-04 14:58:39 +0200
commit68f2f074d4ff580cfe956638afe36b983461f839 (patch)
tree12dbb0614d1998b26820fa2cba377c7b49cd36fb /pkg
parent006bfb04789f94b458119fee7c0544bf9b04bfce (diff)
[tests] fix gateways tests
Diffstat (limited to 'pkg')
-rw-r--r--pkg/config/config.go1
-rw-r--r--pkg/vpn/bonafide/gateways.go2
-rw-r--r--pkg/vpn/bonafide/gateways_test.go12
3 files changed, 8 insertions, 7 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 4cce98d..24a88fb 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -7,4 +7,5 @@ var (
Auth = ""
APIURL = ""
GeolocationAPI = ""
+)
var CaCert = []byte("")
diff --git a/pkg/vpn/bonafide/gateways.go b/pkg/vpn/bonafide/gateways.go
index f454d3c..8bfcee0 100644
--- a/pkg/vpn/bonafide/gateways.go
+++ b/pkg/vpn/bonafide/gateways.go
@@ -40,7 +40,7 @@ type gatewayPool struct {
available []Gateway
userChoice []byte
/* ranked is, for now, just an array of hostnames (fetched from the
- geoip service). it should be a map in the future, to keep track of
+ menshen service). it should be a map in the future, to keep track of
quantitative metrics */
ranked []string
diff --git a/pkg/vpn/bonafide/gateways_test.go b/pkg/vpn/bonafide/gateways_test.go
index b88423f..42a7a95 100644
--- a/pkg/vpn/bonafide/gateways_test.go
+++ b/pkg/vpn/bonafide/gateways_test.go
@@ -37,28 +37,28 @@ func TestGatewayPool(t *testing.T) {
t.Fatal("gatewayPool labels not what expected. Got:", labels)
}
- if pool.userChoice != "" {
+ if pool.userChoice != nil {
t.Fatal("userChoice should be empty by default")
}
- err = pool.setUserChoice("foo")
+ err = pool.setUserChoice([]byte("foo"))
if err == nil {
t.Fatal("gatewayPool should not let you set a foo gateway")
}
- err = pool.setUserChoice("a-1")
+ err = pool.setUserChoice([]byte("a-1"))
if err != nil {
t.Fatal("location 'a-1' should be a valid label")
}
- err = pool.setUserChoice("c-2")
+ err = pool.setUserChoice([]byte("c-2"))
if err != nil {
t.Fatal("location 'c-2' should be a valid label")
}
- if pool.userChoice != "c-2" {
+ if string(pool.userChoice) != "c-2" {
t.Fatal("userChoice should be c-2")
}
pool.setAutomaticChoice()
- if pool.userChoice != "" {
+ if string(pool.userChoice) != "" {
t.Fatal("userChoice should be empty after auto selection")
}