-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e829316
commit 0a18d3a
Showing
2 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,57 @@ | ||
module github.com/Kavinraja-G/node-gizmogo 1.20require ( github.com/Kavinraja-G/kube-bouncer v0.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.7.0 k8s.io/api v0.28.0 k8s.io/apimachinery v0.28.0 k8s.io/client-go v0.28.0)require ( github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/imdario/mergo v0.3.6 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/moby/spdystream v0.2.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect golang.org/x/net v0.13.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect golang.org/x/sys v0.10.0 // indirect golang.org/x/term v0.10.0 // indirect golang.org/x/text v0.11.0 // indirect golang.org/x/time v0.3.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.100.1 // indirect k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.3.0 // indirect) | ||
module github.com/Kavinraja-G/node-gizmo | ||
|
||
go 1.20 | ||
|
||
require ( | ||
github.com/Kavinraja-G/kube-bouncer v0.1.0 | ||
github.com/olekukonko/tablewriter v0.0.5 | ||
github.com/spf13/cobra v1.7.0 | ||
k8s.io/api v0.28.0 | ||
k8s.io/apimachinery v0.28.0 | ||
k8s.io/client-go v0.28.0 | ||
) | ||
|
||
require ( | ||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/emicklei/go-restful/v3 v3.9.0 // indirect | ||
github.com/go-logr/logr v1.2.4 // indirect | ||
github.com/go-openapi/jsonpointer v0.19.6 // indirect | ||
github.com/go-openapi/jsonreference v0.20.2 // indirect | ||
github.com/go-openapi/swag v0.22.3 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/google/gnostic-models v0.6.8 // indirect | ||
github.com/google/go-cmp v0.5.9 // indirect | ||
github.com/google/gofuzz v1.2.0 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/imdario/mergo v0.3.6 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/josharian/intern v1.0.0 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/mailru/easyjson v0.7.7 // indirect | ||
github.com/mattn/go-runewidth v0.0.9 // indirect | ||
github.com/moby/spdystream v0.2.0 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | ||
github.com/russross/blackfriday/v2 v2.1.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
golang.org/x/net v0.13.0 // indirect | ||
golang.org/x/oauth2 v0.8.0 // indirect | ||
golang.org/x/sys v0.10.0 // indirect | ||
golang.org/x/term v0.10.0 // indirect | ||
golang.org/x/text v0.11.0 // indirect | ||
golang.org/x/time v0.3.0 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/protobuf v1.30.0 // indirect | ||
gopkg.in/inf.v0 v0.9.1 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
k8s.io/klog/v2 v2.100.1 // indirect | ||
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect | ||
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect | ||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect | ||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect | ||
sigs.k8s.io/yaml v1.3.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,63 @@ | ||
package pkgimport "testing"func TestGetNodeTopologyInfo(t *testing.T) { type args struct { labels map[string]string } tests := []struct { name string args args region string zone string }{ { name: "WithRegionAndZoneInfo", args: args{ labels: map[string]string{ TopologyRegionLabel: "us-east-1", TopologyZoneLabel: "us-east-1a", }, }, region: "us-east-1", zone: "us-east-1a", }, { name: "NoRegionAndZoneLabels", args: args{ labels: map[string]string{}, }, region: "", zone: "", }, { name: "WithOnlyRegionLabel", args: args{ labels: map[string]string{ TopologyRegionLabel: "us-east-1", }, }, region: "us-east-1", zone: "", }, { name: "WithOnlyZoneLabel", args: args{ labels: map[string]string{ TopologyZoneLabel: "us-east-1a", }, }, region: "", zone: "us-east-1a", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, got1 := GetNodeTopologyInfo(tt.args.labels) if got != tt.region { t.Errorf("GetNodeTopologyInfo() got = %v, region %v", got, tt.region) } if got1 != tt.zone { t.Errorf("GetNodeTopologyInfo() got1 = %v, zone %v", got1, tt.zone) } }) }} | ||
package pkg | ||
|
||
import "testing" | ||
|
||
func TestGetNodeTopologyInfo(t *testing.T) { | ||
type args struct { | ||
labels map[string]string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
region string | ||
zone string | ||
}{ | ||
{ | ||
name: "WithRegionAndZoneInfo", | ||
args: args{ | ||
labels: map[string]string{ | ||
TopologyRegionLabel: "us-east-1", | ||
TopologyZoneLabel: "us-east-1a", | ||
}, | ||
}, | ||
region: "us-east-1", | ||
zone: "us-east-1a", | ||
}, { | ||
name: "NoRegionAndZoneLabels", | ||
args: args{ | ||
labels: map[string]string{}, | ||
}, | ||
region: "", | ||
zone: "", | ||
}, { | ||
name: "WithOnlyRegionLabel", | ||
args: args{ | ||
labels: map[string]string{ | ||
TopologyRegionLabel: "us-east-1", | ||
}, | ||
}, | ||
region: "us-east-1", | ||
zone: "", | ||
}, { | ||
name: "WithOnlyZoneLabel", | ||
args: args{ | ||
labels: map[string]string{ | ||
TopologyZoneLabel: "us-east-1a", | ||
}, | ||
}, | ||
region: "", | ||
zone: "us-east-1a", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, got1 := GetNodeTopologyInfo(tt.args.labels) | ||
if got != tt.region { | ||
t.Errorf("GetNodeTopologyInfo() got = %v, region %v", got, tt.region) | ||
} | ||
if got1 != tt.zone { | ||
t.Errorf("GetNodeTopologyInfo() got1 = %v, zone %v", got1, tt.zone) | ||
} | ||
}) | ||
} | ||
} |