From 9cde5c489d46603f03a450575274096daca4ef39 Mon Sep 17 00:00:00 2001 From: Piyush Singariya Date: Tue, 22 Mar 2022 12:06:15 +0530 Subject: [PATCH 1/2] Handling unit tests Signed-off-by: Piyush Singariya --- .../internal/cli/root/system/testdata/context/addExpected.golden | 1 + 1 file changed, 1 insertion(+) diff --git a/mesheryctl/internal/cli/root/system/testdata/context/addExpected.golden b/mesheryctl/internal/cli/root/system/testdata/context/addExpected.golden index c9720e4db95..1d59d83b341 100644 --- a/mesheryctl/internal/cli/root/system/testdata/context/addExpected.golden +++ b/mesheryctl/internal/cli/root/system/testdata/context/addExpected.golden @@ -30,6 +30,7 @@ contexts: - meshery-osm - meshery-traefik-mesh - meshery-nginx-sm + - meshery-cilium channel: stable version: latest current-context: local From 591f9a265962b9d3672634e7076a7481b84adfb1 Mon Sep 17 00:00:00 2001 From: Piyush Singariya Date: Tue, 22 Mar 2022 12:24:46 +0530 Subject: [PATCH 2/2] updating tests Signed-off-by: Piyush Singariya --- go.mod | 164 ++++++++++++++++++++++++++- mesheryctl/pkg/utils/helpers_test.go | 10 +- 2 files changed, 171 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 127c0dcd45a..886403ba37a 100644 --- a/go.mod +++ b/go.mod @@ -68,4 +68,166 @@ require ( sigs.k8s.io/controller-runtime v0.10.3 ) -require github.com/opencontainers/image-spec v1.0.2 // indirect +require ( + cloud.google.com/go v0.99.0 // indirect + github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect + github.com/BurntSushi/toml v0.3.1 // indirect + github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver/v3 v3.1.1 // indirect + github.com/Masterminds/sprig/v3 v3.2.2 // indirect + github.com/Masterminds/squirrel v1.5.2 // indirect + github.com/Microsoft/go-winio v0.4.17 // indirect + github.com/Microsoft/hcsshim v0.8.21 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/acomagu/bufpipe v1.0.3 // indirect + github.com/agnivade/levenshtein v1.1.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bsm/redislock v0.7.1 // indirect + github.com/buger/jsonparser v1.1.1 // indirect + github.com/capnm/sysinfo v0.0.0-20130621111458-5909a53897f3 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect + github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490 // indirect + github.com/containerd/containerd v1.5.7 // indirect + github.com/containerd/continuity v0.1.0 // indirect + github.com/cyphar/filepath-securejoin v0.2.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/docker/cli v20.10.7+incompatible // indirect + github.com/docker/distribution v2.7.1+incompatible // indirect + github.com/docker/docker-credential-helpers v0.6.3 // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-metrics v0.0.1 // indirect + github.com/docker/go-units v0.4.0 // indirect + github.com/emirpasic/gods v1.12.0 // indirect + github.com/envoyproxy/protoc-gen-validate v0.6.2 // indirect + github.com/evanphx/json-patch v4.12.0+incompatible // indirect + github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect + github.com/fatih/color v1.13.0 // indirect + github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/go-errors/errors v1.0.1 // indirect + github.com/go-git/gcfg v1.5.0 // indirect + github.com/go-git/go-billy/v5 v5.3.1 // indirect + github.com/go-git/go-git/v5 v5.4.2 // indirect + github.com/go-logr/logr v0.4.0 // indirect + github.com/go-openapi/analysis v0.19.10 // indirect + github.com/go-openapi/errors v0.19.8 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.19.5 // indirect + github.com/go-openapi/loads v0.19.5 // indirect + github.com/go-openapi/spec v0.19.8 // indirect + github.com/go-openapi/swag v0.19.14 // indirect + github.com/go-openapi/validate v0.19.10 // indirect + github.com/go-redis/redis/v8 v8.11.4 // indirect + github.com/go-redis/redis_rate/v9 v9.1.2 // indirect + github.com/go-stack/stack v1.8.0 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/btree v1.0.1 // indirect + github.com/google/go-cmp v0.5.6 // indirect + github.com/google/gofuzz v1.1.0 // indirect + github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/googleapis/gnostic v0.5.5 // indirect + github.com/gosimple/unidecode v1.0.1 // indirect + github.com/gosuri/uitable v0.0.4 // indirect + github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/huandu/xstrings v1.3.2 // indirect + github.com/imdario/mergo v0.3.12 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.4 // indirect + github.com/jmoiron/sqlx v1.3.1 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect + github.com/klauspost/compress v1.14.4 // indirect + github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect + github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect + github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/mailru/easyjson v0.7.6 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-sqlite3 v1.14.6 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/mitchellh/copystructure v1.1.1 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/go-wordwrap v1.0.0 // indirect + github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/mitchellh/reflectwalk v1.0.1 // indirect + github.com/moby/locker v1.0.1 // indirect + github.com/moby/spdystream v0.2.0 // indirect + github.com/moby/term v0.0.0-20210610120745-9d4ed1856297 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect + github.com/morikuni/aec v1.0.0 // indirect + github.com/nats-io/nats.go v1.13.1-0.20220308171302-2f2f6968e98d // indirect + github.com/nats-io/nkeys v0.3.0 // indirect + github.com/nats-io/nuid v1.0.1 // indirect + github.com/oklog/ulid v1.3.1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect + github.com/opencontainers/runc v1.0.2 // indirect + github.com/pelletier/go-toml v1.9.4 // indirect + github.com/peterbourgon/diskv v2.0.1+incompatible // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/qri-io/jsonpointer v0.1.1 // indirect + github.com/rubenv/sql-migrate v0.0.0-20210614095031-55d5740dbbcc // indirect + github.com/russross/blackfriday v1.5.2 // indirect + github.com/sergi/go-diff v1.1.0 // indirect + github.com/shopspring/decimal v1.2.0 // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/stretchr/testify v1.7.0 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + github.com/xanzy/ssh-agent v0.3.0 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/xeipuuv/gojsonschema v1.2.0 // indirect + github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect + go.mongodb.org/mongo-driver v1.5.1 // indirect + go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect + golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce // indirect + golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect + gopkg.in/gorp.v1 v1.7.2 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/ini.v1 v1.66.2 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gorm.io/driver/sqlite v1.1.4 // indirect + helm.sh/helm/v3 v3.7.2 // indirect + k8s.io/apiserver v0.22.4 // indirect + k8s.io/cli-runtime v0.23.0-alpha.1 // indirect + k8s.io/component-base v0.23.0-alpha.1 // indirect + k8s.io/klog/v2 v2.10.0 // indirect + k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect + k8s.io/kubectl v0.23.0-alpha.1 // indirect + k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect + oras.land/oras-go v0.4.0 // indirect + sigs.k8s.io/kustomize/api v0.10.1 // indirect + sigs.k8s.io/kustomize/kyaml v0.13.0 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect + sigs.k8s.io/yaml v1.2.0 // indirect +) diff --git a/mesheryctl/pkg/utils/helpers_test.go b/mesheryctl/pkg/utils/helpers_test.go index cf1a90fcddf..be57af922c0 100644 --- a/mesheryctl/pkg/utils/helpers_test.go +++ b/mesheryctl/pkg/utils/helpers_test.go @@ -579,6 +579,9 @@ func TestSetOverrideValues(t *testing.T) { "meshery-istio": map[string]interface{}{ "enabled": true, }, + "meshery-cilium": map[string]interface{}{ + "enabled": false, + }, "meshery-linkerd": map[string]interface{}{ "enabled": false, }, @@ -612,7 +615,7 @@ func TestSetOverrideValues(t *testing.T) { name: "Context contains all available components and meshery image version", ctx: &config.Context{ Components: []string{"meshery-istio", "meshery-linkerd", "meshery-consul", "meshery-kuma", - "meshery-osm", "meshery-nsm", "meshery-nginx-sm", "meshery-traefik-mesh", "meshery-cpx"}, + "meshery-osm", "meshery-nsm", "meshery-nginx-sm", "meshery-traefik-mesh", "meshery-cpx", "meshery-cilium"}, Channel: testChannel, }, mesheryImageVersion: "testImageVersion", @@ -623,6 +626,9 @@ func TestSetOverrideValues(t *testing.T) { "meshery-istio": map[string]interface{}{ "enabled": true, }, + "meshery-cilium": map[string]interface{}{ + "enabled": true, + }, "meshery-linkerd": map[string]interface{}{ "enabled": true, }, @@ -658,7 +664,7 @@ func TestSetOverrideValues(t *testing.T) { got := SetOverrideValues(tt.ctx, tt.mesheryImageVersion) eq := reflect.DeepEqual(got, tt.want) if !eq { - t.Errorf("ReadToken got = %v want = %v", got, tt.want) + t.Errorf("SetOverrideValues %s got = %v want = %v", tt.name, got, tt.want) } } }