Skip to content

Commit d32dccc

Browse files
authored
Merge pull request #42 from zarianec/POD-135
POD-135: Added cities and countries
2 parents 312feab + 290687f commit d32dccc

509 files changed

Lines changed: 131673 additions & 21593 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gopkg.lock

Lines changed: 26 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,9 @@
2222

2323

2424
[[constraint]]
25-
branch = "master"
25+
version = "~0.0.5"
2626
name = "github.com/spf13/cobra"
2727

2828
[[constraint]]
29-
branch = "master"
30-
name = "github.com/nsf/termbox-go"
31-
32-
[[constraint]]
33-
branch = "master"
29+
version = "~0.0.3"
3430
name = "github.com/gosuri/uilive"

cmd/curl.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ var (
4646
)
4747

4848
func initCurlCmd(parentCmd *cobra.Command) {
49-
parentCmd.AddCommand(curlCmd)
49+
addCommonFlags(curlCmd)
50+
5051
curlCmd.Flags().BoolVarP(&curlHead, "head", "I", false, "Fetch the headers only")
5152
curlCmd.Flags().BoolVarP(&curlInsecure, "insecure", "k", false, "Allow curl to proceed for server connections considered insecure")
5253
curlCmd.Flags().BoolVarP(&curlHTTP2, "http2", "", false, "Use HTTP version 2")
5354
curlCmd.Flags().IntVarP(&curlLimit, "limit", "L", 1, "The maximum number of nodes to use")
55+
56+
parentCmd.AddCommand(curlCmd)
5457
}
5558

5659
func runCurl(c *perfops.Client, target string, head, insecure, http2 bool, from string, nodeIDs []int, limit int) error {

cmd/curl_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package cmd
1515

1616
import (
17+
"reflect"
1718
"testing"
1819

1920
"github.com/spf13/cobra"
@@ -24,6 +25,11 @@ func TestInitCurlCmd(t *testing.T) {
2425
args []string
2526
gotexp func() (interface{}, interface{})
2627
}{
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+
2733
"head": {[]string{"--head"}, func() (interface{}, interface{}) { return curlHead, true }},
2834
"insecure": {[]string{"--insecure"}, func() (interface{}, interface{}) { return curlInsecure, true }},
2935
"http2": {[]string{"--http2"}, func() (interface{}, interface{}) { return curlHTTP2, true }},
@@ -42,7 +48,9 @@ func TestInitCurlCmd(t *testing.T) {
4248
if f == nil {
4349
t.Fatal("expected flag; got nil")
4450
}
45-
if got, exp := tc.gotexp(); got != exp {
51+
52+
got, exp := tc.gotexp();
53+
if reflect.DeepEqual(got, exp) == false {
4654
t.Fatalf("expected %v; got %v", exp, got)
4755
}
4856
})

cmd/dnsperf.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ var (
4545
)
4646

4747
func initDNSPerfCmd(parentCmd *cobra.Command) {
48-
parentCmd.AddCommand(dnsPerfCmd)
48+
addCommonFlags(dnsPerfCmd)
49+
4950
dnsPerfCmd.Flags().StringVarP(&dnsPerfDNSServer, "dns-server", "S", "", "The DNS server to use to query for the test. You can use 127.0.0.1 to use the local resolver for location based benchmarking.")
5051
dnsPerfCmd.Flags().IntVarP(&dnsPerfLimit, "limit", "L", 1, "The maximum number of nodes to use")
52+
53+
parentCmd.AddCommand(dnsPerfCmd)
5154
}
5255

5356
func runDNSPerf(c *perfops.Client, target, dnsServer, from string, nodeIDs []int, limit int) error {

cmd/dnsperf_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package cmd
1515

1616
import (
17+
"reflect"
1718
"testing"
1819

1920
"github.com/spf13/cobra"
@@ -24,6 +25,11 @@ func TestInitDNSPerfCmd(t *testing.T) {
2425
args []string
2526
gotexp func() (interface{}, interface{})
2627
}{
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+
2733
"dns-server": {[]string{"--dns-server", "123.234.0.1"}, func() (interface{}, interface{}) { return dnsPerfDNSServer, "123.234.0.1" }},
2834
"limit": {[]string{"--limit", "23"}, func() (interface{}, interface{}) { return dnsPerfLimit, 23 }},
2935
}
@@ -40,7 +46,9 @@ func TestInitDNSPerfCmd(t *testing.T) {
4046
if f == nil {
4147
t.Fatal("expected flag; got nil")
4248
}
43-
if got, exp := tc.gotexp(); got != exp {
49+
50+
got, exp := tc.gotexp();
51+
if reflect.DeepEqual(got, exp) == false {
4452
t.Fatalf("expected %v; got %v", exp, got)
4553
}
4654
})

cmd/dnsresolve.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ var (
4747
)
4848

4949
func initDNSResolveCmd(parentCmd *cobra.Command) {
50-
parentCmd.AddCommand(dnsResolveCmd)
50+
addCommonFlags(dnsResolveCmd)
51+
5152
dnsResolveCmd.Flags().StringVarP(&dnsResolveType, "type", "T", "", "The DNS query type. On of: A, AAAA, CNAME, MX, NAPTR, NS, PTR, SOA, SPF, SRV, TXT.")
5253
dnsResolveCmd.Flags().StringVarP(&dnsResolveDNSServer, "dns-server", "S", "", "The DNS server to use to query for the test. You can use 127.0.0.1 to use the local resolver for location based benchmarking.")
5354
dnsResolveCmd.Flags().IntVarP(&dnsResolveLimit, "limit", "L", 1, "The maximum number of nodes to use")
55+
5456
dnsResolveCmd.MarkFlagRequired("type")
5557
dnsResolveCmd.MarkFlagRequired("dns-server")
58+
59+
parentCmd.AddCommand(dnsResolveCmd)
5660
}
5761

5862
func runDNSResolve(c *perfops.Client, target, queryType, dnsServer, from string, nodeIDs []int, limit int) error {

cmd/dnsresolve_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package cmd
1515

1616
import (
17+
"reflect"
1718
"testing"
1819

1920
"github.com/spf13/cobra"
@@ -24,6 +25,11 @@ func TestInitDNSResolveCmd(t *testing.T) {
2425
args []string
2526
gotexp func() (interface{}, interface{})
2627
}{
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+
2733
"type": {[]string{"--type", "TXT"}, func() (interface{}, interface{}) { return dnsResolveType, "TXT" }},
2834
"dns-server": {[]string{"--dns-server", "123.234.0.1"}, func() (interface{}, interface{}) { return dnsResolveDNSServer, "123.234.0.1" }},
2935
"limit": {[]string{"--limit", "23"}, func() (interface{}, interface{}) { return dnsResolveLimit, 23 }},
@@ -41,7 +47,9 @@ func TestInitDNSResolveCmd(t *testing.T) {
4147
if f == nil {
4248
t.Fatal("expected flag; got nil")
4349
}
44-
if got, exp := tc.gotexp(); got != exp {
50+
51+
got, exp := tc.gotexp();
52+
if reflect.DeepEqual(got, exp) == false {
4553
t.Fatalf("expected %v; got %v", exp, got)
4654
}
4755
})

cmd/latency.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ var (
4242
)
4343

4444
func initLatencyCmd(parentCmd *cobra.Command) {
45+
addCommonFlags(latencyCmd)
4546
parentCmd.AddCommand(latencyCmd)
4647
latencyCmd.Flags().IntVarP(&latencyLimit, "limit", "L", 1, "The maximum number of nodes to use")
4748
}

cmd/latency_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package cmd
1515

1616
import (
17+
"reflect"
1718
"testing"
1819

1920
"github.com/spf13/cobra"
@@ -24,6 +25,11 @@ func TestInitLatencyCmd(t *testing.T) {
2425
args []string
2526
gotexp func() (interface{}, interface{})
2627
}{
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+
2733
"limit": {[]string{"--limit", "23"}, func() (interface{}, interface{}) { return latencyLimit, 23 }},
2834
}
2935
parent := &cobra.Command{}
@@ -39,7 +45,9 @@ func TestInitLatencyCmd(t *testing.T) {
3945
if f == nil {
4046
t.Fatal("expected flag; got nil")
4147
}
42-
if got, exp := tc.gotexp(); got != exp {
48+
49+
got, exp := tc.gotexp();
50+
if reflect.DeepEqual(got, exp) == false {
4351
t.Fatalf("expected %v; got %v", exp, got)
4452
}
4553
})

0 commit comments

Comments
 (0)