You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/09/10 19:46:11 UTC

[GitHub] dangogh closed pull request #2800: Fix Grove grovetccfg for lib/tc version change

dangogh closed pull request #2800: Fix Grove grovetccfg for lib/tc version change
URL: https://github.com/apache/trafficcontrol/pull/2800
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/grove/grovetccfg/grovetccfg.go b/grove/grovetccfg/grovetccfg.go
index a7543ae46..a507af863 100644
--- a/grove/grovetccfg/grovetccfg.go
+++ b/grove/grovetccfg/grovetccfg.go
@@ -35,7 +35,6 @@ import (
 	"time"
 
 	"github.com/apache/trafficcontrol/lib/go-tc"
-	tcv13 "github.com/apache/trafficcontrol/lib/go-tc/v13"
 	to "github.com/apache/trafficcontrol/traffic_ops/client"
 
 	"github.com/apache/trafficcontrol/grove/config"
@@ -645,8 +644,8 @@ func makeServersHostnameMap(servers []tc.Server) map[string]tc.Server {
 	return m
 }
 
-func makeCachegroupsNameMap(cgs []tcv13.CacheGroup) map[string]tcv13.CacheGroup {
-	m := map[string]tcv13.CacheGroup{}
+func makeCachegroupsNameMap(cgs []tc.CacheGroup) map[string]tc.CacheGroup {
+	m := map[string]tc.CacheGroup{}
 	for _, cg := range cgs {
 		m[cg.Name] = cg
 	}
@@ -677,16 +676,16 @@ func makeDeliveryserviceRegexMap(dsrs []tc.DeliveryServiceRegexes) map[string][]
 	return m
 }
 
-func makeCDNMap(cdns []tcv13.CDN) map[string]tcv13.CDN {
-	m := map[string]tcv13.CDN{}
+func makeCDNMap(cdns []tc.CDN) map[string]tc.CDN {
+	m := map[string]tc.CDN{}
 	for _, cdn := range cdns {
 		m[cdn.Name] = cdn
 	}
 	return m
 }
 
-func makeDSCertMap(sslKeys []tcv13.CDNSSLKeys) map[string]tcv13.CDNSSLKeys {
-	m := map[string]tcv13.CDNSSLKeys{}
+func makeDSCertMap(sslKeys []tc.CDNSSLKeys) map[string]tc.CDNSSLKeys {
+	m := map[string]tc.CDNSSLKeys{}
 	for _, sslkey := range sslKeys {
 		m[sslkey.DeliveryService] = sslkey
 	}
@@ -722,7 +721,7 @@ func getServerDeliveryservices(hostname string, servers map[string]tc.Server, ds
 	return serverDses, nil
 }
 
-func getParents(hostname string, servers map[string]tc.Server, cachegroups map[string]tcv13.CacheGroup) ([]tc.Server, error) {
+func getParents(hostname string, servers map[string]tc.Server, cachegroups map[string]tc.CacheGroup) ([]tc.Server, error) {
 	server, ok := servers[hostname]
 	if !ok {
 		return nil, fmt.Errorf("hostname not found in Servers")
@@ -880,9 +879,9 @@ func createRulesOld(
 	dses []tc.DeliveryService,
 	parents []tc.Server,
 	dsRegexes map[string][]tc.DeliveryServiceRegex,
-	cdns map[string]tcv13.CDN,
+	cdns map[string]tc.CDN,
 	hostParams []tc.Parameter,
-	dsCerts map[string]tcv13.CDNSSLKeys,
+	dsCerts map[string]tc.CDNSSLKeys,
 	certDir string,
 ) (remap.RemapRules, error) {
 	rules := []remapdata.RemapRule{}
@@ -1025,15 +1024,15 @@ func createRulesOld(
 	return remapRules, nil
 }
 
-func getCertFileName(cert tcv13.CDNSSLKeys, dir string) string {
+func getCertFileName(cert tc.CDNSSLKeys, dir string) string {
 	return dir + string(os.PathSeparator) + strings.Replace(cert.Hostname, "*.", "", -1) + ".crt"
 }
 
-func getCertKeyFileName(cert tcv13.CDNSSLKeys, dir string) string {
+func getCertKeyFileName(cert tc.CDNSSLKeys, dir string) string {
 	return dir + string(os.PathSeparator) + strings.Replace(cert.Hostname, "*.", "", -1) + ".key"
 }
 
-func createCertificateFiles(cert tcv13.CDNSSLKeys, dir string) error {
+func createCertificateFiles(cert tc.CDNSSLKeys, dir string) error {
 	certFileName := getCertFileName(cert, dir)
 	crt, err := base64.StdEncoding.DecodeString(cert.Certificate.Crt)
 	if err != nil {
diff --git a/grove/stat/stats_test.go b/grove/stat/stats_test.go
index 9f17d58e7..5d24f68ac 100644
--- a/grove/stat/stats_test.go
+++ b/grove/stat/stats_test.go
@@ -20,7 +20,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/apache/trafficcontrol/grove/remap"
+	"github.com/apache/trafficcontrol/grove/remapdata"
 	"github.com/apache/trafficcontrol/grove/web"
 )
 
@@ -83,8 +83,8 @@ func TestStatsCount(t *testing.T) {
 		httpConns := web.NewConnMap()
 		httpsConns := web.NewConnMap()
 		addrs := []string{}
-		r := remap.RemapRule{RemapRuleBase: remap.RemapRuleBase{Name: "foo"}}
-		stats := New([]remap.RemapRule{r}, nil, 0, httpConns, httpsConns)
+		r := remapdata.RemapRule{RemapRuleBase: remapdata.RemapRuleBase{Name: "foo"}}
+		stats := New([]remapdata.RemapRule{r}, nil, 0, httpConns, httpsConns, "fakeversion")
 		expected := 10
 		StatsInc(httpConns, expected, &addrs)
 		if actual := stats.Connections(); actual != uint64(expected) {
@@ -95,8 +95,8 @@ func TestStatsCount(t *testing.T) {
 		httpConns := web.NewConnMap()
 		httpsConns := web.NewConnMap()
 		addrs := []string{}
-		r := remap.RemapRule{RemapRuleBase: remap.RemapRuleBase{Name: "foo"}}
-		stats := New([]remap.RemapRule{r}, nil, 0, httpConns, httpsConns)
+		r := remapdata.RemapRule{RemapRuleBase: remapdata.RemapRuleBase{Name: "foo"}}
+		stats := New([]remapdata.RemapRule{r}, nil, 0, httpConns, httpsConns, "fakeversion")
 		expected := 10
 		StatsInc(httpsConns, expected, &addrs)
 		if actual := stats.Connections(); actual != uint64(expected) {
@@ -107,8 +107,8 @@ func TestStatsCount(t *testing.T) {
 		httpConns := web.NewConnMap()
 		httpsConns := web.NewConnMap()
 		addrs := []string{}
-		r := remap.RemapRule{RemapRuleBase: remap.RemapRuleBase{Name: "foo"}}
-		stats := New([]remap.RemapRule{r}, nil, 0, httpConns, httpsConns)
+		r := remapdata.RemapRule{RemapRuleBase: remapdata.RemapRuleBase{Name: "foo"}}
+		stats := New([]remapdata.RemapRule{r}, nil, 0, httpConns, httpsConns, "fakeversion")
 		expected := 10
 		StatsInc(httpConns, expected, &addrs)
 		StatsInc(httpsConns, expected, &addrs)
@@ -121,8 +121,8 @@ func TestStatsCount(t *testing.T) {
 		httpConns := web.NewConnMap()
 		httpsConns := web.NewConnMap()
 		addrs := []string{}
-		r := remap.RemapRule{RemapRuleBase: remap.RemapRuleBase{Name: "foo"}}
-		stats := New([]remap.RemapRule{r}, nil, 0, httpConns, httpsConns)
+		r := remapdata.RemapRule{RemapRuleBase: remapdata.RemapRuleBase{Name: "foo"}}
+		stats := New([]remapdata.RemapRule{r}, nil, 0, httpConns, httpsConns, "fakeversion")
 		count := 10
 		StatsInc(httpConns, count, &addrs)
 		StatsDec(httpConns, count, &addrs)
@@ -134,8 +134,8 @@ func TestStatsCount(t *testing.T) {
 		httpConns := web.NewConnMap()
 		httpsConns := web.NewConnMap()
 		addrs := []string{}
-		r := remap.RemapRule{RemapRuleBase: remap.RemapRuleBase{Name: "foo"}}
-		stats := New([]remap.RemapRule{r}, nil, 0, httpConns, httpsConns)
+		r := remapdata.RemapRule{RemapRuleBase: remapdata.RemapRuleBase{Name: "foo"}}
+		stats := New([]remapdata.RemapRule{r}, nil, 0, httpConns, httpsConns, "fakeversion")
 		count := 10
 		StatsInc(httpsConns, count, &addrs)
 		StatsDec(httpsConns, count, &addrs)
@@ -147,8 +147,8 @@ func TestStatsCount(t *testing.T) {
 		httpConns := web.NewConnMap()
 		httpsConns := web.NewConnMap()
 		addrs := []string{}
-		r := remap.RemapRule{RemapRuleBase: remap.RemapRuleBase{Name: "foo"}}
-		stats := New([]remap.RemapRule{r}, nil, 0, httpConns, httpsConns)
+		r := remapdata.RemapRule{RemapRuleBase: remapdata.RemapRuleBase{Name: "foo"}}
+		stats := New([]remapdata.RemapRule{r}, nil, 0, httpConns, httpsConns, "fakeversion")
 		count := 10
 		StatsInc(httpConns, count, &addrs)
 		StatsInc(httpsConns, count, &addrs)
@@ -162,8 +162,8 @@ func TestStatsCount(t *testing.T) {
 		httpConns := web.NewConnMap()
 		httpsConns := web.NewConnMap()
 		addrs := []string{}
-		r := remap.RemapRule{RemapRuleBase: remap.RemapRuleBase{Name: "foo"}}
-		stats := New([]remap.RemapRule{r}, nil, 0, httpConns, httpsConns)
+		r := remapdata.RemapRule{RemapRuleBase: remapdata.RemapRuleBase{Name: "foo"}}
+		stats := New([]remapdata.RemapRule{r}, nil, 0, httpConns, httpsConns, "fakeversion")
 		count := 10
 		StatsInc(httpConns, count, &addrs)
 		StatsDec(httpConns, 1, &addrs)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services