This updates the current unit tests for testify
This commit removes any assertion from Go's "testing" package, preferring instead to use an assertion from the testify package. All tests now have uniformity. This also decrease the number of iterations in the password generation test, decreasing test runtime tenfold Change-Id: I8799110e93dfa19bebe9050528e865b4c991c3df
This commit is contained in:
parent
f24abc6033
commit
d775b2159a
@ -18,7 +18,6 @@ package config
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -49,12 +48,11 @@ func TestGetCluster(t *testing.T) {
|
||||
// Retrieve one of the test
|
||||
theClusterIWant, err := conf.GetCluster(tname, tctype)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, theClusterIWant)
|
||||
|
||||
err = conf.Purge()
|
||||
require.NoErrorf(t, err, "unexpected error , unable to Purge before persisting the expected configuration: %v", err)
|
||||
require.NoError(t, err, "Unable to Purge before persisting the expected configuration")
|
||||
err = conf.PersistConfig()
|
||||
require.NoErrorf(t, err, "unexpected error , unable to Persist the expected configuration: %v", err)
|
||||
require.NoError(t, err, "Unable to Persist the expected configuration")
|
||||
|
||||
test := getClusterTest{
|
||||
config: conf,
|
||||
@ -71,12 +69,43 @@ func TestGetCluster(t *testing.T) {
|
||||
func TestGetAllClusters(t *testing.T) {
|
||||
conf := config.InitConfig(t)
|
||||
|
||||
expected := ""
|
||||
clusters, err := conf.GetClusters()
|
||||
require.NoError(t, err)
|
||||
for _, cluster := range clusters {
|
||||
expected += fmt.Sprintf("%s\n", cluster.PrettyString())
|
||||
}
|
||||
expected := `Cluster: def
|
||||
ephemeral:
|
||||
bootstrap-info: ""
|
||||
cluster-kubeconf: def_ephemeral
|
||||
|
||||
LocationOfOrigin: ../../pkg/config/testdata/kubeconfig.yaml
|
||||
insecure-skip-tls-verify: true
|
||||
server: http://5.6.7.8
|
||||
|
||||
Cluster: def
|
||||
target:
|
||||
bootstrap-info: ""
|
||||
cluster-kubeconf: def_target
|
||||
|
||||
LocationOfOrigin: ../../pkg/config/testdata/kubeconfig.yaml
|
||||
insecure-skip-tls-verify: true
|
||||
server: http://1.2.3.4
|
||||
|
||||
Cluster: onlyinkubeconf
|
||||
target:
|
||||
bootstrap-info: ""
|
||||
cluster-kubeconf: onlyinkubeconf_target
|
||||
|
||||
LocationOfOrigin: ../../pkg/config/testdata/kubeconfig.yaml
|
||||
insecure-skip-tls-verify: true
|
||||
server: http://9.10.11.12
|
||||
|
||||
Cluster: wrongonlyinkubeconf
|
||||
target:
|
||||
bootstrap-info: ""
|
||||
cluster-kubeconf: wrongonlyinkubeconf_target
|
||||
|
||||
LocationOfOrigin: ../../pkg/config/testdata/kubeconfig.yaml
|
||||
certificate-authority: cert_file
|
||||
server: ""
|
||||
|
||||
`
|
||||
|
||||
test := getClusterTest{
|
||||
config: conf,
|
||||
@ -97,10 +126,10 @@ func (test getClusterTest) run(t *testing.T) {
|
||||
cmd.SetOutput(buf)
|
||||
cmd.SetArgs(test.args)
|
||||
err := cmd.Flags().Parse(test.flags)
|
||||
require.NoErrorf(t, err, "unexpected error flags args to command: %v, flags: %v", err, test.flags)
|
||||
require.NoErrorf(t, err, "unexpected error flags args to command: %v, flags: %v", err, test.flags)
|
||||
|
||||
err = cmd.Execute()
|
||||
assert.NoErrorf(t, err, "unexpected error executing command: %v", err)
|
||||
require.NoError(t, err)
|
||||
if len(test.expected) != 0 {
|
||||
assert.EqualValues(t, test.expected, buf.String())
|
||||
}
|
||||
|
@ -93,8 +93,9 @@ func TestSetClusterWithCAFileData(t *testing.T) {
|
||||
|
||||
expkCluster := kubeconfig.NewCluster()
|
||||
readData, err := ioutil.ReadFile(certFile)
|
||||
require.NoError(t, err)
|
||||
|
||||
expkCluster.CertificateAuthorityData = readData
|
||||
assert.Nil(t, err)
|
||||
expkCluster.InsecureSkipTLSVerify = false
|
||||
expconf.KubeConfig().Clusters[clusterName.Name()] = expkCluster
|
||||
|
||||
@ -225,22 +226,18 @@ func (test setClusterTest) run(t *testing.T) {
|
||||
require.NotNil(t, afterRunCluster)
|
||||
|
||||
afterKcluster := afterRunCluster.KubeCluster()
|
||||
require.NotNil(t, afterKcluster)
|
||||
|
||||
testKcluster := test.config.KubeConfig().
|
||||
Clusters[test.config.Clusters[test.args[0]].ClusterTypes[tctype].NameInKubeconf]
|
||||
|
||||
require.NotNilf(t, afterKcluster,
|
||||
"Fail in %q\n expected cluster server %v\n but got nil \n",
|
||||
test.description,
|
||||
testKcluster.Server)
|
||||
|
||||
assert.EqualValues(t, afterKcluster.Server, testKcluster.Server)
|
||||
|
||||
// Test that the Return Message looks correct
|
||||
if len(test.expected) != 0 {
|
||||
assert.EqualValuesf(t, buf.String(), test.expected, "expected %v, but got %v", test.expected, buf.String())
|
||||
assert.EqualValues(t, test.expected, buf.String())
|
||||
}
|
||||
|
||||
config.Clean(test.config)
|
||||
config.Clean(afterRunConf)
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"opendev.org/airship/airshipctl/cmd"
|
||||
"opendev.org/airship/airshipctl/cmd/bootstrap"
|
||||
@ -36,18 +37,16 @@ func TestRoot(t *testing.T) {
|
||||
}
|
||||
|
||||
func getVanillaRootCmd(t *testing.T) *cobra.Command {
|
||||
t.Helper()
|
||||
rootCmd, _, err := cmd.NewRootCmd(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not create root command: %s", err.Error())
|
||||
}
|
||||
require.NoError(t, err, "Could not create root commands")
|
||||
return rootCmd
|
||||
}
|
||||
|
||||
func getDefaultRootCmd(t *testing.T) *cobra.Command {
|
||||
t.Helper()
|
||||
rootCmd, _, err := cmd.NewAirshipCTLCommand(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not create root command: %s", err.Error())
|
||||
}
|
||||
require.NoError(t, err, "Could not create root commands")
|
||||
return rootCmd
|
||||
}
|
||||
|
||||
|
35
go.mod
35
go.mod
@ -9,22 +9,12 @@ require (
|
||||
github.com/Microsoft/go-winio v0.4.12 // indirect
|
||||
github.com/Nordix/go-redfish v0.0.0-20191016123452-b7790941aa86
|
||||
github.com/Nordix/go-redfish/client v0.0.0-20191016123452-b7790941aa86
|
||||
github.com/argoproj/argo v2.3.0+incompatible
|
||||
github.com/argoproj/pkg v0.0.0-20190409001913-7e3ef65c8d44 // indirect
|
||||
github.com/blang/semver v3.5.1+incompatible // indirect
|
||||
github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1 // indirect
|
||||
github.com/colinmarc/hdfs v0.0.0-20180802165501-48eb8d6c34a9 // indirect
|
||||
github.com/coreos/bbolt v1.3.2 // indirect
|
||||
github.com/coreos/etcd v3.3.13+incompatible // indirect
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e // indirect
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
|
||||
github.com/daviddengcn/go-colortext v0.0.0-20180409174941-186a3d44e920 // indirect
|
||||
github.com/docker/distribution v0.0.0-20170726174610-edc3ab29cdff // indirect
|
||||
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0
|
||||
github.com/docker/go-connections v0.3.0 // indirect
|
||||
github.com/docker/go-units v0.3.3 // indirect
|
||||
github.com/docker/libnetwork v0.0.0-20180830151422-a9cd636e3789 // indirect
|
||||
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
|
||||
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect
|
||||
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
|
||||
@ -36,48 +26,26 @@ require (
|
||||
github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995 // indirect
|
||||
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e // indirect
|
||||
github.com/google/btree v1.0.0 // indirect
|
||||
github.com/google/go-cmp v0.2.0
|
||||
github.com/gophercloud/gophercloud v0.1.0 // indirect
|
||||
github.com/gorilla/mux v1.7.2 // indirect
|
||||
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.1 // indirect
|
||||
github.com/imdario/mergo v0.3.7 // indirect
|
||||
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03 // indirect
|
||||
github.com/jonboulle/clockwork v0.1.0 // indirect
|
||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
|
||||
github.com/lithammer/dedent v1.1.0 // indirect
|
||||
github.com/mholt/caddy v1.0.0 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
|
||||
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c // indirect
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
|
||||
github.com/opencontainers/image-spec v1.0.1 // indirect
|
||||
github.com/pborman/uuid v1.2.0 // indirect
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||
github.com/russross/blackfriday v1.5.2 // indirect
|
||||
github.com/sirupsen/logrus v1.4.1 // indirect
|
||||
github.com/soheilhy/cmux v0.1.4 // indirect
|
||||
github.com/spf13/cobra v0.0.3
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
|
||||
github.com/valyala/fasttemplate v1.0.1 // indirect
|
||||
github.com/vishvananda/netlink v0.0.0-20171020171820-b2de5d10e38e // indirect
|
||||
github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936 // indirect
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
|
||||
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1 // indirect
|
||||
go.etcd.io/bbolt v1.3.2 // indirect
|
||||
go.uber.org/atomic v1.4.0 // indirect
|
||||
go.uber.org/multierr v1.1.0 // indirect
|
||||
go.uber.org/zap v1.10.0 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
|
||||
gopkg.in/jcmturner/aescts.v1 v1.0.1 // indirect
|
||||
gopkg.in/jcmturner/dnsutils.v1 v1.0.1 // indirect
|
||||
gopkg.in/jcmturner/goidentity.v2 v2.0.0 // indirect
|
||||
gopkg.in/jcmturner/gokrb5.v5 v5.3.0 // indirect
|
||||
gopkg.in/jcmturner/rpc.v0 v0.0.2 // indirect
|
||||
gotest.tools v2.2.0+incompatible // indirect
|
||||
k8s.io/api v0.0.0-20190516230258-a675ac48af67 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.0.0-20190516231611-bf6753f2aa24 // indirect
|
||||
@ -86,10 +54,7 @@ require (
|
||||
k8s.io/cli-runtime v0.0.0-20190516231937-17bc0b7fcef5 // indirect
|
||||
k8s.io/client-go v11.0.1-0.20190516230509-ae8359b20417+incompatible
|
||||
k8s.io/cloud-provider v0.0.0-20190516232619-2bf8e45c8454 // indirect
|
||||
k8s.io/cluster-bootstrap v0.0.0-20190516232516-d7d78ab2cfe7 // indirect
|
||||
k8s.io/component-base v0.0.0-20190516230545-9b07ebd4193b // indirect
|
||||
k8s.io/kube-proxy v0.0.0-20190516232141-b2acb7b92548 // indirect
|
||||
k8s.io/kubelet v0.0.0-20190516232236-412e4380c1a8 // indirect
|
||||
k8s.io/kubernetes v1.14.2
|
||||
k8s.io/metrics v0.0.0-20190516231729-8b83d5daaa8f // indirect
|
||||
k8s.io/utils v0.0.0-20190529001817-6999998975a7 // indirect
|
||||
|
118
go.sum
118
go.sum
@ -3,6 +3,7 @@ cloud.google.com/go v0.34.0 h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
contrib.go.opencensus.io/exporter/ocagent v0.4.12 h1:jGFvw3l57ViIVEPKKEUXPcLYIXJmQxLUh6ey1eJhwyc=
|
||||
contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
|
||||
github.com/Azure/go-autorest/autorest v0.2.0 h1:zBtSTOQTtjzHVRe+mhkiHvHwRTKHhjBEyo1m6DfI3So=
|
||||
github.com/Azure/go-autorest/autorest v0.2.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg=
|
||||
@ -10,6 +11,7 @@ github.com/Azure/go-autorest/autorest/adal v0.1.0 h1:RSw/7EAullliqwkZvgIGDYZWQm1
|
||||
github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E=
|
||||
github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM=
|
||||
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.1.0 h1:Kx+AUU2Te+A3JIyYn6Dfs+cFgx5XorQKuIXrZGoq/SI=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
|
||||
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
|
||||
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
|
||||
@ -19,6 +21,7 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e h1:eb0Pzkt15Bm7f2FFYv7sjY7NPFi3cPkS3tv1CcrFBWA=
|
||||
github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
|
||||
github.com/Microsoft/go-winio v0.4.12 h1:xAfWHN1IrQ0NJ9TBC0KBZoqLjzDTr1ML+4MywiUOryc=
|
||||
github.com/Microsoft/go-winio v0.4.12/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
|
||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
||||
github.com/Nordix/go-redfish v0.0.0-20191016123452-b7790941aa86 h1:+Myox4ydvtWzVSnvF/ZjABEA7RDiPRgE3sS5u4oQsHk=
|
||||
@ -36,30 +39,13 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/argoproj/argo v2.3.0+incompatible h1:L1OYZ86Q7NK19ahdl/eJOq78Mlf52wUKGmp7VDNQVz8=
|
||||
github.com/argoproj/argo v2.3.0+incompatible/go.mod h1:KJ0MB+tuhtAklR4jkPM10mIZXfRA0peTYJ1sLUnFLVU=
|
||||
github.com/argoproj/pkg v0.0.0-20190409001913-7e3ef65c8d44 h1:fqYoz7qu4K8/mBdm/N1p7qKtdPhlwOSHlTQoAu4rATs=
|
||||
github.com/argoproj/pkg v0.0.0-20190409001913-7e3ef65c8d44/go.mod h1:2EZ44RG/CcgtPTwrRR0apOc7oU6UIw8GjCUJWZ8X3bM=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/bifurcation/mint v0.0.0-20180715133206-93c51c6ce115/go.mod h1:zVt7zX3K/aDCk9Tj+VM7YymsX66ERvzCJzw8rFCX2JU=
|
||||
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
|
||||
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.0 h1:LzQXZOgg4CQfE6bFvXGM30YZL1WW/M337pXml+GrcZ4=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1 h1:HD4PLRzjuCVW79mQ0/pdsalOLHJ+FaEoqJLxfltpb2U=
|
||||
github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw=
|
||||
github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/colinmarc/hdfs v0.0.0-20180802165501-48eb8d6c34a9 h1:hJqIlFDcaaBLEBkCuqyEtzSsloo/h+lm08Qrq1OM/e8=
|
||||
github.com/colinmarc/hdfs v0.0.0-20180802165501-48eb8d6c34a9/go.mod h1:0DumPviB681UcSuJErAbDIOx6SIaJWj463TymfZG02I=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ=
|
||||
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
@ -76,16 +62,14 @@ github.com/docker/go-connections v0.3.0 h1:3lOnM9cSzgGwx8VfK/NGOW5fLQ0GjIlCkaktF
|
||||
github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
|
||||
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=
|
||||
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/docker/libnetwork v0.0.0-20180830151422-a9cd636e3789 h1:8rOK787QQFFZJcOLXPiKKidY/ie2OQpblM5gEAaenPs=
|
||||
github.com/docker/libnetwork v0.0.0-20180830151422-a9cd636e3789/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8=
|
||||
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c h1:ZfSZ3P3BedhKGUhzj7BQlPSU4OvT6tfOKe3DVHzOA7s=
|
||||
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
|
||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f h1:8GDPb0tCY8LQ+OJ3dbHb5sA6YZWXFORQYZx5sdsTlMs=
|
||||
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
|
||||
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f h1:AUj1VoZUfhPhOPHULCQQDnGhRelpFWHMLhQVWDsS0v4=
|
||||
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8=
|
||||
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||
github.com/emicklei/go-restful v2.9.6+incompatible h1:tfrHha8zJ01ywiOEC1miGY8st1/igzWB8OmvPgoYX7w=
|
||||
@ -96,14 +80,12 @@ github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwC
|
||||
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4=
|
||||
github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
|
||||
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew=
|
||||
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I=
|
||||
github.com/go-acme/lego v2.5.0+incompatible/go.mod h1:yzMNe9CasVUhkquNvti5nAtPmG94USbYxYrZfTkIn0M=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
|
||||
@ -123,29 +105,29 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
|
||||
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk=
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450 h1:7xqw01UYS+KCI25bMrPxwNYkSns2Db1ziQPpVq99FpE=
|
||||
github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAONeMXrxql8uvOKuAZSu8aM5RUGv+1C6IJaEho=
|
||||
github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995 h1:f5gsjBiF9tRRVomCvrkGMMWI8W1f2OBFar2c5oakAP0=
|
||||
github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkYFkPcDKwRXegd+iM6E7matEszMG5HhwytU8=
|
||||
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e h1:KhcknUwkWHKZPbFy2P7jH5LKJ3La+0ZeknkkmrSgqb0=
|
||||
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk=
|
||||
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
|
||||
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
|
||||
github.com/googleapis/gnostic v0.3.0 h1:CcQijm0XKekKjP/YCz28LXVSpgguuB+nCxaSjCe09y0=
|
||||
github.com/googleapis/gnostic v0.3.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
|
||||
@ -153,28 +135,20 @@ github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/
|
||||
github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I=
|
||||
github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc h1:f8eY6cV/x1x+HLjOp4r72s/31/V2aTUtg5oKRRPf8/Q=
|
||||
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.8.5 h1:2+KSC78XiO6Qy0hIjfc1OD9H+hsaJdJlb8Kqsd41CTE=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
|
||||
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI=
|
||||
github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03 h1:FUwcHNlEqkqLjLBdCp5PRlCFijNjvcYANOZXzCfXwCM=
|
||||
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
|
||||
github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a/go.mod h1:wK6yTYYcgjHE1Z1QtXACPDjcFJyBskHEdagmnq3vsP8=
|
||||
github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
|
||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
@ -184,33 +158,25 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V
|
||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||
github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0=
|
||||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
|
||||
github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY=
|
||||
github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc=
|
||||
github.com/lucas-clemente/aes12 v0.0.0-20171027163421-cd47fb39b79f/go.mod h1:JpH9J1c9oX6otFSgdUHwUBUizmKlrMjxWnIAjff4m04=
|
||||
github.com/lucas-clemente/quic-clients v0.1.0/go.mod h1:y5xVIEoObKqULIKivu+gD/LU90pL73bTdtQjPBvtCBk=
|
||||
github.com/lucas-clemente/quic-go v0.10.2/go.mod h1:hvaRS9IHjFLMq76puFJeWNfmn+H70QZ/CXoxqw9bzao=
|
||||
github.com/lucas-clemente/quic-go-certificates v0.0.0-20160823095156-d2f86524cced/go.mod h1:NCcRLrOTZbzhZvixZLlERbJtDtYsmMw8Jc4vS8Z0g58=
|
||||
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481 h1:IaSjLMT6WvkoZZjspGxy3rdaTEmWLoRm49WbtVUi9sA=
|
||||
github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mholt/caddy v1.0.0 h1:KI6RPGih2GFzWRPG8s9clKK28Ns4ZlVMKR/v7mxq6+c=
|
||||
github.com/mholt/caddy v1.0.0/go.mod h1:PzUpQ3yGCTuEuy0KSxEeB4TZOi3zBZ8BR/zY0RBP414=
|
||||
github.com/mholt/certmagic v0.5.0/go.mod h1:g4cOPxcjV0oFq3qwpjSA30LReKD8AoIfwAY9VvG35NY=
|
||||
github.com/miekg/dns v1.1.3/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
|
||||
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
@ -218,26 +184,26 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
|
||||
github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE=
|
||||
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
|
||||
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||
github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
|
||||
github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
|
||||
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
|
||||
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
|
||||
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
|
||||
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
||||
github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=
|
||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
@ -261,13 +227,11 @@ github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
|
||||
github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
|
||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
|
||||
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
||||
github.com/spf13/cobra v0.0.2/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
@ -284,28 +248,13 @@ github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRci
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
|
||||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||
github.com/vishvananda/netlink v0.0.0-20171020171820-b2de5d10e38e h1:f1yevOHP+Suqk0rVc13fIkzcLULJbyQcXDba2klljD0=
|
||||
github.com/vishvananda/netlink v0.0.0-20171020171820-b2de5d10e38e/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
||||
github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936 h1:J9gO8RJCAFlln1jsvRba/CWVUnMHwObklfxxjErl1uk=
|
||||
github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI=
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1 h1:j2hhcujLRHAg872RWAV5yaUrEjHEObwDv3aImCaNLek=
|
||||
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2 h1:NAfh7zF0/3/HqtMvJNZ/RFrSlCE6ZTlHmKfhL/Dm1Jk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU=
|
||||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
@ -323,7 +272,6 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r
|
||||
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190328230028-74de082e2cca/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
|
||||
@ -346,10 +294,8 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190621203818-d432491b9138 h1:t8BZD9RDjkm9/h7yYN6kE8oaeov5r9aztkB7zKA5Tkg=
|
||||
@ -371,6 +317,7 @@ golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgw
|
||||
google.golang.org/api v0.3.1 h1:oJra/lMfmtm13/rgY/8i3MzjFWYXvQIAKjQ3HqofMk8=
|
||||
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 h1:Lj2SnHtxkRGJDqnGaSjo+CCdIieEnwVazbOXILwQemk=
|
||||
@ -381,29 +328,20 @@ google.golang.org/grpc v1.19.1 h1:TrBcJ1yqAl1G++wO39nD/qtgpsW9/1+QGrluyMGEYgM=
|
||||
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/jcmturner/aescts.v1 v1.0.1 h1:cVVZBK2b1zY26haWB4vbBiZrfFQnfbTVrE3xZq6hrEw=
|
||||
gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo=
|
||||
gopkg.in/jcmturner/dnsutils.v1 v1.0.1 h1:cIuC1OLRGZrld+16ZJvvZxVJeKPsvd5eUIvxfoN5hSM=
|
||||
gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q=
|
||||
gopkg.in/jcmturner/goidentity.v2 v2.0.0/go.mod h1:vCwK9HeXksMeUmQ4SxDd1tRz4LejrKh3KRVjQWhjvZI=
|
||||
gopkg.in/jcmturner/gokrb5.v5 v5.3.0 h1:RS1MYApX27Hx1Xw7NECs7XxGxxrm69/4OmaRuX9kwec=
|
||||
gopkg.in/jcmturner/gokrb5.v5 v5.3.0/go.mod h1:oQz8Wc5GsctOTgCVyKad1Vw4TCWz5G6gfIQr88RPv4k=
|
||||
gopkg.in/jcmturner/rpc.v0 v0.0.2 h1:wBTgrbL1qmLBUPsYVCqdJiI5aJgQhexmK+JkTHPUNJI=
|
||||
gopkg.in/jcmturner/rpc.v0 v0.0.2/go.mod h1:NzMq6cRzR9lipgw7WxRBHNx5N8SifBuaCQsOT1kWY/E=
|
||||
gopkg.in/mcuadros/go-syslog.v2 v2.2.1/go.mod h1:l5LPIyOOyIdQquNg+oU6Z3524YwrcqEm0aKH+5zpt2U=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
|
||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||
gopkg.in/square/go-jose.v2 v2.2.2 h1:orlkJ3myw8CN1nVQHBFfloD+L3egixIa4FvUP6RosSA=
|
||||
gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
@ -424,8 +362,6 @@ k8s.io/client-go v11.0.1-0.20190516230509-ae8359b20417+incompatible h1:bK03DJulJ
|
||||
k8s.io/client-go v11.0.1-0.20190516230509-ae8359b20417+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
|
||||
k8s.io/cloud-provider v0.0.0-20190516232619-2bf8e45c8454 h1:Xf+CNOo2Kx54V2Wlelg7N/J9NpiZTzhAlFxyzuiIrQ4=
|
||||
k8s.io/cloud-provider v0.0.0-20190516232619-2bf8e45c8454/go.mod h1:LlIffnLBu+GG7d4ppPzC8UnA1Ex8S+ntmSRVsnr7Xy4=
|
||||
k8s.io/cluster-bootstrap v0.0.0-20190516232516-d7d78ab2cfe7 h1:5wvjieVoU4oovHlkeD256q2M2YYi2P01zk6wxSR2zk0=
|
||||
k8s.io/cluster-bootstrap v0.0.0-20190516232516-d7d78ab2cfe7/go.mod h1:iBSm2nwo3OaiuW8VDvc3ySDXK5SKfUrxwPvBloKG7zg=
|
||||
k8s.io/component-base v0.0.0-20190516230545-9b07ebd4193b h1:uGhPlhc5zuKFBhA2A94CFQjr1R9gz3u65BQFGqcV+rE=
|
||||
k8s.io/component-base v0.0.0-20190516230545-9b07ebd4193b/go.mod h1:DMaomcf3j3MM2j1FsvlLVVlc7wA2jPytEur3cP9zRxQ=
|
||||
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
@ -435,10 +371,6 @@ k8s.io/klog v0.3.3 h1:niceAagH1tzskmaie/icWd7ci1wbG7Bf2c6YGcQv+3c=
|
||||
k8s.io/klog v0.3.3/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 h1:5sW+fEHvlJI3Ngolx30CmubFulwH28DhKjGf70Xmtco=
|
||||
k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208/go.mod h1:nfDlWeOsu3pUf4yWGL+ERqohP4YsZcBJXWMK+gkzOA4=
|
||||
k8s.io/kube-proxy v0.0.0-20190516232141-b2acb7b92548 h1:tEjlFuaZLa7iXPwiKomS6Aqck1KKAoslE0Q7EqvQQhw=
|
||||
k8s.io/kube-proxy v0.0.0-20190516232141-b2acb7b92548/go.mod h1:wYVhqAVLhGBLbGzgb9GsBakzIddI81JxSUHANQvzZZs=
|
||||
k8s.io/kubelet v0.0.0-20190516232236-412e4380c1a8 h1:prMemHZO8Ewdmjdm6h8krSmB0Jjy1h9Y7k6VWD/I9h0=
|
||||
k8s.io/kubelet v0.0.0-20190516232236-412e4380c1a8/go.mod h1:m6JOtVhjgs4GGnzhPpXuNF9VG+IjARwo/dHCNw4+QDA=
|
||||
k8s.io/kubernetes v1.14.2 h1:Gdq2hPpttbaJBoClIanCE6WSu4IZReA54yhkZtvPUOo=
|
||||
k8s.io/kubernetes v1.14.2/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
|
||||
k8s.io/metrics v0.0.0-20190516231729-8b83d5daaa8f h1:1Ol5g4qc2eMvAsmWliNrWgRKmXsZV4rMyIMhaed8qTc=
|
||||
|
@ -1,10 +1,10 @@
|
||||
package isogen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestToYaml(t *testing.T) {
|
||||
@ -18,11 +18,7 @@ container:
|
||||
},
|
||||
}
|
||||
|
||||
actualBytes, _ := cnf.ToYAML()
|
||||
errS := fmt.Sprintf(
|
||||
"Call ToYAML should have returned %s, got %s",
|
||||
expectedBytes,
|
||||
actualBytes,
|
||||
)
|
||||
assert.Equal(t, actualBytes, expectedBytes, errS)
|
||||
actualBytes, err := cnf.ToYAML()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, actualBytes, expectedBytes)
|
||||
}
|
||||
|
@ -24,36 +24,40 @@ import (
|
||||
|
||||
func TestValidate(t *testing.T) {
|
||||
co := DummyClusterOptions()
|
||||
// Valid Data case
|
||||
|
||||
// Assert that the initial dummy config is valid
|
||||
err := co.Validate()
|
||||
assert.Nil(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Validate with Embedded Data
|
||||
// Empty CA
|
||||
co.EmbedCAData = true
|
||||
co.CertificateAuthority = ""
|
||||
err = co.Validate()
|
||||
assert.NotNil(t, err)
|
||||
assert.Error(t, err)
|
||||
|
||||
// Lets add a CA
|
||||
co.CertificateAuthority = "testdata/ca.crt"
|
||||
err = co.Validate()
|
||||
assert.Nil(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Lets add a CA but garbage
|
||||
co.CertificateAuthority = "garbage"
|
||||
err = co.Validate()
|
||||
assert.NotNil(t, err)
|
||||
assert.Error(t, err)
|
||||
|
||||
// Lets change the Insecure mode
|
||||
co.InsecureSkipTLSVerify = true
|
||||
err = co.Validate()
|
||||
assert.NotNil(t, err)
|
||||
assert.Error(t, err)
|
||||
|
||||
// Invalid Cluter Type
|
||||
co.ClusterType = "Invalid"
|
||||
err = co.Validate()
|
||||
assert.NotNil(t, err)
|
||||
assert.Error(t, err)
|
||||
|
||||
// Empty Cluster Name case
|
||||
co.Name = ""
|
||||
err = co.Validate()
|
||||
assert.NotNil(t, err)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
@ -155,20 +155,20 @@ func TestLoadConfig(t *testing.T) {
|
||||
require.NotEmpty(t, conf.String())
|
||||
|
||||
// Lets make sure that the contents is as expected
|
||||
// 2 Clusters
|
||||
// 4 Clusters
|
||||
// 2 Clusters Types
|
||||
// 2 Contexts
|
||||
// 1 User
|
||||
require.Lenf(t, conf.Clusters, 4, "Expected 4 Clusters got %d", len(conf.Clusters))
|
||||
require.Lenf(t, conf.Clusters["def"].ClusterTypes, 2,
|
||||
"Expected 2 ClusterTypes got %d", len(conf.Clusters["def"].ClusterTypes))
|
||||
require.Len(t, conf.Contexts, 3, "Expected 3 Contexts got %d", len(conf.Contexts))
|
||||
require.Len(t, conf.AuthInfos, 2, "Expected 2 AuthInfo got %d", len(conf.AuthInfos))
|
||||
// 3 Contexts
|
||||
// 2 Users
|
||||
assert.Len(t, conf.Clusters, 4)
|
||||
assert.Len(t, conf.Clusters["def"].ClusterTypes, 2)
|
||||
assert.Len(t, conf.Contexts, 3)
|
||||
assert.Len(t, conf.AuthInfos, 2)
|
||||
|
||||
}
|
||||
|
||||
func TestPersistConfig(t *testing.T) {
|
||||
config := InitConfig(t)
|
||||
defer Clean(config)
|
||||
airConfigFile := filepath.Join(testAirshipConfigDir, AirshipConfig)
|
||||
kConfigFile := filepath.Join(testAirshipConfigDir, AirshipKubeConfig)
|
||||
config.SetLoadedConfigPath(airConfigFile)
|
||||
@ -177,15 +177,16 @@ func TestPersistConfig(t *testing.T) {
|
||||
config.SetLoadedPathOptions(kubePathOptions)
|
||||
|
||||
err := config.PersistConfig()
|
||||
assert.Nilf(t, err, "Unable to persist configuration expected at %v ", config.LoadedConfigPath())
|
||||
assert.NoErrorf(t, err, "Unable to persist configuration expected at %v", config.LoadedConfigPath())
|
||||
|
||||
kpo := config.LoadedPathOptions()
|
||||
assert.NotNil(t, kpo)
|
||||
Clean(config)
|
||||
}
|
||||
|
||||
func TestPersistConfigFail(t *testing.T) {
|
||||
config := InitConfig(t)
|
||||
defer Clean(config)
|
||||
|
||||
airConfigFile := filepath.Join(testAirshipConfigDir, "\\")
|
||||
kConfigFile := filepath.Join(testAirshipConfigDir, "\\")
|
||||
config.SetLoadedConfigPath(airConfigFile)
|
||||
@ -194,37 +195,43 @@ func TestPersistConfigFail(t *testing.T) {
|
||||
config.SetLoadedPathOptions(kubePathOptions)
|
||||
|
||||
err := config.PersistConfig()
|
||||
require.NotNilf(t, err, "Able to persist configuration at %v expected an error", config.LoadedConfigPath())
|
||||
Clean(config)
|
||||
assert.Errorf(t, err, "Able to persist configuration at %v, but expected an error", config.LoadedConfigPath())
|
||||
}
|
||||
|
||||
func TestEnsureComplete(t *testing.T) {
|
||||
conf := InitConfig(t)
|
||||
|
||||
err := conf.EnsureComplete()
|
||||
require.NotNilf(t, err, "Configuration was incomplete %v ", err.Error())
|
||||
conf.CurrentContext = "def_ephemeral"
|
||||
assert.NoError(t, conf.EnsureComplete())
|
||||
|
||||
// Trgger Contexts Error
|
||||
// Trigger no CurrentContext Error
|
||||
conf.CurrentContext = ""
|
||||
err := conf.EnsureComplete()
|
||||
assert.EqualError(t, err, "Config: Current Context is not defined, or it doesnt identify a defined Context")
|
||||
|
||||
// Trigger Contexts Error
|
||||
for key := range conf.Contexts {
|
||||
delete(conf.Contexts, key)
|
||||
}
|
||||
err = conf.EnsureComplete()
|
||||
assert.EqualValues(t, err.Error(), "Config: At least one Context needs to be defined")
|
||||
assert.EqualError(t, err, "Config: At least one Context needs to be defined")
|
||||
|
||||
// Trigger Authentication Information
|
||||
for key := range conf.AuthInfos {
|
||||
delete(conf.AuthInfos, key)
|
||||
}
|
||||
err = conf.EnsureComplete()
|
||||
assert.EqualValues(t, err.Error(), "Config: At least one Authentication Information (User) needs to be defined")
|
||||
assert.EqualError(t, err, "Config: At least one Authentication Information (User) needs to be defined")
|
||||
|
||||
conf = NewConfig()
|
||||
err = conf.EnsureComplete()
|
||||
assert.NotNilf(t, err, "Configuration was found complete incorrectly")
|
||||
assert.Error(t, err, "A new config object should not be complete")
|
||||
}
|
||||
|
||||
func TestPurge(t *testing.T) {
|
||||
config := InitConfig(t)
|
||||
defer Clean(config)
|
||||
|
||||
airConfigFile := filepath.Join(testAirshipConfigDir, AirshipConfig)
|
||||
kConfigFile := filepath.Join(testAirshipConfigDir, AirshipKubeConfig)
|
||||
config.SetLoadedConfigPath(airConfigFile)
|
||||
@ -234,62 +241,56 @@ func TestPurge(t *testing.T) {
|
||||
|
||||
// Store it
|
||||
err := config.PersistConfig()
|
||||
assert.Nilf(t, err, "Unable to persist configuration expected at %v [%v] ",
|
||||
config.LoadedConfigPath(), err)
|
||||
assert.NoErrorf(t, err, "Unable to persist configuration expected at %v", config.LoadedConfigPath())
|
||||
|
||||
// Verify that the file is there
|
||||
|
||||
_, err = os.Stat(config.LoadedConfigPath())
|
||||
assert.Falsef(t, os.IsNotExist(err), "Test config was not persisted at %v , cannot validate Purge [%v] ",
|
||||
config.LoadedConfigPath(), err)
|
||||
assert.Falsef(t, os.IsNotExist(err), "Test config was not persisted at %v, cannot validate Purge",
|
||||
config.LoadedConfigPath())
|
||||
|
||||
// Delete it
|
||||
err = config.Purge()
|
||||
assert.Nilf(t, err, "Unable to Purge file at %v [%v] ", config.LoadedConfigPath(), err)
|
||||
assert.NoErrorf(t, err, "Unable to Purge file at %v", config.LoadedConfigPath())
|
||||
|
||||
// Verify its gone
|
||||
_, err = os.Stat(config.LoadedConfigPath())
|
||||
require.Falsef(t, os.IsExist(err), "Purge failed to remove file at %v [%v] ",
|
||||
config.LoadedConfigPath(), err)
|
||||
|
||||
Clean(config)
|
||||
assert.Falsef(t, os.IsExist(err), "Purge failed to remove file at %v", config.LoadedConfigPath())
|
||||
}
|
||||
|
||||
func TestClusterNames(t *testing.T) {
|
||||
conf := InitConfig(t)
|
||||
expected := []string{"def", "onlyinkubeconf", "wrongonlyinconfig", "wrongonlyinkubeconf"}
|
||||
require.EqualValues(t, expected, conf.ClusterNames())
|
||||
assert.EqualValues(t, expected, conf.ClusterNames())
|
||||
}
|
||||
func TestKClusterString(t *testing.T) {
|
||||
conf := InitConfig(t)
|
||||
kClusters := conf.KubeConfig().Clusters
|
||||
for kClust := range kClusters {
|
||||
require.NotNil(t, KClusterString(kClusters[kClust]))
|
||||
assert.NotEmpty(t, KClusterString(kClusters[kClust]))
|
||||
}
|
||||
require.EqualValues(t, KClusterString(nil), "null\n")
|
||||
assert.EqualValues(t, KClusterString(nil), "null\n")
|
||||
}
|
||||
func TestComplexName(t *testing.T) {
|
||||
cName := "aCluster"
|
||||
ctName := Ephemeral
|
||||
clusterName := NewClusterComplexName()
|
||||
clusterName.WithType(cName, ctName)
|
||||
require.EqualValues(t, cName+"_"+ctName, clusterName.Name())
|
||||
assert.EqualValues(t, cName+"_"+ctName, clusterName.Name())
|
||||
|
||||
require.EqualValues(t, cName, clusterName.ClusterName())
|
||||
require.EqualValues(t, ctName, clusterName.ClusterType())
|
||||
assert.EqualValues(t, cName, clusterName.ClusterName())
|
||||
assert.EqualValues(t, ctName, clusterName.ClusterType())
|
||||
|
||||
cName = "bCluster"
|
||||
clusterName.SetClusterName(cName)
|
||||
clusterName.SetDefaultType()
|
||||
ctName = clusterName.ClusterType()
|
||||
require.EqualValues(t, cName+"_"+ctName, clusterName.Name())
|
||||
|
||||
require.EqualValues(t, "clusterName:"+cName+", clusterType:"+ctName, clusterName.String())
|
||||
assert.EqualValues(t, cName+"_"+ctName, clusterName.Name())
|
||||
assert.EqualValues(t, "clusterName:"+cName+", clusterType:"+ctName, clusterName.String())
|
||||
}
|
||||
|
||||
func TestValidClusterTypeFail(t *testing.T) {
|
||||
err := ValidClusterType("Fake")
|
||||
require.NotNil(t, err)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
func TestGetCluster(t *testing.T) {
|
||||
conf := InitConfig(t)
|
||||
@ -299,31 +300,30 @@ func TestGetCluster(t *testing.T) {
|
||||
// Test Positives
|
||||
assert.EqualValues(t, cluster.NameInKubeconf, "def_ephemeral")
|
||||
assert.EqualValues(t, cluster.KubeCluster().Server, "http://5.6.7.8")
|
||||
// Test Wrong Cluster
|
||||
cluster, err = conf.GetCluster("unknown", Ephemeral)
|
||||
assert.NotNil(t, err)
|
||||
assert.Nil(t, cluster)
|
||||
// Test Wrong Cluster Type
|
||||
cluster, err = conf.GetCluster("def", "Unknown")
|
||||
assert.NotNil(t, err)
|
||||
assert.Nil(t, cluster)
|
||||
// Test Wrong Cluster Type
|
||||
|
||||
// Test Wrong Cluster
|
||||
_, err = conf.GetCluster("unknown", Ephemeral)
|
||||
assert.Error(t, err)
|
||||
|
||||
// Test Wrong Cluster Type
|
||||
_, err = conf.GetCluster("def", "Unknown")
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
func TestAddCluster(t *testing.T) {
|
||||
co := DummyClusterOptions()
|
||||
conf := InitConfig(t)
|
||||
cluster, err := conf.AddCluster(co)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, cluster)
|
||||
|
||||
assert.EqualValues(t, conf.Clusters[co.Name].ClusterTypes[co.ClusterType], cluster)
|
||||
}
|
||||
|
||||
func TestModifyluster(t *testing.T) {
|
||||
co := DummyClusterOptions()
|
||||
conf := InitConfig(t)
|
||||
cluster, err := conf.AddCluster(co)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, cluster)
|
||||
|
||||
co.Server += "/changes"
|
||||
co.InsecureSkipTLSVerify = true
|
||||
@ -336,13 +336,12 @@ func TestModifyluster(t *testing.T) {
|
||||
// Error case
|
||||
co.CertificateAuthority = "unknown"
|
||||
_, err = conf.ModifyCluster(cluster, co)
|
||||
assert.NotNil(t, err)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
func TestGetClusters(t *testing.T) {
|
||||
conf := InitConfig(t)
|
||||
clusters, err := conf.GetClusters()
|
||||
require.NoError(t, err)
|
||||
assert.EqualValues(t, 4, len(clusters))
|
||||
|
||||
assert.Len(t, clusters, 4)
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
kubeconfig "k8s.io/client-go/tools/clientcmd/api"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -114,7 +114,7 @@ func InitConfigAt(t *testing.T, airConfigFile, kConfigFile string) *Config {
|
||||
kubePathOptions := clientcmd.NewDefaultPathOptions()
|
||||
kubePathOptions.GlobalFile = kConfigFile
|
||||
err := conf.LoadConfig(airConfigFile, kubePathOptions)
|
||||
assert.Nil(t, err)
|
||||
require.NoError(t, err)
|
||||
return conf
|
||||
}
|
||||
func InitConfig(t *testing.T) *Config {
|
||||
|
@ -13,57 +13,52 @@ import (
|
||||
)
|
||||
|
||||
func TestNewBundle(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
bundle := testutil.NewTestBundle(t, "testdata")
|
||||
require := require.New(t)
|
||||
require.NotNil(bundle)
|
||||
|
||||
}
|
||||
|
||||
func TestBundleDocumentFiltering(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
|
||||
bundle := testutil.NewTestBundle(t, "testdata")
|
||||
assert := assert.New(t)
|
||||
|
||||
t.Run("GetKustomizeResourceMap", func(t *testing.T) {
|
||||
|
||||
r := bundle.GetKustomizeResourceMap()
|
||||
|
||||
// ensure it is populated
|
||||
assert.True(r.Size() > 0)
|
||||
assert.NotZero(r.Size())
|
||||
|
||||
})
|
||||
|
||||
t.Run("GetByGvk", func(t *testing.T) {
|
||||
|
||||
docs, err := bundle.GetByGvk("apps", "v1", "Deployment")
|
||||
if err != nil {
|
||||
t.Fatalf("Error trying to GetGvk: %v", err)
|
||||
}
|
||||
require.NoError(err)
|
||||
|
||||
assert.Equal(len(docs), 3, "GetGvk returned the wrong number of resources")
|
||||
assert.Len(docs, 3, "GetGvk returned the wrong number of resources")
|
||||
|
||||
})
|
||||
|
||||
t.Run("GetByAnnotation", func(t *testing.T) {
|
||||
|
||||
docs, err := bundle.GetByAnnotation("airshipit.org/clustertype=ephemeral")
|
||||
if err != nil {
|
||||
t.Fatalf("Error trying to GetByAnnotation: %v", err)
|
||||
}
|
||||
require.NoError(err, "Error trying to GetByAnnotation")
|
||||
|
||||
assert.Equal(len(docs), 4, "GetByAnnotation returned wrong number of resources")
|
||||
assert.Len(docs, 4, "GetByAnnotation returned wrong number of resources")
|
||||
|
||||
})
|
||||
|
||||
t.Run("GetByLabel", func(t *testing.T) {
|
||||
|
||||
docs, err := bundle.GetByLabel("app=workflow-controller")
|
||||
if err != nil {
|
||||
t.Fatalf("Error trying to GetByLabel: %v", err)
|
||||
}
|
||||
require.NoError(err, "Error trying to GetByLabel")
|
||||
|
||||
assert.Equal(len(docs), 1, "GetByLabel returned wrong number of resources")
|
||||
assert.Len(docs, 1, "GetByLabel returned wrong number of resources")
|
||||
|
||||
})
|
||||
|
||||
@ -75,10 +70,9 @@ func TestBundleDocumentFiltering(t *testing.T) {
|
||||
g := gvk.Gvk{Group: "apps", Version: "v1", Kind: "Deployment"}
|
||||
selector := types.Selector{Gvk: g}
|
||||
docs, err := bundle.Select(selector)
|
||||
if err != nil {
|
||||
t.Fatalf("Error trying to select resources: %v", err)
|
||||
}
|
||||
assert.Equal(len(docs), 3, "SelectGvk returned wrong number of resources")
|
||||
require.NoError(err, "Error trying to select resources")
|
||||
|
||||
assert.Len(docs, 3, "SelectGvk returned wrong number of resources")
|
||||
|
||||
})
|
||||
|
||||
@ -87,10 +81,9 @@ func TestBundleDocumentFiltering(t *testing.T) {
|
||||
// Find documents with a particular annotation, namely airshipit.org/clustertype=ephemeral
|
||||
selector := types.Selector{AnnotationSelector: "airshipit.org/clustertype=ephemeral"}
|
||||
docs, err := bundle.Select(selector)
|
||||
if err != nil {
|
||||
t.Fatalf("Error trying to select annotated resources: %v", err)
|
||||
}
|
||||
assert.Equal(len(docs), 4, "SelectAnnotations returned wrong number of resources")
|
||||
require.NoError(err, "Error trying to select annotated resources")
|
||||
|
||||
assert.Len(docs, 4, "SelectAnnotations returned wrong number of resources")
|
||||
|
||||
})
|
||||
|
||||
@ -101,10 +94,8 @@ func TestBundleDocumentFiltering(t *testing.T) {
|
||||
// and not spec templates with this label (spec.template.metadata.labels)
|
||||
selector := types.Selector{LabelSelector: "app=workflow-controller"}
|
||||
docs, err := bundle.Select(selector)
|
||||
if err != nil {
|
||||
t.Fatalf("Error trying to select labeled resources: %v", err)
|
||||
}
|
||||
assert.Equal(len(docs), 1, "SelectLabels returned wrong number of resources")
|
||||
require.NoError(err, "Error trying to select labeled resources")
|
||||
assert.Len(docs, 1, "SelectLabels returned wrong number of resources")
|
||||
|
||||
})
|
||||
|
||||
@ -116,9 +107,7 @@ func TestBundleDocumentFiltering(t *testing.T) {
|
||||
var b bytes.Buffer
|
||||
|
||||
err := bundle.Write(&b)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to write bundle out: %v", err)
|
||||
}
|
||||
require.NoError(err, "Failed to write bundle out")
|
||||
|
||||
// b.String() will contain all kustomize built YAML
|
||||
// so we for now we just search for an expected string
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
)
|
||||
|
||||
func TestDocument(t *testing.T) {
|
||||
require := require.New(t)
|
||||
assert := assert.New(t)
|
||||
|
||||
// the easiest way to construct a bunch of documents
|
||||
// is by manufacturing a bundle
|
||||
@ -21,20 +23,13 @@ func TestDocument(t *testing.T) {
|
||||
// on a bundle might be useful
|
||||
fSys := testutil.SetupTestFs(t, "testdata")
|
||||
bundle, err := document.NewBundle(fSys, "/", "/")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error building bundle: %v", err)
|
||||
}
|
||||
|
||||
require := require.New(t)
|
||||
assert := assert.New(t)
|
||||
require.NoError(err, "Building Bundle Failed")
|
||||
require.NotNil(bundle)
|
||||
|
||||
t.Run("GetName", func(t *testing.T) {
|
||||
|
||||
docs, err := bundle.GetAllDocuments()
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error trying to GetAllDocuments: %v", err)
|
||||
}
|
||||
require.NoError(err, "Unexpected error trying to GetAllDocuments")
|
||||
|
||||
nameList := []string{}
|
||||
|
||||
@ -49,23 +44,17 @@ func TestDocument(t *testing.T) {
|
||||
t.Run("AsYAML", func(t *testing.T) {
|
||||
|
||||
doc, err := bundle.GetByName("some-random-deployment-we-will-filter")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error trying to GetByName for AsYAML Test: %v", err)
|
||||
}
|
||||
require.NoError(err, "Unexpected error trying to GetByName for AsYAML Test")
|
||||
|
||||
// see if we can marshal it while we're here for coverage
|
||||
// as this is a dependency for AsYAML
|
||||
json, err := doc.MarshalJSON()
|
||||
require.NoError(err, "Unexpected error trying to MarshalJSON()")
|
||||
assert.NotNil(json)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error trying to MarshalJSON(): %v", err)
|
||||
}
|
||||
|
||||
// get it as yaml
|
||||
yaml, err := doc.AsYAML()
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error trying to AsYAML(): %v", err)
|
||||
}
|
||||
require.NoError(err, "Unexpected error trying to AsYAML()")
|
||||
|
||||
// convert the bytes into a string for comparison
|
||||
//
|
||||
@ -76,27 +65,22 @@ func TestDocument(t *testing.T) {
|
||||
// look more or less how unmarshalling it would look
|
||||
s := string(yaml)
|
||||
fileData, err := fSys.ReadFile("/initially_ignored.yaml")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error reading initially_ignored.yaml file")
|
||||
}
|
||||
require.NoError(err, "Unexpected error reading initially_ignored.yaml file")
|
||||
|
||||
// increase the chance of a match by removing any \n suffix on both actual
|
||||
// and expected
|
||||
assert.Equal(strings.TrimSuffix(s, "\n"), strings.TrimSuffix(string(fileData), "\n"))
|
||||
assert.Equal(strings.TrimRight(s, "\n"), strings.TrimRight(string(fileData), "\n"))
|
||||
|
||||
})
|
||||
|
||||
t.Run("GetString", func(t *testing.T) {
|
||||
|
||||
doc, err := bundle.GetByName("some-random-deployment-we-will-filter")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error trying to GetByName for test: %v", err)
|
||||
}
|
||||
require.NoError(err, "Unexpected error trying to GetByName")
|
||||
|
||||
appLabelMatch, err := doc.GetString("spec.selector.matchLabels.app")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error trying to GetString from document")
|
||||
}
|
||||
require.NoError(err, "Unexpected error trying to GetString from document")
|
||||
|
||||
assert.Equal(appLabelMatch, "some-random-deployment-we-will-filter")
|
||||
|
||||
})
|
||||
@ -104,9 +88,7 @@ func TestDocument(t *testing.T) {
|
||||
t.Run("GetNamespace", func(t *testing.T) {
|
||||
|
||||
doc, err := bundle.GetByName("some-random-deployment-we-will-filter")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error trying to GetByName for test: %v", err)
|
||||
}
|
||||
require.NoError(err, "Unexpected error trying to GetByName")
|
||||
|
||||
assert.Equal("foobar", doc.GetNamespace())
|
||||
|
||||
@ -115,16 +97,11 @@ func TestDocument(t *testing.T) {
|
||||
t.Run("GetStringSlice", func(t *testing.T) {
|
||||
|
||||
doc, err := bundle.GetByName("some-random-deployment-we-will-filter")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error trying to GetByName for test: %v", err)
|
||||
}
|
||||
s := make([]string, 1)
|
||||
s[0] = "foobar"
|
||||
require.NoError(err, "Unexpected error trying to GetByName")
|
||||
s := []string{"foobar"}
|
||||
|
||||
gotSlice, err := doc.GetStringSlice("spec.template.spec.containers[0].args")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error trying to GetStringSlice: %v", err)
|
||||
}
|
||||
require.NoError(err, "Unexpected error trying to GetStringSlice")
|
||||
|
||||
assert.Equal(s, gotSlice)
|
||||
|
||||
|
@ -2,129 +2,93 @@ package log_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"opendev.org/airship/airshipctl/pkg/log"
|
||||
)
|
||||
|
||||
const notEqualFmt = `Output does not match expected
|
||||
GOT: %v
|
||||
Expected: %v`
|
||||
var logFormatRegex = regexp.MustCompile(`^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*`)
|
||||
|
||||
func TestLoggingPrint(t *testing.T) {
|
||||
tests := []struct {
|
||||
Name string
|
||||
Message string
|
||||
Vals []interface{}
|
||||
Debug bool
|
||||
Expected string
|
||||
}{
|
||||
{
|
||||
Name: "Print, debug set to false",
|
||||
Message: "Print test - debug false",
|
||||
Debug: false,
|
||||
Expected: "Print test - debug false",
|
||||
},
|
||||
{
|
||||
Name: "Print, debug set to true",
|
||||
Message: "Print test - debug true",
|
||||
Debug: true,
|
||||
Expected: "Print test - debug true",
|
||||
},
|
||||
{
|
||||
Name: "Printf, debug set to false",
|
||||
Message: "%s - %s",
|
||||
Vals: []interface{}{"Printf test", "debug false"},
|
||||
Debug: false,
|
||||
Expected: "Printf test - debug false",
|
||||
},
|
||||
{
|
||||
Name: "Printf, debug set to true",
|
||||
Message: "%s - %s",
|
||||
Vals: []interface{}{"Printf test", "debug true"},
|
||||
Debug: true,
|
||||
Expected: "Printf test - debug true",
|
||||
},
|
||||
}
|
||||
const prefixLength = len("2001/02/03 16:05:06 ")
|
||||
|
||||
for _, test := range tests {
|
||||
func TestLoggingPrintf(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
|
||||
t.Run("Print", func(t *testing.T) {
|
||||
output := new(bytes.Buffer)
|
||||
log.Init(test.Debug, output)
|
||||
log.Init(false, output)
|
||||
|
||||
if len(test.Vals) == 0 {
|
||||
log.Print(test.Message)
|
||||
} else {
|
||||
log.Printf(test.Message, test.Vals...)
|
||||
}
|
||||
outputFields := strings.Fields(output.String())
|
||||
if len(outputFields) < 3 {
|
||||
t.Fatalf("Expected log message to have the following format: YYYY/MM/DD HH:MM:SS Message")
|
||||
}
|
||||
actual := strings.Join(outputFields[2:], " ")
|
||||
if actual != test.Expected {
|
||||
t.Errorf(notEqualFmt, actual, test.Expected)
|
||||
}
|
||||
}
|
||||
log.Print("Print args ", 5)
|
||||
actual := output.String()
|
||||
|
||||
expected := "Print args 5\n"
|
||||
require.Regexp(logFormatRegex, actual)
|
||||
actual = actual[prefixLength:]
|
||||
assert.Equal(expected, actual)
|
||||
})
|
||||
|
||||
t.Run("Printf", func(t *testing.T) {
|
||||
output := new(bytes.Buffer)
|
||||
log.Init(false, output)
|
||||
|
||||
log.Printf("%s %d", "Printf args", 5)
|
||||
actual := output.String()
|
||||
|
||||
expected := "Printf args 5\n"
|
||||
require.Regexp(logFormatRegex, actual)
|
||||
actual = actual[prefixLength:]
|
||||
assert.Equal(expected, actual)
|
||||
})
|
||||
}
|
||||
|
||||
func TestLoggingDebug(t *testing.T) {
|
||||
tests := []struct {
|
||||
Name string
|
||||
Message string
|
||||
Vals []interface{}
|
||||
Debug bool
|
||||
Expected string
|
||||
}{
|
||||
{
|
||||
Name: "Debug, debug set to false",
|
||||
Message: "Debug test - debug false",
|
||||
Debug: false,
|
||||
Expected: "",
|
||||
},
|
||||
{
|
||||
Name: "Debug, debug set to true",
|
||||
Message: "Debug test - debug true",
|
||||
Debug: true,
|
||||
Expected: "Debug test - debug true",
|
||||
},
|
||||
{
|
||||
Name: "Debugf, debug set to false",
|
||||
Message: "%s - %s",
|
||||
Vals: []interface{}{"Debugf test", "debug false"},
|
||||
Debug: false,
|
||||
Expected: "",
|
||||
},
|
||||
{
|
||||
Name: "Debugf, debug set to true",
|
||||
Message: "%s - %s",
|
||||
Vals: []interface{}{"Debugf test", "debug true"},
|
||||
Debug: true,
|
||||
Expected: "Debugf test - debug true",
|
||||
},
|
||||
}
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run("DebugTrue", func(t *testing.T) {
|
||||
output := new(bytes.Buffer)
|
||||
log.Init(test.Debug, output)
|
||||
log.Init(true, output)
|
||||
|
||||
if len(test.Vals) == 0 {
|
||||
log.Debug(test.Message)
|
||||
} else {
|
||||
log.Debugf(test.Message, test.Vals...)
|
||||
}
|
||||
var actual string
|
||||
if test.Debug {
|
||||
outputFields := strings.Fields(output.String())
|
||||
if len(outputFields) < 3 {
|
||||
t.Fatalf("Expected log message to have the following format: YYYY/MM/DD HH:MM:SS Message")
|
||||
}
|
||||
actual = strings.Join(outputFields[2:], " ")
|
||||
} else {
|
||||
actual = output.String()
|
||||
}
|
||||
if actual != test.Expected {
|
||||
t.Errorf(notEqualFmt, actual, test.Expected)
|
||||
}
|
||||
}
|
||||
log.Debug("DebugTrue args ", 5)
|
||||
actual := output.String()
|
||||
|
||||
expected := "DebugTrue args 5\n"
|
||||
require.Regexp(logFormatRegex, actual)
|
||||
actual = actual[prefixLength:]
|
||||
assert.Equal(expected, actual)
|
||||
})
|
||||
|
||||
t.Run("DebugfTrue", func(t *testing.T) {
|
||||
output := new(bytes.Buffer)
|
||||
log.Init(true, output)
|
||||
|
||||
log.Debugf("%s %d", "DebugfTrue args", 5)
|
||||
actual := output.String()
|
||||
|
||||
expected := "DebugfTrue args 5\n"
|
||||
require.Regexp(logFormatRegex, actual)
|
||||
actual = actual[prefixLength:]
|
||||
assert.Equal(expected, actual)
|
||||
})
|
||||
|
||||
t.Run("DebugFalse", func(t *testing.T) {
|
||||
output := new(bytes.Buffer)
|
||||
log.Init(false, output)
|
||||
|
||||
log.Debug("DebugFalse args ", 5)
|
||||
assert.Equal("", output.String())
|
||||
})
|
||||
|
||||
t.Run("DebugfFalse", func(t *testing.T) {
|
||||
output := new(bytes.Buffer)
|
||||
log.Init(false, output)
|
||||
|
||||
log.Debugf("%s %d", "DebugFalse args", 5)
|
||||
assert.Equal("", output.String())
|
||||
})
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"opendev.org/airship/airshipctl/pkg/secret"
|
||||
)
|
||||
|
||||
@ -18,6 +20,7 @@ const (
|
||||
)
|
||||
|
||||
func TestDeterministicGenerateValidPassphrase(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
testSource := rand.NewSource(42)
|
||||
engine := secret.NewPassphraseEngine(testSource)
|
||||
|
||||
@ -37,29 +40,40 @@ func TestDeterministicGenerateValidPassphrase(t *testing.T) {
|
||||
|
||||
for i, expected := range expectedPassphrases {
|
||||
actual := engine.GeneratePassphrase()
|
||||
if expected != actual {
|
||||
t.Errorf("Call #%d to engine.GeneratePassphrase() should have returned %s, got %s",
|
||||
i, expected, actual)
|
||||
}
|
||||
assert.Equal(expected, actual, "Test #%d failed", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNondeterministicGenerateValidPassphrase(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// Due to the nondeterminism of random number generators, this
|
||||
// functionality is impossible to fully test. Let's just generate
|
||||
// enough passphrases that we can be confident in the randomness.
|
||||
// Fortunately, Go is pretty fast, so we can do upward of 100,000 of
|
||||
// Fortunately, Go is pretty fast, so we can do upward of 10,000 of
|
||||
// these without slowing down the test too much
|
||||
charSets := []string{
|
||||
asciiLowers,
|
||||
asciiUppers,
|
||||
asciiNumbers,
|
||||
asciiSymbols,
|
||||
}
|
||||
|
||||
engine := secret.NewPassphraseEngine(nil)
|
||||
for i := 0; i < 100000; i++ {
|
||||
for i := 0; i < 10000; i++ {
|
||||
passphrase := engine.GeneratePassphrase()
|
||||
if !isValid(passphrase) {
|
||||
t.Errorf("The engine generated an invalid password: %s", passphrase)
|
||||
assert.Truef(len(passphrase) >= defaultLength,
|
||||
"%s does not meet the length requirement", passphrase)
|
||||
|
||||
for _, charSet := range charSets {
|
||||
assert.Truef(strings.ContainsAny(passphrase, charSet),
|
||||
"%s does not contain any characters from [%s]",
|
||||
passphrase, charSet)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateValidPassphraseN(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
testSource := rand.NewSource(42)
|
||||
engine := secret.NewPassphraseEngine(testSource)
|
||||
tests := []struct {
|
||||
@ -82,28 +96,6 @@ func TestGenerateValidPassphraseN(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
passphrase := engine.GeneratePassphraseN(tt.inputLegth)
|
||||
if len(passphrase) != tt.expectedLength {
|
||||
t.Errorf(`Passphrase "%s" should have length %d, got %d\n`,
|
||||
passphrase, len(passphrase), tt.expectedLength)
|
||||
}
|
||||
assert.Len(passphrase, tt.expectedLength)
|
||||
}
|
||||
}
|
||||
|
||||
func isValid(passphrase string) bool {
|
||||
if len(passphrase) < defaultLength {
|
||||
return false
|
||||
}
|
||||
|
||||
charSets := []string{
|
||||
asciiLowers,
|
||||
asciiUppers,
|
||||
asciiNumbers,
|
||||
asciiSymbols,
|
||||
}
|
||||
for _, charSet := range charSets {
|
||||
if !strings.ContainsAny(passphrase, charSet) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -3,20 +3,21 @@ package util_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"opendev.org/airship/airshipctl/pkg/util"
|
||||
)
|
||||
|
||||
func TestReadYAMLFile(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
|
||||
var actual map[string]interface{}
|
||||
if err := util.ReadYAMLFile("testdata/test.yaml", &actual); err != nil {
|
||||
t.Fatalf("Error while reading YAML: %s", err.Error())
|
||||
}
|
||||
err := util.ReadYAMLFile("testdata/test.yaml", &actual)
|
||||
require.NoError(err, "Error while reading YAML")
|
||||
|
||||
actualString := actual["testString"]
|
||||
expectedString := "test"
|
||||
actualString, ok := actual["testString"]
|
||||
if !ok {
|
||||
t.Fatalf("Missing \"testString\" attribute")
|
||||
}
|
||||
if actualString != expectedString {
|
||||
t.Errorf("Expected %s, got %s", expectedString, actualString)
|
||||
}
|
||||
assert.Equal(expectedString, actualString)
|
||||
}
|
||||
|
@ -21,14 +21,15 @@ func SetupTestFs(t *testing.T, fixtureDir string) fs.FileSystem {
|
||||
x := fs.MakeFakeFS()
|
||||
|
||||
files, err := ioutil.ReadDir(fixtureDir)
|
||||
require.NoError(t, err, "Failed to read fixture directory, setting up testfs failed")
|
||||
require.NoErrorf(t, err, "Failed to read fixture directory %s", fixtureDir)
|
||||
for _, file := range files {
|
||||
fileName := file.Name()
|
||||
filePath := filepath.Join(fixtureDir, fileName)
|
||||
|
||||
fileBytes, err := ioutil.ReadFile(filePath)
|
||||
require.NoError(t, err, "Failed to read file, setting up testfs failed")
|
||||
require.NoErrorf(t, err, "Failed to read file %s, setting up testfs failed", filePath)
|
||||
err = x.WriteFile(filepath.Join("/", file.Name()), fileBytes)
|
||||
require.NoError(t, err, "Failed to write file, setting up testfs failed")
|
||||
require.NoErrorf(t, err, "Failed to write file %s, setting up testfs failed", filePath)
|
||||
}
|
||||
return x
|
||||
|
||||
|
@ -10,6 +10,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// UpdateGolden writes out the golden files with the latest values, rather than failing the test.
|
||||
@ -42,6 +44,7 @@ type CmdTest struct {
|
||||
// output from its golden file, or generates golden files if the -update flag
|
||||
// is passed
|
||||
func RunTest(t *testing.T, test *CmdTest) {
|
||||
t.Helper()
|
||||
cmd := test.Cmd
|
||||
|
||||
actual := &bytes.Buffer{}
|
||||
@ -62,58 +65,45 @@ func RunTest(t *testing.T, test *CmdTest) {
|
||||
|
||||
// ReadFixtureBytes is a convenience function for opening a test fixture
|
||||
func ReadFixtureBytes(t *testing.T, filename string) []byte {
|
||||
t.Helper()
|
||||
fixtureData, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error while reading fixture at %s: %s", filename, err.Error())
|
||||
}
|
||||
require.NoErrorf(t, err, "Unexpected error while reading fixture at %s", filename)
|
||||
return fixtureData
|
||||
}
|
||||
|
||||
// ReadFixtureString is a convenience function for opening a test fixture
|
||||
func ReadFixtureString(t *testing.T, filename string) string {
|
||||
t.Helper()
|
||||
return string(ReadFixtureBytes(t, filename))
|
||||
}
|
||||
|
||||
func updateGolden(t *testing.T, test *CmdTest, actual []byte) {
|
||||
t.Helper()
|
||||
goldenDir := filepath.Join(testdataDir, t.Name()+goldenDirSuffix)
|
||||
if err := os.MkdirAll(goldenDir, 0775); err != nil {
|
||||
t.Fatalf("Failed to create golden directory %s: %s", goldenDir, err)
|
||||
}
|
||||
err := os.MkdirAll(goldenDir, 0775)
|
||||
require.NoErrorf(t, err, "Failed to create golden directory %s", goldenDir)
|
||||
t.Logf("Created %s", goldenDir)
|
||||
goldenFilePath := filepath.Join(goldenDir, test.Name+goldenFileSuffix)
|
||||
t.Logf("Updating golden file: %s", goldenFilePath)
|
||||
if err := ioutil.WriteFile(goldenFilePath, normalize(actual), 0666); err != nil {
|
||||
t.Fatalf("Failed to update golden file: %s", err)
|
||||
}
|
||||
err = ioutil.WriteFile(goldenFilePath, normalize(actual), 0666)
|
||||
require.NoErrorf(t, err, "Failed to update golden file at %s", goldenFilePath)
|
||||
}
|
||||
|
||||
func assertEqualGolden(t *testing.T, test *CmdTest, actual []byte) {
|
||||
t.Helper()
|
||||
goldenDir := filepath.Join(testdataDir, t.Name()+goldenDirSuffix)
|
||||
goldenFilePath := filepath.Join(goldenDir, test.Name+goldenFileSuffix)
|
||||
golden, err := ioutil.ReadFile(goldenFilePath)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed while reading golden file: %s", err)
|
||||
}
|
||||
if !bytes.Equal(actual, golden) {
|
||||
errFmt := "Output does not match golden file: %s\nEXPECTED:\n%s\nGOT:\n%s"
|
||||
t.Errorf(errFmt, goldenFilePath, string(golden), string(actual))
|
||||
}
|
||||
require.NoErrorf(t, err, "Failed while reading golden file at %s", goldenFilePath)
|
||||
assert.Equal(t, string(actual), string(golden))
|
||||
}
|
||||
|
||||
func checkError(t *testing.T, actual, expected error) {
|
||||
t.Helper()
|
||||
if expected == nil {
|
||||
if actual == nil {
|
||||
return
|
||||
}
|
||||
t.Fatalf("Unexpected error: %q", actual.Error())
|
||||
}
|
||||
|
||||
if actual == nil {
|
||||
t.Fatalf("Expected error %q, but got nil", expected.Error())
|
||||
}
|
||||
|
||||
if actual.Error() != expected.Error() {
|
||||
t.Fatalf("Expected error %q, but got %q", expected.Error(), actual.Error())
|
||||
require.NoError(t, actual)
|
||||
} else {
|
||||
require.Error(t, actual)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user