VOL-3934 - TLS connection support
This is a bit of a breaking change as the current voltctl config
file defines verify as a string when it should have been a bool
from the start.
depends on merge of https://gerrit.opencord.org/c/voltha-lib-go/+/23594
Change-Id: Idb1f90a6bc827a599f2290bd276604997aab44e8
diff --git a/internal/pkg/commands/command_test.go b/internal/pkg/commands/command_test.go
index 68dd0a4..e0bd4bd 100644
--- a/internal/pkg/commands/command_test.go
+++ b/internal/pkg/commands/command_test.go
@@ -16,11 +16,12 @@
package commands
import (
- flags "github.com/jessevdk/go-flags"
- "github.com/stretchr/testify/assert"
"os"
"path"
"testing"
+
+ flags "github.com/jessevdk/go-flags"
+ "github.com/stretchr/testify/assert"
)
// Test that ProcessGlobalOptions does not interfere with GlobalConfig
@@ -39,58 +40,6 @@
assert.Equal(t, "localhost:55555", GlobalConfig.Server, "wrong default hostname for server")
}
-func TestSplitHostPort(t *testing.T) {
- data := []struct {
- name string
- endpoint string
- defaultHost string
- defaultPort int
- host string
- port int
- err bool
- }{
- {"Host and port specified", "host:1234", "default", 4321, "host", 1234, false},
- {"Host only specified", "host", "default", 4321, "host", 4321, false},
- {"Host: only specified", "host:", "default", 4321, "host", 4321, false},
- {"Port only specified", ":1234", "default", 4321, "default", 1234, false},
- {"Colon only", ":", "default", 4321, "default", 4321, false},
- {"Empty endpoint", "", "default", 4321, "default", 4321, false},
- {"IPv4 and port specified", "1.2.3.4:1234", "4.3.2.1", 4321, "1.2.3.4", 1234, false},
- {"IPv4 only specified", "1.2.3.4", "4.3.2.1", 4321, "1.2.3.4", 4321, false},
- {"IPv4: only specified", "1.2.3.4:", "4.3.2.1", 4321, "1.2.3.4", 4321, false},
- {"IPv4 Port only specified", ":1234", "4.3.2.1", 4321, "4.3.2.1", 1234, false},
- {"IPv4 Colon only", ":", "4.3.2.1", 4321, "4.3.2.1", 4321, false},
- {"IPv4 Empty endpoint", "", "4.3.2.1", 4321, "4.3.2.1", 4321, false},
- {"IPv6 and port specified", "[0001:c0ff:eec0::::ffff]:1234", "0001:c0ff:eec0::::aaaa", 4321, "0001:c0ff:eec0::::ffff", 1234, false},
- {"IPv6 only specified", "[0001:c0ff:eec0::::ffff]", "0001:c0ff:eec0::::aaaa", 4321, "0001:c0ff:eec0::::ffff", 4321, false},
- {"IPv6: only specified", "[0001:c0ff:eec0::::ffff]:", "0001:c0ff:eec0::::aaaa", 4321, "0001:c0ff:eec0::::ffff", 4321, false},
- {"IPv6 Port only specified", ":1234", "0001:c0ff:eec0::::aaaa", 4321, "0001:c0ff:eec0::::aaaa", 1234, false},
- {"IPv6 Colon only", ":", "0001:c0ff:eec0::::aaaa", 4321, "0001:c0ff:eec0::::aaaa", 4321, false},
- {"IPv6 Empty endpoint", "", "0001:c0ff:eec0::::aaaa", 4321, "0001:c0ff:eec0::::aaaa", 4321, false},
- {"Invalid port", "host:1b", "default", 4321, "", 0, true},
- {"Too many colons", "ho:st:1b", "default", 4321, "", 0, true},
- {"IPv4 Invalid port", "1.2.3.4:1b", "4.3.2.1", 4321, "", 0, true},
- {"IPv4 Too many colons", "1.2.3.4::1234", "4.3.2.1", 4321, "", 0, true},
- {"IPv6 Invalid port", "[0001:c0ff:eec0::::ffff]:1b", "0001:c0ff:eec0::::aaaa", 4321, "", 0, true},
- {"IPv6 Too many colons", "0001:c0ff:eec0::::ffff:1234", "0001:c0ff:eec0::::aaaa", 4321, "", 0, true},
- }
-
- for _, args := range data {
- t.Run(args.name, func(t *testing.T) {
- h, p, err := splitEndpoint(args.endpoint, args.defaultHost, args.defaultPort)
- if args.err {
- assert.NotNil(t, err, "unexpected non-error result")
- } else {
- assert.Nil(t, err, "unexpected error result")
- }
- if !args.err && err == nil {
- assert.Equal(t, args.host, h, "unexpected host value")
- assert.Equal(t, args.port, p, "unexpected port value")
- }
- })
- }
-}
-
func TestParseSize(t *testing.T) {
var res uint64
var err error