Skip to content

Commit 290687f

Browse files
author
Artem Stoianov
committed
POD-135: Fix ping command and change iso field type again
1 parent 6556d13 commit 290687f

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

cmd/ping.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ var (
4242
)
4343

4444
func initPingCmd(parentCmd *cobra.Command) {
45-
parentCmd.AddCommand(pingCmd)
45+
addCommonFlags(pingCmd)
4646
pingCmd.Flags().IntVarP(&pingLimit, "limit", "L", 1, "The maximum number of nodes to use")
47+
parentCmd.AddCommand(pingCmd)
4748
}
4849

4950
func runPing(c *perfops.Client, target, from string, nodeIDs []int, limit int) error {

cmd/ping_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ func TestInitPingCmd(t *testing.T) {
2525
args []string
2626
gotexp func() (interface{}, interface{})
2727
}{
28+
// Common flags
29+
"from": {[]string{"--from", "Europe"}, func() (interface{}, interface{}) { return from, "Europe" }},
30+
"nodeid": {[]string{"--nodeid", "1,2,3"}, func() (interface{}, interface{}) { return nodeIDs, []int{1, 2, 3} }},
31+
"json": {[]string{"--json"}, func() (interface{}, interface{}) { return outputJSON, true }},
32+
2833
"limit": {[]string{"--limit", "23"}, func() (interface{}, interface{}) { return pingLimit, 23 }},
2934
}
3035
parent := &cobra.Command{}

perfops/geotypes.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ type (
1010

1111
// Country contains information about a country.
1212
Country struct {
13-
ID int `json:"id"`
14-
Name string `json:"name"`
15-
ISO string `json:"iso"`
16-
ISONumeric string `json:"isoNumeric"`
17-
Continent *Continent `json:"continent,omitempty"`
13+
ID int `json:"id"`
14+
Name string `json:"name"`
15+
ISO string `json:"iso"`
16+
ISONumeric interface{} `json:"isoNumeric"` // TODO: Must fix API to return same type for tests and for list endpoints
17+
Continent *Continent `json:"continent,omitempty"`
1818
}
1919

2020
// City contains information about a city.

0 commit comments

Comments
 (0)