From 68f2f074d4ff580cfe956638afe36b983461f839 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Fri, 19 Feb 2021 01:04:26 +0100 Subject: [tests] fix gateways tests --- pkg/vpn/bonafide/gateways.go | 2 +- pkg/vpn/bonafide/gateways_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'pkg/vpn') 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") } -- cgit v1.2.3