You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/01/10 03:38:13 UTC
[01/50] incubator-trafficcontrol git commit: add convert service for
docker-compose for psql conversion
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/master 9328758e5 -> cc1a8b77c
add convert service for docker-compose for psql conversion
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/731ecd71
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/731ecd71
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/731ecd71
Branch: refs/heads/master
Commit: 731ecd715f08cb12b862add412512e7cf248544d
Parents: 0af3118
Author: Dan Kirkwood <da...@gmail.com>
Authored: Thu Dec 1 20:51:06 2016 +0000
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:58 2017 -0700
----------------------------------------------------------------------
.../app/db/pg-migration/Dockerfile-convert | 7 +++++++
.../app/db/pg-migration/Dockerfile-pgloader | 2 +-
.../app/db/pg-migration/docker-compose.yml | 19 +++++++++++++++----
3 files changed, 23 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/731ecd71/traffic_ops/app/db/pg-migration/Dockerfile-convert
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-convert b/traffic_ops/app/db/pg-migration/Dockerfile-convert
new file mode 100644
index 0000000..7f96523
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-convert
@@ -0,0 +1,7 @@
+FROM postgres:9.6
+
+MAINTAINER Dan Kirkwood
+
+ADD convert_bools.sql .
+
+CMD psql postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB < ./convert_bools.sql
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/731ecd71/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-pgloader b/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
index 5bd4aab..5acc979 100644
--- a/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
@@ -4,5 +4,5 @@ MAINTAINER Dan Kirkwood <da...@apache.org>
# install nc to check that postgres and mysql are ready..
RUN apt-get -y install netcat
-ADD runpgloader.sh .
+ADD pg-migration/runpgloader.sh .
CMD ./runpgloader.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/731ecd71/traffic_ops/app/db/pg-migration/docker-compose.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/docker-compose.yml b/traffic_ops/app/db/pg-migration/docker-compose.yml
index c8ac83d..fc327fa 100644
--- a/traffic_ops/app/db/pg-migration/docker-compose.yml
+++ b/traffic_ops/app/db/pg-migration/docker-compose.yml
@@ -1,10 +1,11 @@
version: '2'
services:
+ # dataimport reads data from an existing traffic_ops server running mysql thru the API
dataimport:
build:
- dockerfile: Dockerfile-traffic_ops-client
context: .
+ dockerfile: Dockerfile-traffic_ops-client
restart: "no"
environment:
- TO_USER
@@ -14,6 +15,7 @@ services:
volumes:
- ./mysql/initdb.d:/docker-entrypoint-initdb.d
+ # mysql_host loads mysql data locally and provides direct access for pgloader
mysql_host:
image: mysql:5.6
restart: "no"
@@ -28,10 +30,11 @@ services:
- ./mysql/conf.d:/etc/mysql/conf.d
- ./mysql/initdb.d:/docker-entrypoint-initdb.d
+ # postgres_host provides a postgres data to import data to
postgres_host:
build:
- dockerfile: pg-migration/Dockerfile-postgres
context: ..
+ dockerfile: pg-migration/Dockerfile-postgres
restart: "no"
environment:
- POSTGRES_DB=traffic_ops
@@ -42,10 +45,11 @@ services:
ports:
- 5432
+ # pgloader converts the data from mysql to postgres
pgloader:
build:
- dockerfile: Dockerfile-pgloader
- context: .
+ context: ..
+ dockerfile: pg-migration/Dockerfile-pgloader
restart: "no"
depends_on:
- mysql_host
@@ -59,3 +63,10 @@ services:
- POSTGRES_DB=traffic_ops
- POSTGRES_PASSWORD=twelve
- POSTGRES_USER=traffic_ops
+
+ # convert runs necessary post-import conversion(s) in postgres
+ convert:
+ build:
+ context: ..
+ dockerfile: pg-migration/Dockerfile-convert
+ restart: "no"
[38/50] incubator-trafficcontrol git commit: makes cdn name not null
Posted by mi...@apache.org.
makes cdn name not null
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/709f428d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/709f428d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/709f428d
Branch: refs/heads/master
Commit: 709f428d1d95864f9744f2df1b5d4a8bb1a66137
Parents: aeaac36
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Fri Dec 9 09:09:20 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700
----------------------------------------------------------------------
.../20161208000000_alter_cdn_name_not_null.sql | 23 ++++++++++++++++++++
traffic_ops/app/lib/Schema/Result/Cdn.pm | 8 +++----
2 files changed, 27 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/709f428d/traffic_ops/app/db/migrations/20161208000000_alter_cdn_name_not_null.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/migrations/20161208000000_alter_cdn_name_not_null.sql b/traffic_ops/app/db/migrations/20161208000000_alter_cdn_name_not_null.sql
new file mode 100644
index 0000000..a11d269
--- /dev/null
+++ b/traffic_ops/app/db/migrations/20161208000000_alter_cdn_name_not_null.sql
@@ -0,0 +1,23 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+-- +goose Up
+-- SQL in section 'Up' is executed when this migration is applied
+ALTER TABLE CDN ALTER COLUMN NAME SET NOT NULL;
+
+-- +goose Down
+-- SQL section 'Down' is executed when this migration is rolled back
+ALTER TABLE CDN ALTER COLUMN NAME SET NULL;
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/709f428d/traffic_ops/app/lib/Schema/Result/Cdn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/Cdn.pm b/traffic_ops/app/lib/Schema/Result/Cdn.pm
index 57dfc6e..d8c05fd 100644
--- a/traffic_ops/app/lib/Schema/Result/Cdn.pm
+++ b/traffic_ops/app/lib/Schema/Result/Cdn.pm
@@ -33,7 +33,7 @@ __PACKAGE__->table("cdn");
=head2 name
data_type: 'text'
- is_nullable: 1
+ is_nullable: 0
=head2 last_updated
@@ -59,7 +59,7 @@ __PACKAGE__->add_columns(
sequence => "cdn_id_seq",
},
"name",
- { data_type => "text", is_nullable => 1 },
+ { data_type => "text", is_nullable => 0 },
"last_updated",
{
data_type => "timestamp with time zone",
@@ -85,7 +85,7 @@ __PACKAGE__->set_primary_key("id");
=head1 UNIQUE CONSTRAINTS
-=head2 C<idx_54267_cdn_cdn_unique>
+=head2 C<idx_24701_cdn_cdn_unique>
=over 4
@@ -95,7 +95,7 @@ __PACKAGE__->set_primary_key("id");
=cut
-__PACKAGE__->add_unique_constraint("idx_54267_cdn_cdn_unique", ["name"]);
+__PACKAGE__->add_unique_constraint("idx_24701_cdn_cdn_unique", ["name"]);
=head1 RELATIONS
[43/50] incubator-trafficcontrol git commit: remove blank lines from
env files -- causes problems with docker-compose
Posted by mi...@apache.org.
remove blank lines from env files -- causes problems with docker-compose
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/0df488b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/0df488b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/0df488b6
Branch: refs/heads/master
Commit: 0df488b6c916e22e301b12a09cab80d227b17b8a
Parents: dc136a1
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed Dec 21 19:23:51 2016 +0000
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:12 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/pg-migration/dataimport.env | 2 --
traffic_ops/app/db/pg-migration/mysql.env | 2 --
traffic_ops/app/db/pg-migration/postgres.env | 2 --
3 files changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0df488b6/traffic_ops/app/db/pg-migration/dataimport.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/dataimport.env b/traffic_ops/app/db/pg-migration/dataimport.env
index b177869..3364c52 100644
--- a/traffic_ops/app/db/pg-migration/dataimport.env
+++ b/traffic_ops/app/db/pg-migration/dataimport.env
@@ -1,4 +1,3 @@
-#!/bin/bash -x
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,7 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
TO_SERVER=http://traffic_ops.example.com
TO_USER=to_user
TO_PASSWORD=twelve
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0df488b6/traffic_ops/app/db/pg-migration/mysql.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql.env b/traffic_ops/app/db/pg-migration/mysql.env
index ead4c15..15d3bea 100644
--- a/traffic_ops/app/db/pg-migration/mysql.env
+++ b/traffic_ops/app/db/pg-migration/mysql.env
@@ -1,4 +1,3 @@
-#!/bin/bash -x
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,7 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
MYSQL_DATABASE=traffic_ops_db
MYSQL_HOST=mysql
MYSQL_RANDOM_ROOT_PASSWORD=yes
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0df488b6/traffic_ops/app/db/pg-migration/postgres.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/postgres.env b/traffic_ops/app/db/pg-migration/postgres.env
index db23c8f..c08bc5b 100644
--- a/traffic_ops/app/db/pg-migration/postgres.env
+++ b/traffic_ops/app/db/pg-migration/postgres.env
@@ -1,4 +1,3 @@
-#!/bin/bash -x
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,7 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
POSTGRES_HOST=postgres
POSTGRES_DB=traffic_ops
POSTGRES_PASSWORD=twelve
[41/50] incubator-trafficcontrol git commit: add apache license
Posted by mi...@apache.org.
add apache license
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a7641273
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a7641273
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a7641273
Branch: refs/heads/master
Commit: a7641273202f422b28cc9f09b676d63238005283
Parents: c2d55a1
Author: Dan Kirkwood <da...@gmail.com>
Authored: Tue Dec 13 17:41:53 2016 +0000
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/pg-migration/mysql.env | 15 +++++++++++++++
traffic_ops/app/db/pg-migration/postgres.env | 15 +++++++++++++++
2 files changed, 30 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a7641273/traffic_ops/app/db/pg-migration/mysql.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql.env b/traffic_ops/app/db/pg-migration/mysql.env
index de12f7d..ead4c15 100644
--- a/traffic_ops/app/db/pg-migration/mysql.env
+++ b/traffic_ops/app/db/pg-migration/mysql.env
@@ -1,3 +1,18 @@
+#!/bin/bash -x
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
MYSQL_DATABASE=traffic_ops_db
MYSQL_HOST=mysql
MYSQL_RANDOM_ROOT_PASSWORD=yes
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a7641273/traffic_ops/app/db/pg-migration/postgres.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/postgres.env b/traffic_ops/app/db/pg-migration/postgres.env
index 3e3c636..db23c8f 100644
--- a/traffic_ops/app/db/pg-migration/postgres.env
+++ b/traffic_ops/app/db/pg-migration/postgres.env
@@ -1,3 +1,18 @@
+#!/bin/bash -x
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
POSTGRES_HOST=postgres
POSTGRES_DB=traffic_ops
POSTGRES_PASSWORD=twelve
[42/50] incubator-trafficcontrol git commit: use mysql 5.5 for
conversion
Posted by mi...@apache.org.
use mysql 5.5 for conversion
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/eafd4827
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/eafd4827
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/eafd4827
Branch: refs/heads/master
Commit: eafd48272f0117dbf69e43433420bc97ae53b245
Parents: b5964d8
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed Dec 21 11:23:59 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:12 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/pg-migration/Dockerfile-mysql | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/eafd4827/traffic_ops/app/db/pg-migration/Dockerfile-mysql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-mysql b/traffic_ops/app/db/pg-migration/Dockerfile-mysql
index a4bf51f..36e7826 100644
--- a/traffic_ops/app/db/pg-migration/Dockerfile-mysql
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-mysql
@@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM mysql:5.6
+FROM mysql:5.5
MAINTAINER Dan Kirkwood
[09/50] incubator-trafficcontrol git commit: initial commit of
integration tests
Posted by mi...@apache.org.
initial commit of integration tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/3fa2b81e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/3fa2b81e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/3fa2b81e
Branch: refs/heads/master
Commit: 3fa2b81e3231dafc11662c7c5d094e6a19e65f6f
Parents: 5b40c9a
Author: David Neuman <da...@gmail.com>
Authored: Tue Nov 29 15:42:37 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
.../client/tests/integration/cachegroup_test.go | 68 +++++
.../client/tests/integration/cdn_test.go | 91 +++++++
.../client/tests/integration/crconfig_test.go | 25 ++
.../tests/integration/deliveryservice_test.go | 267 +++++++++++++++++++
.../tests/integration/integration_helper.go | 89 +++++++
5 files changed, 540 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3fa2b81e/traffic_ops/client/tests/integration/cachegroup_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/cachegroup_test.go b/traffic_ops/client/tests/integration/cachegroup_test.go
new file mode 100644
index 0000000..fbf19a5
--- /dev/null
+++ b/traffic_ops/client/tests/integration/cachegroup_test.go
@@ -0,0 +1,68 @@
+package integration
+
+import (
+ "encoding/json"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+//TestCachegroupResults compares the results of the Cachegroup api and Cachegroup client
+func TestCachegroups(t *testing.T) {
+ //Get Cachegroups Data from API
+ resp, err := Request(*to, "GET", "/api/1.2/cachegroups.json", nil)
+ if err != nil {
+ t.Errorf("Could not get cachegroups.json reponse was: %v\n", err)
+ }
+
+ defer resp.Body.Close()
+ var apiCgRes traffic_ops.CacheGroupResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiCgRes); err != nil {
+ t.Errorf("Could not decode Cachegroup json. Error is: %v\n", err)
+ }
+ apiCgs := apiCgRes.Response
+
+ clientCgs, err := to.CacheGroups()
+ if err != nil {
+ t.Errorf("Could not get Cachegroups from client. Error is: %v\n", err)
+ }
+
+ if len(apiCgs) != len(clientCgs) {
+ t.Errorf("Array lengths from client and API are different...API = %d, Client = %d\n", len(apiCgs), len(clientCgs))
+ }
+
+ matchFound := false
+ for _, apiCg := range apiCgs {
+ for _, clientCg := range clientCgs {
+ if clientCg.Name != apiCg.Name {
+ continue
+ }
+ matchFound = true
+ //compare API results and client results
+ if apiCg.Name != clientCg.Name {
+ t.Errorf("Cachegroup Name from client and API are different...API = %s, Client = %s\n", apiCg.Name, clientCg.Name)
+ }
+ if apiCg.ShortName != clientCg.ShortName {
+ t.Errorf("Cachegroup ShortName from client and API are different...API = %s, Client = %s\n", apiCg.ShortName, clientCg.ShortName)
+ }
+ if apiCg.LastUpdated != clientCg.LastUpdated {
+ t.Errorf("Cachegroup Last Updated from client and API are different...API = %s, Client = %s\n", apiCg.Name, clientCg.Name)
+ }
+ if apiCg.Latitude != clientCg.Latitude {
+ t.Errorf("Cachegroup Latitude from client and API are different...API = %f, Client = %f\n", apiCg.Latitude, clientCg.Latitude)
+ }
+ if apiCg.Longitude != clientCg.Longitude {
+ t.Errorf("Cachegroup Longitude from client and API are different...API = %f, Client = %f\n", apiCg.Longitude, clientCg.Longitude)
+ }
+ if apiCg.ParentName != clientCg.ParentName {
+ t.Errorf("Cachegroup ParentName from client and API are different...API = %s, Client = %s\n", apiCg.ParentName, clientCg.ParentName)
+ }
+ if apiCg.Type != clientCg.Type {
+ t.Errorf("Cachegroup Type from client and API are different...API = %s, Client = %s\n", apiCg.Type, clientCg.Type)
+ }
+ }
+ if !matchFound {
+ t.Errorf("A match for %s from the API was not found in the client results\n", apiCg.Name)
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3fa2b81e/traffic_ops/client/tests/integration/cdn_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/cdn_test.go b/traffic_ops/client/tests/integration/cdn_test.go
new file mode 100644
index 0000000..04ad768
--- /dev/null
+++ b/traffic_ops/client/tests/integration/cdn_test.go
@@ -0,0 +1,91 @@
+package integration
+
+import (
+ "encoding/json"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+//TestCDNs compares the results of the CDN api and CDN client
+func TestCDNs(t *testing.T) {
+ //Get CDNs Data from API
+ resp, err := Request(*to, "GET", "/api/1.2/cdns.json", nil)
+ if err != nil {
+ t.Errorf("Could not get cdns.json reponse was: %v\n", err)
+ }
+
+ defer resp.Body.Close()
+ var apiCDNRes traffic_ops.CDNResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiCDNRes); err != nil {
+ t.Errorf("Could not decode CDN json. Error is: %v\n", err)
+ }
+ apiCDNs := apiCDNRes.Response
+
+ //get CDNs data from client
+ clientCDNs, err := to.CDNs()
+ if err != nil {
+ t.Errorf("Could not get CDNs from client. Error is: %v\n", err)
+ }
+
+ if len(apiCDNs) != len(clientCDNs) {
+ t.Errorf("Array lengths from client and API are different...API = %s, Client = %s\n", apiCDNs, clientCDNs)
+ }
+
+ matchFound := false
+ for _, apiCDN := range apiCDNs {
+ for _, clientCDN := range clientCDNs {
+ if clientCDN.Name != apiCDN.Name {
+ continue
+ }
+ matchFound = true
+ //compare API results and client results
+ if apiCDN.Name != clientCDN.Name {
+ t.Errorf("CDN Name from client and API are different...API = %s, Client = %s\n", apiCDN.Name, clientCDN.Name)
+ }
+ if apiCDN.LastUpdated != clientCDN.LastUpdated {
+ t.Errorf("CDN Last Updated from client and API are different...API = %s, Client = %s\n", apiCDN.Name, clientCDN.Name)
+ }
+ }
+ if !matchFound {
+ t.Errorf("A match for %s from the API was not found in the client results\n", apiCDN.Name)
+ }
+ }
+}
+
+//TestCDNName ensures the client returns a CDN by name
+func TestCDNName(t *testing.T) {
+ //Get CDNs Data from API
+ resp, err := Request(*to, "GET", "/api/1.2/cdns.json", nil)
+ if err != nil {
+ t.Errorf("Could not get cdns.json reponse was: %v\n", err)
+ }
+
+ defer resp.Body.Close()
+ var apiCDNRes traffic_ops.CDNResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiCDNRes); err != nil {
+ t.Errorf("Could not decode CDN json. Error is: %v\n", err)
+ }
+
+ apiCDNs := apiCDNRes.Response
+ apiName := apiCDNs[0].Name
+ apiLastUpdated := apiCDNs[0].LastUpdated
+
+ //get CDNs data from client
+ clientCDN, err := to.CDNName(apiName)
+
+ if len(clientCDN) != 1 {
+ t.Errorf("The length of the client CDN response %v is greater than 1!\n", len(apiCDNs))
+ }
+
+ clientName := clientCDN[0].Name
+ clientLastUpdated := clientCDN[0].LastUpdated
+
+ //compare API results and client results
+ if apiName != clientName {
+ t.Errorf("CDN Name from client and API are different...API = %s, Client = %s\n", apiName, clientName)
+ }
+ if apiLastUpdated != clientLastUpdated {
+ t.Errorf("CDN Last Updated from client and API are different...API = %s, Client = %s\n", apiName, clientName)
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3fa2b81e/traffic_ops/client/tests/integration/crconfig_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/crconfig_test.go b/traffic_ops/client/tests/integration/crconfig_test.go
new file mode 100644
index 0000000..7f404f7
--- /dev/null
+++ b/traffic_ops/client/tests/integration/crconfig_test.go
@@ -0,0 +1,25 @@
+package integration
+
+import "testing"
+
+//TestCachegroupResults compares the results of the Cachegroup api and Cachegroup client
+func TestGetCrConfig(t *testing.T) {
+ //Get a CDN from the to client
+ cdn, err := GetCdn()
+ if err != nil {
+ t.Errorf("TestGetCrConfig -- Could not get CDNs from TO...%v\n", err)
+ }
+
+ crConfig, cacheHitStatus, err := to.GetCRConfig(cdn.Name)
+ if err != nil {
+ t.Errorf("Could not get CrConfig for %s. Error is...%v\n", cdn.Name, err)
+ }
+
+ if cacheHitStatus == "" {
+ t.Error("cacheHitStatus is empty...")
+ }
+
+ if len(crConfig) == 0 {
+ t.Error("Raw CrConfig reponse was 0...")
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3fa2b81e/traffic_ops/client/tests/integration/deliveryservice_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/deliveryservice_test.go b/traffic_ops/client/tests/integration/deliveryservice_test.go
new file mode 100644
index 0000000..c224cdf
--- /dev/null
+++ b/traffic_ops/client/tests/integration/deliveryservice_test.go
@@ -0,0 +1,267 @@
+package integration
+
+import (
+ "encoding/json"
+ "strconv"
+ "testing"
+ "time"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+// TestDeliveryServices compares the results of the Deliveryservices api and Deliveryservices client
+func TestDeliveryServices(t *testing.T) {
+ resp, err := Request(*to, "GET", "/api/1.2/deliveryservices.json", nil)
+ if err != nil {
+ t.Errorf("Could not get deliveryservices.json reponse was: %v\n", err)
+ }
+
+ defer resp.Body.Close()
+ var apiDsRes traffic_ops.GetDeliveryServiceResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiDsRes); err != nil {
+ t.Errorf("Could not decode Deliveryservice json. Error is: %v\n", err)
+ }
+ apiDss := apiDsRes.Response
+
+ clientDss, err := to.DeliveryServices()
+ if err != nil {
+ t.Errorf("Could not get Deliveryservices from client. Error is: %v\n", err)
+ }
+
+ if len(apiDss) != len(clientDss) {
+ t.Errorf("Array lengths from client and API are different...API = %v, Client = %v\n", apiDss, clientDss)
+ }
+
+ matchFound := false
+ for _, apiDs := range apiDss {
+ for _, clientDs := range clientDss {
+ if clientDs.XMLID != apiDs.XMLID {
+ continue
+ }
+ matchFound = true
+ compareDs(apiDs, clientDs, t)
+ }
+ if !matchFound {
+ t.Errorf("A match for %s from the API was not found in the client results\n", apiDs.XMLID)
+ }
+ }
+}
+
+var testDsID string
+
+func TestCreateDs(t *testing.T) {
+ //create a DS and validate response
+ cdn, err := GetCdn()
+ if err != nil {
+ t.Errorf("TestCreateDs -- Could not get CDNs from TO...%v\n", err)
+ }
+
+ profile, err := GetProfile()
+ if err != nil {
+ t.Errorf("TestCreateDs -- Could not get Profiles from TO...%v\n", err)
+ }
+
+ newDs := new(traffic_ops.DeliveryService)
+ newDs.Active = false
+ newDs.CCRDNSTTL = 30
+ newDs.CDNName = cdn.Name
+ newDs.CacheURL = "cacheURL"
+ newDs.CheckPath = "CheckPath"
+ newDs.DNSBypassCname = "DNSBypassCNAME"
+ newDs.DNSBypassIP = "10.10.10.10"
+ newDs.DNSBypassIP6 = "FF01:0:0:0:0:0:0:FB"
+ newDs.DNSBypassTTL = 30
+ newDs.DSCP = 0
+ newDs.DisplayName = "DisplayName"
+ newDs.EdgeHeaderRewrite = "EdgeHeaderRewrite"
+ newDs.GeoLimit = 5
+ newDs.GeoProvider = 1
+ newDs.GlobalMaxMBPS = 15000
+ newDs.GlobalMaxTPS = 15000
+ newDs.HTTPBypassFQDN = "HTTPBypassFQDN"
+ newDs.IPV6RoutingEnabled = true
+ newDs.InfoURL = "InfoUrl"
+ newDs.InitialDispersion = 5
+ newDs.LongDesc = "LongDesc"
+ newDs.LongDesc1 = "LongDesc1"
+ newDs.LongDesc2 = "LongDesc2"
+ newDs.MaxDNSAnswers = 5
+ newDs.MidHeaderRewrite = "MidHeaderRewrite"
+ newDs.MissLat = 5.555
+ newDs.MissLong = -50.5050
+ newDs.MultiSiteOrigin = true
+ newDs.OrgServerFQDN = "http://OrgServerFQDN"
+ newDs.ProfileDesc = profile.Description
+ newDs.ProfileName = profile.Name
+ newDs.Protocol = 1
+ newDs.QStringIgnore = 1
+ newDs.RangeRequestHandling = 0
+ newDs.RegexRemap = "regexRemap"
+ newDs.RemapText = "remapText"
+ newDs.Signed = false
+ newDs.TRResponseHeaders = "TRResponseHeaders"
+ newDs.Type = "HTTP"
+ newDs.XMLID = "Test-DS-" + strconv.FormatInt(time.Now().Unix(), 10)
+ newDs.RegionalGeoBlocking = false
+ newDs.LogsEnabled = false
+
+ //Create currently does not write regexes...
+ // newDsMatch1 := new(traffic_ops.DeliveryServiceMatch)
+ // newDsMatch1.Pattern = "Pattern1"
+ // newDsMatch1.SetNumber = "0"
+ // newDsMatch1.Type = "HOST"
+
+ // newDsMatch2 := new(traffic_ops.DeliveryServiceMatch)
+ // newDsMatch2.Pattern = "Pattern2"
+ // newDsMatch2.SetNumber = "1"
+ // newDsMatch2.Type = "HOST"
+
+ // newDs.MatchList = append(newDs.MatchList, *newDsMatch1)
+ // newDs.MatchList = append(newDs.MatchList, *newDsMatch2)
+
+ res, err := to.CreateDeliveryService(newDs)
+ if err != nil {
+ t.Error("Failed to create deliveryservice! Error is: ", err)
+ } else {
+ compareDs(*newDs, res.Response[0], t)
+ }
+}
+
+func compareDs(ds1 traffic_ops.DeliveryService, ds2 traffic_ops.DeliveryService, t *testing.T) {
+ if ds1.Active != ds1.Active {
+ t.Errorf("Active -- Expected %v, Got %v\n", ds1.Active, ds2.Active)
+ }
+ if ds1.CCRDNSTTL != ds2.CCRDNSTTL {
+ t.Errorf("CCRDNSTTL -- Expected %v, Got %v\n", ds1.CCRDNSTTL, ds2.CCRDNSTTL)
+ }
+ if ds1.CDNName != ds2.CDNName {
+ t.Errorf("CDNName -- Expected %v, Got %v\n", ds1.CDNName, ds2.CDNName)
+ }
+ if ds1.CacheURL != ds2.CacheURL {
+ t.Errorf("CacheURL -- Expected %v, Got %v\n", ds1.CacheURL, ds2.CacheURL)
+ }
+ if ds1.CheckPath != ds2.CheckPath {
+ t.Errorf("CheckPath -- Expected %v, Got %v\n", ds1.CheckPath, ds2.CheckPath)
+ }
+ if ds1.DNSBypassCname != ds2.DNSBypassCname {
+ t.Errorf("DNSBypassCname -- Expected %v, Got %v\n", ds1.DNSBypassCname, ds2.DNSBypassCname)
+ }
+ if ds1.DNSBypassIP != ds2.DNSBypassIP {
+ t.Errorf("DNSBypassIP -- Expected %v, Got %v\n", ds1.DNSBypassIP, ds2.DNSBypassIP)
+ }
+ if ds1.DNSBypassIP6 != ds2.DNSBypassIP6 {
+ t.Errorf("DNSBypassIP6 -- Expected %v, Got %v\n", ds1.DNSBypassIP6, ds2.DNSBypassIP6)
+ }
+ if ds1.DNSBypassTTL != ds2.DNSBypassTTL {
+ t.Errorf("DNSBypassTTL -- Expected %v, Got %v\n", ds1.DNSBypassTTL, ds2.DNSBypassTTL)
+ }
+ if ds1.DSCP != ds2.DSCP {
+ t.Errorf("DSCP -- Expected %v, Got %v\n", ds1.DSCP, ds2.DSCP)
+ }
+ if ds1.DisplayName != ds2.DisplayName {
+ t.Errorf("DisplayName -- Expected %v, Got %v\n", ds1.DisplayName, ds2.DisplayName)
+ }
+ if ds1.EdgeHeaderRewrite != ds2.EdgeHeaderRewrite {
+ t.Errorf("EdgeHeaderRewrite -- Expected %v, Got %v\n", ds1.EdgeHeaderRewrite, ds2.EdgeHeaderRewrite)
+ }
+ if ds1.GeoLimit != ds2.GeoLimit {
+ t.Errorf("GeoLimit -- Expected %v, Got %v\n", ds1.GeoLimit, ds2.GeoLimit)
+ }
+ if ds1.GeoProvider != ds2.GeoProvider {
+ t.Errorf("GeoProvider -- Expected %v, Got %v\n", ds1.GeoProvider, ds2.GeoProvider)
+ }
+ if ds1.GlobalMaxMBPS != ds2.GlobalMaxMBPS {
+ t.Errorf("GlobalMaxMBPS -- Expected %v, Got %v\n", ds1.GlobalMaxMBPS, ds2.GlobalMaxMBPS)
+ }
+ if ds1.GlobalMaxTPS != ds2.GlobalMaxTPS {
+ t.Errorf("GlobalMaxTPS -- Expected %v, Got %v\n", ds1.GlobalMaxTPS, ds2.GlobalMaxTPS)
+ }
+ if ds1.HTTPBypassFQDN != ds2.HTTPBypassFQDN {
+ t.Errorf("HTTPBypassFQDN -- Expected %v, Got %v\n", ds1.HTTPBypassFQDN, ds2.HTTPBypassFQDN)
+ }
+ if ds1.ID > 0 && ds1.ID != ds2.ID {
+ t.Errorf("ID -- Expected %v, Got %v\n", ds1.ID, ds2.ID)
+ }
+ if ds1.IPV6RoutingEnabled != ds2.IPV6RoutingEnabled {
+ t.Errorf("IPv6RoutingEnabled -- Expected %v, Got %v\n", ds1.IPV6RoutingEnabled, ds2.IPV6RoutingEnabled)
+ }
+ if ds1.InfoURL != ds2.InfoURL {
+ t.Errorf("InfoURL -- Expected %v, Got %v\n", ds1.InfoURL, ds2.InfoURL)
+ }
+ if ds1.InitialDispersion != ds2.InitialDispersion {
+ t.Errorf("InitialDispersion -- Expected %v, Got %v\n", ds1.InitialDispersion, ds2.InitialDispersion)
+ }
+ if ds1.LastUpdated != ds2.LastUpdated {
+ t.Errorf("LastUpdated -- Expected %v, Got %v\n", ds1.LastUpdated, ds2.LastUpdated)
+ }
+ if ds1.LongDesc != ds2.LongDesc {
+ t.Errorf("LongDesc -- Expected %v, Got %v\n", ds1.LongDesc, ds2.LongDesc)
+ }
+ if ds1.LongDesc1 != ds2.LongDesc1 {
+ t.Errorf("LongDesc1 -- Expected %v, Got %v\n", ds1.LongDesc1, ds2.LongDesc1)
+ }
+ if ds1.LongDesc2 != ds2.LongDesc2 {
+ t.Errorf("LongDesc2 -- Expected %v, Got %v\n", ds1.LongDesc2, ds2.LongDesc2)
+ }
+ if ds1.MaxDNSAnswers != ds2.MaxDNSAnswers {
+ t.Errorf("MaxDNSAnswers-- Expected %v, Got %v\n", ds1.MaxDNSAnswers, ds2.MaxDNSAnswers)
+ }
+ if ds1.MidHeaderRewrite != ds2.MidHeaderRewrite {
+ t.Errorf("MidHeaderRewrite -- Expected %v, Got %v\n", ds1.MidHeaderRewrite, ds2.MidHeaderRewrite)
+ }
+ if ds1.MissLat != ds2.MissLat {
+ t.Errorf("MissLat -- Expected %v, Got %v\n", ds1.MissLat, ds2.MissLat)
+ }
+ if ds1.MissLong != ds2.MissLong {
+ t.Errorf("MissLong -- Expected %v, Got %v\n", ds1.MissLong, ds2.MissLong)
+ }
+ if ds1.MultiSiteOrigin != ds2.MultiSiteOrigin {
+ t.Errorf("MutiSiteOrigin -- Expected %v, Got %v\n", ds1.MultiSiteOrigin, ds2.MultiSiteOrigin)
+ }
+ if ds1.OrgServerFQDN != ds2.OrgServerFQDN {
+ t.Errorf("OrgServerFQDN -- Expected %v, Got %v\n", ds1.OrgServerFQDN, ds2.OrgServerFQDN)
+ }
+ if ds1.ProfileDesc != ds2.ProfileDesc {
+ t.Errorf("ProfileDesc -- Expected %v, Got %v\n", ds1.ProfileDesc, ds2.ProfileDesc)
+ }
+ if ds1.ProfileName != ds2.ProfileName {
+ t.Errorf("ProfileName -- Expected %v, Got %v\n", ds1.ProfileName, ds2.ProfileName)
+ }
+ if ds1.Protocol != ds2.Protocol {
+ t.Errorf("Protocol -- Expected %v, Got %v\n", ds1.Protocol, ds2.Protocol)
+ }
+ if ds1.QStringIgnore != ds2.QStringIgnore {
+ t.Errorf("QStringIgnore -- Expected %v, Got %v\n", ds1.QStringIgnore, ds2.QStringIgnore)
+ }
+ if ds1.RangeRequestHandling != ds2.RangeRequestHandling {
+ t.Errorf("RangeRequestHandling -- Expected %v, Got %v\n", ds1.RangeRequestHandling, ds2.RangeRequestHandling)
+ }
+ if ds1.RegexRemap != ds2.RegexRemap {
+ t.Errorf("RegexRemap -- Expected %v, Got %v\n", ds1.RegexRemap, ds2.RegexRemap)
+ }
+ if ds1.RemapText != ds2.RemapText {
+ t.Errorf("RemapText -- Expected %v, Got %v\n", ds1.RemapText, ds2.RemapText)
+ }
+ if ds1.Signed != ds2.Signed {
+ t.Errorf("Signed -- Expected %v, Got %v\n", ds1.Signed, ds2.Signed)
+ }
+ if ds1.TRResponseHeaders != ds2.TRResponseHeaders {
+ t.Errorf("TRResponseHeaders -- Expected %v, Got %v\n", ds1.TRResponseHeaders, ds2.TRResponseHeaders)
+ }
+ if ds1.Type != ds2.Type {
+ t.Errorf("Type -- Expected %v, Got %v\n", ds1.Type, ds2.Type)
+ }
+ if ds1.RegionalGeoBlocking != ds2.RegionalGeoBlocking {
+ t.Errorf("RegionalGeoBlocking -- Expected %v, Got %v\n", ds1.RegionalGeoBlocking, ds2.RegionalGeoBlocking)
+ }
+ if ds1.LogsEnabled != ds2.LogsEnabled {
+ t.Errorf("LogsEnabled -- Expected %v, Got %v\n", ds1.LogsEnabled, ds2.LogsEnabled)
+ }
+ if len(ds1.MatchList) > 0 {
+ for i, match := range ds1.MatchList {
+ if match != ds2.MatchList[i] {
+ t.Errorf("Matchlist -- Expected %v, Got %v\n", match, ds2.MatchList[i])
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3fa2b81e/traffic_ops/client/tests/integration/integration_helper.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/integration_helper.go b/traffic_ops/client/tests/integration/integration_helper.go
new file mode 100644
index 0000000..73f6370
--- /dev/null
+++ b/traffic_ops/client/tests/integration/integration_helper.go
@@ -0,0 +1,89 @@
+package integration
+
+import (
+ "bytes"
+ "flag"
+ "fmt"
+ "net/http"
+ "os"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+var (
+ to *traffic_ops.Session
+)
+
+func init() {
+ toURL := flag.String("toURL", "http://localhost:3000", "Traffic Ops URL")
+ toUser := flag.String("toUser", "admin", "Traffic Ops user")
+ toPass := flag.String("toPass", "password", "Traffic Ops password")
+ flag.Parse()
+ var loginErr error
+ to, loginErr = traffic_ops.Login(*toURL, *toUser, *toPass, true)
+ if loginErr != nil {
+ fmt.Printf("\nError logging in to %v: %v\nMake sure toURL, toUser, and toPass flags are included and correct.\nExample: go test -toUser=admin -toPass=pass -toURL=http://localhost:3000\n\n", *toURL, loginErr)
+ os.Exit(1)
+ }
+}
+
+//GetCdn returns a Cdn struct
+func GetCdn() (traffic_ops.CDN, error) {
+ cdns, err := to.CDNs()
+ if err != nil {
+ return *new(traffic_ops.CDN), err
+ }
+ cdn := cdns[0]
+ if cdn.Name == "ALL" {
+ cdn = cdns[1]
+ }
+ return cdn, nil
+}
+
+//GetProfile returns a Profile Struct
+func GetProfile() (traffic_ops.Profile, error) {
+ profiles, err := to.Profiles()
+ if err != nil {
+ return *new(traffic_ops.Profile), err
+ }
+ return profiles[0], nil
+}
+
+//Request sends a request to TO and returns a response.
+//This is basically a copy of the private "request" method in the traffic_ops.go \
+//but I didn't want to make that one public.
+func Request(to traffic_ops.Session, method, path string, body []byte) (*http.Response, error) {
+ url := fmt.Sprintf("%s%s", to.URL, path)
+
+ var req *http.Request
+ var err error
+
+ if body != nil && method != "GET" {
+ req, err = http.NewRequest(method, url, bytes.NewBuffer(body))
+ if err != nil {
+ return nil, err
+ }
+ req.Header.Set("Content-Type", "application/json")
+ } else {
+ req, err = http.NewRequest("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ resp, err := to.UserAgent.Do(req)
+ if err != nil {
+ return nil, err
+ }
+
+ if resp.StatusCode != http.StatusOK {
+ e := traffic_ops.HTTPError{
+ HTTPStatus: resp.Status,
+ HTTPStatusCode: resp.StatusCode,
+ URL: url,
+ }
+ return nil, &e
+ }
+
+ return resp, nil
+}
[25/50] incubator-trafficcontrol git commit: added user test
Posted by mi...@apache.org.
added user test
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f706d994
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f706d994
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f706d994
Branch: refs/heads/master
Commit: f706d994ee6e754879089a0746cf8b454e6d4341
Parents: 18efd3d
Author: David Neuman <da...@gmail.com>
Authored: Tue Dec 6 16:08:55 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
.../client/tests/integration/user_test.go | 52 ++++++++++++++++++++
traffic_ops/client/user.go | 3 +-
2 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f706d994/traffic_ops/client/tests/integration/user_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/user_test.go b/traffic_ops/client/tests/integration/user_test.go
new file mode 100644
index 0000000..b0f6ab7
--- /dev/null
+++ b/traffic_ops/client/tests/integration/user_test.go
@@ -0,0 +1,52 @@
+package integration
+
+import (
+ "encoding/json"
+ "fmt"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+func TestUsers(t *testing.T) {
+
+ uri := fmt.Sprintf("/api/1.2/users.json")
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiUserRes traffic_ops.UserResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiUserRes); err != nil {
+ t.Errorf("Could not decode user json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiUsers := apiUserRes.Response
+
+ clientUsers, err := to.Users()
+ if err != nil {
+ t.Errorf("Could not get users from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiUsers) != len(clientUsers) {
+ t.Errorf("Users Response Length -- expected %v, got %v\n", len(apiUsers), len(clientUsers))
+ }
+
+ for _, apiUser := range apiUsers {
+ match := false
+ for _, clientUser := range clientUsers {
+ if apiUser.ID == clientUser.ID {
+ match = true
+ if apiUser != clientUser {
+ t.Errorf("apiUser and clientUser do not match! Expected %+v, got %+v\n", apiUser, clientUser)
+ }
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a user matching %v\n", apiUser.Email)
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f706d994/traffic_ops/client/user.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/user.go b/traffic_ops/client/user.go
index 8f8cca2..3534c77 100644
--- a/traffic_ops/client/user.go
+++ b/traffic_ops/client/user.go
@@ -28,6 +28,7 @@ type User struct {
PublicSSHKey string `json:"publicSshKey,omitempty"`
Role int `json:"role,omitempty"`
RoleName string `json:"rolename,omitempty"`
+ ID int `json:"id,omitempty"`
UID int `json:"uid,omitempty"`
GID int `json:"gid,omitempty"`
Company string `json:"company,omitempty"`
@@ -47,7 +48,7 @@ func (to *Session) Users() ([]User, error) {
resp.Body.Close()
var data UserResponse
- if err := json.NewDecoder(resp.Body).Decode(&data.Response); err != nil {
+ if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
return nil, err
}
[18/50] incubator-trafficcontrol git commit: add test for
traffic_monitor_config
Posted by mi...@apache.org.
add test for traffic_monitor_config
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e47bbe1a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e47bbe1a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e47bbe1a
Branch: refs/heads/master
Commit: e47bbe1a2805631d1d989f1aa15440d3419fb304
Parents: 93df9fb
Author: David Neuman <da...@gmail.com>
Authored: Tue Dec 6 13:08:59 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
.../client/tests/integration/cachegroup_test.go | 2 +-
.../client/tests/integration/cdn_test.go | 2 +-
.../integration/traffic_monitor_config_test.go | 160 +++++++++++++++++++
3 files changed, 162 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e47bbe1a/traffic_ops/client/tests/integration/cachegroup_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/cachegroup_test.go b/traffic_ops/client/tests/integration/cachegroup_test.go
index fbf19a5..4bff049 100644
--- a/traffic_ops/client/tests/integration/cachegroup_test.go
+++ b/traffic_ops/client/tests/integration/cachegroup_test.go
@@ -31,8 +31,8 @@ func TestCachegroups(t *testing.T) {
t.Errorf("Array lengths from client and API are different...API = %d, Client = %d\n", len(apiCgs), len(clientCgs))
}
- matchFound := false
for _, apiCg := range apiCgs {
+ matchFound := false
for _, clientCg := range clientCgs {
if clientCg.Name != apiCg.Name {
continue
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e47bbe1a/traffic_ops/client/tests/integration/cdn_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/cdn_test.go b/traffic_ops/client/tests/integration/cdn_test.go
index 04ad768..62d8cd2 100644
--- a/traffic_ops/client/tests/integration/cdn_test.go
+++ b/traffic_ops/client/tests/integration/cdn_test.go
@@ -32,8 +32,8 @@ func TestCDNs(t *testing.T) {
t.Errorf("Array lengths from client and API are different...API = %s, Client = %s\n", apiCDNs, clientCDNs)
}
- matchFound := false
for _, apiCDN := range apiCDNs {
+ matchFound := false
for _, clientCDN := range clientCDNs {
if clientCDN.Name != apiCDN.Name {
continue
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e47bbe1a/traffic_ops/client/tests/integration/traffic_monitor_config_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/traffic_monitor_config_test.go b/traffic_ops/client/tests/integration/traffic_monitor_config_test.go
new file mode 100644
index 0000000..341e53a
--- /dev/null
+++ b/traffic_ops/client/tests/integration/traffic_monitor_config_test.go
@@ -0,0 +1,160 @@
+package integration
+
+import (
+ "encoding/json"
+ "fmt"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+func TestTrafficMonitorConfig(t *testing.T) {
+ cdn, err := GetCdn()
+ if err != nil {
+ t.Errorf("Could not get CDN, error was: %v\n", err)
+ }
+ uri := fmt.Sprintf("/api/1.2/cdns/%s/configs/monitoring.json", cdn.Name)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiTMConfigRes traffic_ops.TMConfigResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiTMConfigRes); err != nil {
+ t.Errorf("Could not decode Traffic Monitor Config response. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiTMConfig := apiTMConfigRes.Response
+
+ clientTMConfig, err := to.TrafficMonitorConfig(cdn.Name)
+ if err != nil {
+ t.Errorf("Could not get Traffic Monitor Config from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiTMConfig.CacheGroups) != len(clientTMConfig.CacheGroups) {
+ t.Errorf("Length of Traffic Monitor config cachegroups do not match! Expected %v, got %v\n", len(apiTMConfig.CacheGroups), len(clientTMConfig.CacheGroups))
+ }
+
+ for _, apiCg := range apiTMConfig.CacheGroups {
+ match := false
+ for _, clientCg := range clientTMConfig.CacheGroups {
+ if apiCg == clientCg {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a cachegroup matching %+v\n", apiCg)
+ }
+ }
+
+ if len(apiTMConfig.DeliveryServices) != len(clientTMConfig.DeliveryServices) {
+ t.Errorf("Length of Traffic Monitor config deliveryserivces do not match! Expected %v, got %v\n", len(apiTMConfig.DeliveryServices), len(clientTMConfig.DeliveryServices))
+ }
+
+ for _, apiDs := range apiTMConfig.DeliveryServices {
+ match := false
+ for _, clientDs := range clientTMConfig.DeliveryServices {
+ if apiDs == clientDs {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a Deliveryservice matching %+v\n", apiDs)
+ }
+ }
+
+ if len(apiTMConfig.Profiles) != len(clientTMConfig.Profiles) {
+ t.Errorf("Length of Traffic Monitor config profiles do not match! Expected %v, got %v\n", len(apiTMConfig.Profiles), len(clientTMConfig.Profiles))
+ }
+
+ for _, apiProfile := range apiTMConfig.Profiles {
+ match := false
+ for _, clientProfile := range clientTMConfig.Profiles {
+ if apiProfile == clientProfile {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a Profile matching %+v\n", apiProfile)
+ }
+ }
+
+ if len(apiTMConfig.TrafficMonitors) != len(clientTMConfig.TrafficMonitors) {
+ t.Errorf("Length of Traffic Monitor config traffic monitors does not match! Expected %v, got %v\n", len(apiTMConfig.TrafficMonitors), len(clientTMConfig.TrafficMonitors))
+ }
+
+ for _, apiTM := range apiTMConfig.TrafficMonitors {
+ match := false
+ for _, clientTM := range clientTMConfig.TrafficMonitors {
+ if apiTM == clientTM {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a Traffic Monitor matching %+v\n", apiTM)
+ }
+ }
+
+ if len(apiTMConfig.TrafficServers) != len(clientTMConfig.TrafficServers) {
+ t.Errorf("Length of Traffic Monitor config traffic servers does not match! Expected %v, got %v\n", len(apiTMConfig.TrafficServers), len(clientTMConfig.TrafficServers))
+ }
+
+ for _, apiTS := range apiTMConfig.TrafficServers {
+ match := false
+ for _, clientTS := range clientTMConfig.TrafficServers {
+ if apiTS.HostName == clientTS.HostName {
+ match = true
+ if apiTS.CacheGroup != clientTS.CacheGroup {
+ t.Errorf("Cachegroup -- Expected %v, got %v\n", apiTS.CacheGroup, clientTS.CacheGroup)
+ }
+ if len(apiTS.DeliveryServices) != len(clientTS.DeliveryServices) {
+ t.Errorf("len DeliveryServices -- Expected %v, got %v\n", len(apiTS.DeliveryServices), len(clientTS.DeliveryServices))
+ }
+ for _, apiDS := range apiTS.DeliveryServices {
+ dsMatch := false
+ for _, clientDS := range clientTS.DeliveryServices {
+ if apiDS.Xmlid == clientDS.Xmlid && len(apiDS.Remaps) == len(clientDS.Remaps) {
+ dsMatch = true
+ }
+ }
+ if !dsMatch {
+ t.Errorf("Could not finding a matching DS for %v\n", apiDS.Xmlid)
+ }
+ }
+ if apiTS.FQDN != clientTS.FQDN {
+ t.Errorf("FQDN -- Expected %v, got %v\n", apiTS.FQDN, clientTS.FQDN)
+ }
+ if apiTS.HashID != clientTS.HashID {
+ t.Errorf("HashID -- Expected %v, got %v\n", apiTS.HashID, clientTS.HashID)
+ }
+ if apiTS.IP != clientTS.IP {
+ t.Errorf("IP -- Expected %v, got %v\n", apiTS.IP, clientTS.IP)
+ }
+ if apiTS.IP6 != clientTS.IP6 {
+ t.Errorf("IP6 -- Expected %v, got %v\n", apiTS.IP6, clientTS.IP6)
+ }
+ if apiTS.InterfaceName != clientTS.InterfaceName {
+ t.Errorf("Interface Name -- Expected %v, got %v\n", apiTS.InterfaceName, clientTS.InterfaceName)
+ }
+ if apiTS.Port != clientTS.Port {
+ t.Errorf("Port -- Expected %v, got %v\n", apiTS.Port, clientTS.Port)
+ }
+ if apiTS.Profile != clientTS.Profile {
+ t.Errorf("Profile -- Expected %v, got %v\n", apiTS.Profile, clientTS.Profile)
+ }
+ if apiTS.Status != clientTS.Status {
+ t.Errorf("Status -- Expected %v, got %v\n", apiTS.Status, clientTS.Status)
+ }
+ if apiTS.Type != clientTS.Type {
+ t.Errorf("Type -- Expected %v, got %v\n", apiTS.Type, clientTS.Type)
+ }
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a Traffic Server matching %+v\n", apiTS)
+ }
+ }
+}
[32/50] incubator-trafficcontrol git commit: add HardwareTest
Posted by mi...@apache.org.
add HardwareTest
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/105e1a4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/105e1a4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/105e1a4c
Branch: refs/heads/master
Commit: 105e1a4ca038a6522c8da2b01dcc37d0841524c9
Parents: 580c4c8
Author: David Neuman <da...@gmail.com>
Authored: Fri Dec 2 15:01:05 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/delivery_service_resources.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/105e1a4c/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service_resources.go b/traffic_ops/client/delivery_service_resources.go
index be6667e..26d64d8 100644
--- a/traffic_ops/client/delivery_service_resources.go
+++ b/traffic_ops/client/delivery_service_resources.go
@@ -190,7 +190,7 @@ type DeliveryServiceServerResponse struct {
Response []DeliveryServiceServer `json:"response"`
Size int `json:"size"`
OrderBy string `json:"orderby"`
- Limit string `json:"limit"`
+ Limit int `json:"limit"`
}
// DeliveryServiceServer ...
[02/50] incubator-trafficcontrol git commit: add Parameter test
Posted by mi...@apache.org.
add Parameter test
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/4eaa1a74
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/4eaa1a74
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/4eaa1a74
Branch: refs/heads/master
Commit: 4eaa1a7417c5d808ef65d7d0b4bf5ffc163049b3
Parents: 9ca4361
Author: David Neuman <da...@gmail.com>
Authored: Fri Dec 2 15:01:20 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
.../client/tests/integration/parameter_test.go | 54 ++++++++++++++++++++
1 file changed, 54 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4eaa1a74/traffic_ops/client/tests/integration/parameter_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/parameter_test.go b/traffic_ops/client/tests/integration/parameter_test.go
new file mode 100644
index 0000000..0f57045
--- /dev/null
+++ b/traffic_ops/client/tests/integration/parameter_test.go
@@ -0,0 +1,54 @@
+package integration
+
+import (
+ // "encoding/json"
+ "encoding/json"
+ "fmt"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+func TestParameters(t *testing.T) {
+ profile, err := GetProfile()
+ if err != nil {
+ t.Errorf("Could not get a profile, error was: %v\n", err)
+ }
+
+ uri := fmt.Sprintf("/api/1.2/parameters/profile/%s.json", profile.Name)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiParamRes traffic_ops.ParamResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiParamRes); err != nil {
+ t.Errorf("Could not decode parameter json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiParams := apiParamRes.Response
+
+ clientParams, err := to.Parameters(profile.Name)
+ if err != nil {
+ t.Errorf("Could not get Hardware from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiParams) != len(clientParams) {
+ t.Errorf("Params Response Length -- expected %v, got %v\n", len(apiParams), len(clientParams))
+ }
+
+ for _, apiParam := range apiParams {
+ match := false
+ for _, clientParam := range clientParams {
+ if apiParam.Name == clientParam.Name && apiParam.Value == clientParam.Value && apiParam.ConfigFile == clientParam.ConfigFile {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a param matching %+v from the client\n", apiParam)
+ }
+ }
+}
[03/50] incubator-trafficcontrol git commit: add Apache license to
pg-migration files
Posted by mi...@apache.org.
add Apache license to pg-migration files
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/5b40c9a3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/5b40c9a3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/5b40c9a3
Branch: refs/heads/master
Commit: 5b40c9a34e3a274d48d37e418fca13179e5648cc
Parents: ce61680
Author: Dan Kirkwood <da...@gmail.com>
Authored: Tue Dec 6 05:29:27 2016 +0000
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/pg-migration/Dockerfile-convert | 13 +++++++++++++
traffic_ops/app/db/pg-migration/Dockerfile-pgloader | 13 +++++++++++++
traffic_ops/app/db/pg-migration/Dockerfile-postgres | 13 +++++++++++++
.../app/db/pg-migration/Dockerfile-traffic_ops-client | 13 +++++++++++++
traffic_ops/app/db/pg-migration/docker-compose.yml | 13 +++++++++++++
traffic_ops/app/db/pg-migration/get-to-data.sh | 13 +++++++++++++
traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf | 13 +++++++++++++
traffic_ops/app/db/pg-migration/runconvert.sh | 13 +++++++++++++
traffic_ops/app/db/pg-migration/runpgloader.sh | 13 +++++++++++++
9 files changed, 117 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b40c9a3/traffic_ops/app/db/pg-migration/Dockerfile-convert
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-convert b/traffic_ops/app/db/pg-migration/Dockerfile-convert
index b1a7dd5..f10624f 100644
--- a/traffic_ops/app/db/pg-migration/Dockerfile-convert
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-convert
@@ -1,3 +1,16 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
FROM postgres:9.6
MAINTAINER Dan Kirkwood
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b40c9a3/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-pgloader b/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
index 5acc979..bb44384 100644
--- a/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
@@ -1,3 +1,16 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
FROM dimitri/pgloader
MAINTAINER Dan Kirkwood <da...@apache.org>
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b40c9a3/traffic_ops/app/db/pg-migration/Dockerfile-postgres
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-postgres b/traffic_ops/app/db/pg-migration/Dockerfile-postgres
index e5dcb30..54a3184 100644
--- a/traffic_ops/app/db/pg-migration/Dockerfile-postgres
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-postgres
@@ -1,3 +1,16 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
FROM postgres:9.6
MAINTAINER Dan Kirkwood
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b40c9a3/traffic_ops/app/db/pg-migration/Dockerfile-traffic_ops-client
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-traffic_ops-client b/traffic_ops/app/db/pg-migration/Dockerfile-traffic_ops-client
index f8a6018..ebef652 100644
--- a/traffic_ops/app/db/pg-migration/Dockerfile-traffic_ops-client
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-traffic_ops-client
@@ -1,3 +1,16 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
FROM debian
MAINTAINER Dan Kirkwood <da...@apache.org>
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b40c9a3/traffic_ops/app/db/pg-migration/docker-compose.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/docker-compose.yml b/traffic_ops/app/db/pg-migration/docker-compose.yml
index 74b5bd8..ce7c8b3 100644
--- a/traffic_ops/app/db/pg-migration/docker-compose.yml
+++ b/traffic_ops/app/db/pg-migration/docker-compose.yml
@@ -1,3 +1,16 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
version: '2'
volumes:
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b40c9a3/traffic_ops/app/db/pg-migration/get-to-data.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/get-to-data.sh b/traffic_ops/app/db/pg-migration/get-to-data.sh
index a4676fe..ea998f0 100755
--- a/traffic_ops/app/db/pg-migration/get-to-data.sh
+++ b/traffic_ops/app/db/pg-migration/get-to-data.sh
@@ -1,3 +1,16 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
#!/bin/bash -x
output=$1
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b40c9a3/traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf b/traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf
index 18dc029..c2c94fe 100644
--- a/traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf
+++ b/traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf
@@ -1,3 +1,16 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
# This is custom config file attached from docker host
[mysql]
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b40c9a3/traffic_ops/app/db/pg-migration/runconvert.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runconvert.sh b/traffic_ops/app/db/pg-migration/runconvert.sh
index 6b27f97..1e7cced 100755
--- a/traffic_ops/app/db/pg-migration/runconvert.sh
+++ b/traffic_ops/app/db/pg-migration/runconvert.sh
@@ -1,3 +1,16 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
#!/bin/bash -x
set -x
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5b40c9a3/traffic_ops/app/db/pg-migration/runpgloader.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runpgloader.sh b/traffic_ops/app/db/pg-migration/runpgloader.sh
index cbbf8e3..819ee67 100755
--- a/traffic_ops/app/db/pg-migration/runpgloader.sh
+++ b/traffic_ops/app/db/pg-migration/runpgloader.sh
@@ -1,3 +1,16 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
#!/bin/bash -x
# make sure postgres and mysql ports are both active
[48/50] incubator-trafficcontrol git commit: fixes fixture ids (makes
them high so they don't clash with creates done directly to the api) and
fixes some broken tests
Posted by mi...@apache.org.
fixes fixture ids (makes them high so they don't clash with creates done directly to the api) and fixes some broken tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/496bcab5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/496bcab5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/496bcab5
Branch: refs/heads/master
Commit: 496bcab5068aef26280c5f90993042be0c9df853
Parents: 5fe789b
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Jan 9 15:28:21 2017 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Mon Jan 9 15:40:24 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/lib/Fixtures/Asn.pm | 8 +--
traffic_ops/app/lib/Fixtures/Cachegroup.pm | 12 ++--
.../app/lib/Fixtures/CachegroupParameter.pm | 8 +--
traffic_ops/app/lib/Fixtures/Cdn.pm | 4 +-
traffic_ops/app/lib/Fixtures/Deliveryservice.pm | 26 ++++----
traffic_ops/app/lib/Fixtures/Division.pm | 2 +-
traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm | 6 +-
traffic_ops/app/lib/Fixtures/PhysLocation.pm | 6 +-
traffic_ops/app/lib/Fixtures/Region.pm | 8 +--
traffic_ops/app/lib/Fixtures/Server.pm | 60 +++++++++---------
traffic_ops/app/lib/Fixtures/Staticdnsentry.pm | 6 +-
traffic_ops/app/t/api/1.1/asn.t | 12 ++--
traffic_ops/app/t/api/1.2/asn.t | 22 +++----
traffic_ops/app/t/api/1.2/cdn.t | 10 ++-
.../app/t/api/1.2/deliveryservice_server.t | 16 ++---
traffic_ops/app/t/api/1.2/division.t | 13 ++--
traffic_ops/app/t/api/1.2/physlocation.t | 8 +--
traffic_ops/app/t/api/1.2/region.t | 20 +++---
traffic_ops/app/t/api/1.2/server.t | 66 +++++++-------------
traffic_ops/app/t/deliveryservice.t | 8 +--
traffic_ops/app/t/phys_location.t | 6 +-
traffic_ops/app/t/server.t | 8 +--
22 files changed, 155 insertions(+), 180 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/Asn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Asn.pm b/traffic_ops/app/lib/Fixtures/Asn.pm
index b2f5e07..e274cf4 100644
--- a/traffic_ops/app/lib/Fixtures/Asn.pm
+++ b/traffic_ops/app/lib/Fixtures/Asn.pm
@@ -22,17 +22,17 @@ my %definition_for = (
test_cran_1 => {
new => 'Asn',
using => {
- id => 1,
+ id => 100,
asn => 9939,
- cachegroup => 1,
+ cachegroup => 100,
},
},
test_cran_2 => {
new => 'Asn',
using => {
- id => 2,
+ id => 200,
asn => 9940,
- cachegroup => 2,
+ cachegroup => 200,
},
},
);
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/Cachegroup.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Cachegroup.pm b/traffic_ops/app/lib/Fixtures/Cachegroup.pm
index ad0e919..8592c56 100644
--- a/traffic_ops/app/lib/Fixtures/Cachegroup.pm
+++ b/traffic_ops/app/lib/Fixtures/Cachegroup.pm
@@ -21,7 +21,7 @@ my %definition_for = (
mid_northeast => {
new => 'Cachegroup',
using => {
- id => 1,
+ id => 100,
name => 'mid-northeast-group',
short_name => 'ne',
type => 2,
@@ -33,19 +33,19 @@ my %definition_for = (
mid_northwest => {
new => 'Cachegroup',
using => {
- id => 2,
+ id => 200,
name => 'mid-northwest-group',
short_name => 'nw',
type => 2,
latitude => 100,
longitude => 100,
- parent_cachegroup_id => 1,
+ parent_cachegroup_id => 100,
},
},
mid_cg3 => {
new => 'Cachegroup',
using => {
- id => 8,
+ id => 800,
name => 'mid_cg3',
short_name => 'mid_cg3',
type => 6,
@@ -57,13 +57,13 @@ my %definition_for = (
edge_cg4 => {
new => 'Cachegroup',
using => {
- id => 9,
+ id => 900,
name => 'edge_cg4',
short_name => 'edge_cg4',
type => 5,
latitude => 100,
longitude => 100,
- parent_cachegroup_id => 8,
+ parent_cachegroup_id => 800,
},
},
);
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/CachegroupParameter.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/CachegroupParameter.pm b/traffic_ops/app/lib/Fixtures/CachegroupParameter.pm
index 3db65d0..3e01378 100644
--- a/traffic_ops/app/lib/Fixtures/CachegroupParameter.pm
+++ b/traffic_ops/app/lib/Fixtures/CachegroupParameter.pm
@@ -21,28 +21,28 @@ my %definition_for = (
cachegroupparameter1 => {
new => 'CachegroupParameter',
using => {
- cachegroup => 1,
+ cachegroup => 100,
parameter => 60,
},
},
cachegroupparameter2 => {
new => 'CachegroupParameter',
using => {
- cachegroup => 1,
+ cachegroup => 100,
parameter => 61,
},
},
cachegroupparameter3 => {
new => 'CachegroupParameter',
using => {
- cachegroup => 2,
+ cachegroup => 200,
parameter => 60,
},
},
cachegroupparameter4 => {
new => 'CachegroupParameter',
using => {
- cachegroup => 2,
+ cachegroup => 200,
parameter => 61,
},
},
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/Cdn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Cdn.pm b/traffic_ops/app/lib/Fixtures/Cdn.pm
index dacb604..4ca30b4 100644
--- a/traffic_ops/app/lib/Fixtures/Cdn.pm
+++ b/traffic_ops/app/lib/Fixtures/Cdn.pm
@@ -23,7 +23,7 @@ my %definition_for = (
cdn1_cdn_name => {
new => 'Cdn',
using => {
- id => 1,
+ id => 100,
name => 'cdn1',
},
},
@@ -31,7 +31,7 @@ my %definition_for = (
cdn2_cdn_name => {
new => 'Cdn',
using => {
- id => 2,
+ id => 200,
name => 'cdn2',
},
},
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm
index 290c211..28953d0 100644
--- a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm
+++ b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm
@@ -48,7 +48,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 21,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
ipv6_routing_enabled => 1,
protocol => 1,
display_name => 'test-ds1-displayname',
@@ -86,7 +86,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 9,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
display_name => 'test-ds2-displayname',
initial_dispersion => 1,
geo_provider => 0,
@@ -124,7 +124,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 9,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
display_name => 'test-ds3-displayname',
initial_dispersion => 1,
geo_provider => 0,
@@ -162,7 +162,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 9,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
display_name => 'test-ds4-displayname',
initial_dispersion => 1,
geo_provider => 0,
@@ -200,7 +200,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 7,
profile => 300,
- cdn_id => 1,
+ cdn_id => 100,
display_name => 'test-ds5-displayname',
initial_dispersion => 1,
geo_provider => 0,
@@ -238,7 +238,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 9,
profile => 300,
- cdn_id => 1,
+ cdn_id => 100,
display_name => 'test-ds6-displayname',
initial_dispersion => 1,
geo_provider => 0,
@@ -275,7 +275,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 21,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
ipv6_routing_enabled => 1,
protocol => 1,
display_name => 'steering-ds1-displayname',
@@ -311,7 +311,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 21,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
ipv6_routing_enabled => 1,
protocol => 1,
display_name => 'steering-ds2-displayname',
@@ -347,7 +347,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 21,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
ipv6_routing_enabled => 1,
protocol => 1,
display_name => 'new-steering-ds-displayname',
@@ -383,7 +383,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 21,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
ipv6_routing_enabled => 1,
protocol => 1,
display_name => 'target-ds1-displayname',
@@ -419,7 +419,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 21,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
ipv6_routing_enabled => 1,
protocol => 1,
display_name => 'target-ds2-displayname',
@@ -455,7 +455,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 21,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
ipv6_routing_enabled => 1,
protocol => 1,
display_name => 'target-ds3-displayname',
@@ -491,7 +491,7 @@ my %definition_for = (
check_path => '/crossdomain.xml',
type => 21,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
ipv6_routing_enabled => 1,
protocol => 1,
display_name => 'target-ds4-displayname',
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/Division.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Division.pm b/traffic_ops/app/lib/Fixtures/Division.pm
index 5a1f8d5..6e35f7f 100644
--- a/traffic_ops/app/lib/Fixtures/Division.pm
+++ b/traffic_ops/app/lib/Fixtures/Division.pm
@@ -22,7 +22,7 @@ my %definition_for = (
mountain => {
new => 'Division',
using => {
- id => 1,
+ id => 100,
name => 'mountain',
},
},
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm b/traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm
index 371c015..dc7ef00 100644
--- a/traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm
+++ b/traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm
@@ -21,14 +21,14 @@ my %definition_for = (
edge_atl => {
new => 'Cachegroup',
using => {
- id => 3,
+ id => 300,
name => 'edge_atl_group',
short_name => 'atl',
type => 5,
latitude => 120,
longitude => 120,
- parent_cachegroup_id => 1,
- secondary_parent_cachegroup_id => 2,
+ parent_cachegroup_id => 100,
+ secondary_parent_cachegroup_id => 200,
},
},
);
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/PhysLocation.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/PhysLocation.pm b/traffic_ops/app/lib/Fixtures/PhysLocation.pm
index 914c9e4..c823185 100644
--- a/traffic_ops/app/lib/Fixtures/PhysLocation.pm
+++ b/traffic_ops/app/lib/Fixtures/PhysLocation.pm
@@ -32,7 +32,7 @@ my %definition_for = (
phone => '303-111-1111',
email => undef,
comments => undef,
- region => 1,
+ region => 100,
},
},
boulder => {
@@ -49,7 +49,7 @@ my %definition_for = (
phone => '303-222-2222',
email => undef,
comments => undef,
- region => 1,
+ region => 100,
},
},
atlanta => {
@@ -66,7 +66,7 @@ my %definition_for = (
phone => '404-222-2222',
email => undef,
comments => undef,
- region => 1,
+ region => 100,
},
},
);
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/Region.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Region.pm b/traffic_ops/app/lib/Fixtures/Region.pm
index cecf71c..85a6523 100644
--- a/traffic_ops/app/lib/Fixtures/Region.pm
+++ b/traffic_ops/app/lib/Fixtures/Region.pm
@@ -21,17 +21,17 @@ my %definition_for = (
mile_high => {
new => 'Region',
using => {
- id => 1,
+ id => 100,
name => 'Denver Region',
- division => 1,
+ division => 100,
},
},
boulder => {
new => 'Region',
using => {
- id => 2,
+ id => 200,
name => 'Boulder Region',
- division => 1,
+ division => 100,
},
},
);
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/Server.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Server.pm b/traffic_ops/app/lib/Fixtures/Server.pm
index cf0e5d5..a52ae69 100644
--- a/traffic_ops/app/lib/Fixtures/Server.pm
+++ b/traffic_ops/app/lib/Fixtures/Server.pm
@@ -48,8 +48,8 @@ my %definition_for = (
type => 1,
status => 2,
profile => 100,
- cdn_id => 1,
- cachegroup => 3,
+ cdn_id => 100,
+ cachegroup => 300,
phys_location => 100,
},
},
@@ -83,8 +83,8 @@ my %definition_for = (
type => 2,
status => 2,
profile => 200,
- cdn_id => 1,
- cachegroup => 1,
+ cdn_id => 100,
+ cachegroup => 100,
phys_location => 100,
},
},
@@ -118,8 +118,8 @@ my %definition_for = (
type => 4,
status => 2,
profile => 300,
- cdn_id => 2,
- cachegroup => 1,
+ cdn_id => 200,
+ cachegroup => 100,
phys_location => 100,
},
},
@@ -153,8 +153,8 @@ my %definition_for = (
type => 31,
status => 2,
profile => 500,
- cdn_id => 1,
- cachegroup => 1,
+ cdn_id => 100,
+ cachegroup => 100,
phys_location => 100,
},
},
@@ -188,8 +188,8 @@ my %definition_for = (
type => 4,
status => 2,
profile => 300,
- cdn_id => 2,
- cachegroup => 1,
+ cdn_id => 200,
+ cachegroup => 100,
phys_location => 100,
},
},
@@ -223,8 +223,8 @@ my %definition_for = (
type => 1,
status => 2,
profile => 100,
- cdn_id => 1,
- cachegroup => 3,
+ cdn_id => 100,
+ cachegroup => 300,
phys_location => 100,
},
},
@@ -258,8 +258,8 @@ my %definition_for = (
type => 2,
status => 2,
profile => 200,
- cdn_id => 2,
- cachegroup => 2,
+ cdn_id => 200,
+ cachegroup => 200,
phys_location => 200,
},
},
@@ -293,8 +293,8 @@ my %definition_for = (
type => 31,
status => 2,
profile => 500,
- cdn_id => 1,
- cachegroup => 1,
+ cdn_id => 100,
+ cachegroup => 100,
phys_location => 200,
},
},
@@ -328,8 +328,8 @@ my %definition_for = (
type => 32,
status => 2,
profile => 500,
- cdn_id => 1,
- cachegroup => 1,
+ cdn_id => 100,
+ cachegroup => 100,
phys_location => 300,
},
},
@@ -363,8 +363,8 @@ my %definition_for = (
type => 32,
status => 2,
profile => 500,
- cdn_id => 1,
- cachegroup => 1,
+ cdn_id => 100,
+ cachegroup => 100,
phys_location => 300,
},
},
@@ -398,8 +398,8 @@ my %definition_for = (
type => 4,
status => 2,
profile => 100,
- cdn_id => 1,
- cachegroup => 3,
+ cdn_id => 100,
+ cachegroup => 300,
phys_location => 100,
},
},
@@ -433,8 +433,8 @@ my %definition_for = (
type => 1,
status => 3,
profile => 100,
- cdn_id => 1,
- cachegroup => 3,
+ cdn_id => 100,
+ cachegroup => 300,
phys_location => 100,
},
},
@@ -468,8 +468,8 @@ my %definition_for = (
type => 1,
status => 2,
profile => 100,
- cdn_id => 1,
- cachegroup => 9,
+ cdn_id => 100,
+ cachegroup => 900,
phys_location => 100,
},
},
@@ -503,8 +503,8 @@ my %definition_for = (
type => 1,
status => 2,
profile => 100,
- cdn_id => 1,
- cachegroup => 9,
+ cdn_id => 100,
+ cachegroup => 900,
phys_location => 100,
},
},
@@ -538,8 +538,8 @@ my %definition_for = (
type => 2,
status => 2,
profile => 100,
- cdn_id => 1,
- cachegroup => 8,
+ cdn_id => 100,
+ cachegroup => 800,
phys_location => 100,
},
},
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm b/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm
index 8da2a8e..41342f5 100644
--- a/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm
+++ b/traffic_ops/app/lib/Fixtures/Staticdnsentry.pm
@@ -26,7 +26,7 @@ my %definition_for = (
address => '127.0.0.1',
type => 21,
deliveryservice => 100,
- cachegroup => 1,
+ cachegroup => 100,
},
},
aaaa_record_host => {
@@ -36,7 +36,7 @@ my %definition_for = (
host => 'AAAA_RECORD_HOST',
address => '127.0.0.1',
deliveryservice => 100,
- cachegroup => 1,
+ cachegroup => 100,
type => 22,
},
},
@@ -48,7 +48,7 @@ my %definition_for = (
address => '127.0.0.1',
deliveryservice => 200,
type => 23,
- cachegroup => 2,
+ cachegroup => 200,
},
},
);
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/api/1.1/asn.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.1/asn.t b/traffic_ops/app/t/api/1.1/asn.t
index 824592c..be1a008 100644
--- a/traffic_ops/app/t/api/1.1/asn.t
+++ b/traffic_ops/app/t/api/1.1/asn.t
@@ -40,15 +40,15 @@ Test::TestHelper->load_core_data($schema);
ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302)
->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.1/asns.json")->status_is(200)->json_is( "/response/asns/0/id", "1" )->json_is( "/response/asns/0/cachegroup", "mid-northeast-group" )
- ->json_is( "/response/asns/0/asn", "9939" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
+$t->get_ok("/api/1.1/asns.json")->status_is(200)->json_is( "/response/asns/0/id", 100 )->json_is( "/response/asns/0/cachegroup", "mid-northeast-group" )
+ ->json_is( "/response/asns/0/asn", 9939 )->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.1/asns.json?orderby=id")->status_is(200)->json_is( "/response/asns/0/id", "1" )
- ->json_is( "/response/asns/0/cachegroup", "mid-northeast-group" )->json_is( "/response/asns/0/asn", "9939" )
+$t->get_ok("/api/1.1/asns.json?orderby=id")->status_is(200)->json_is( "/response/asns/0/id", 100 )
+ ->json_is( "/response/asns/0/cachegroup", "mid-northeast-group" )->json_is( "/response/asns/0/asn", 9939 )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.1/asns.json?orderby=cachegroup")->status_is(200)->json_is( "/response/asns/0/id", "1" )
- ->json_is( "/response/asns/0/cachegroup", "mid-northeast-group" )->json_is( "/response/asns/0/asn", "9939" )
+$t->get_ok("/api/1.1/asns.json?orderby=cachegroup")->status_is(200)->json_is( "/response/asns/0/id", 100 )
+ ->json_is( "/response/asns/0/cachegroup", "mid-northeast-group" )->json_is( "/response/asns/0/asn", 9939 )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } );
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/api/1.2/asn.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/asn.t b/traffic_ops/app/t/api/1.2/asn.t
index 8659d67..0ed6f1c 100644
--- a/traffic_ops/app/t/api/1.2/asn.t
+++ b/traffic_ops/app/t/api/1.2/asn.t
@@ -40,28 +40,28 @@ Test::TestHelper->load_core_data($schema);
ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302)
->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.2/asns")->status_is(200)->json_is( "/response/0/id", 1 )->json_is( "/response/0/cachegroup", "mid-northeast-group" )
- ->json_is( "/response/0/asn", "9939" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
+$t->get_ok("/api/1.2/asns")->status_is(200)->json_is( "/response/0/id", 100 )->json_is( "/response/0/cachegroup", "mid-northeast-group" )
+ ->json_is( "/response/0/asn", 9939 )->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.2/asns?orderby=id")->status_is(200)->json_is( "/response/0/id", "1" )
- ->json_is( "/response/0/cachegroup", "mid-northeast-group" )->json_is( "/response/0/asn", "9939" )
+$t->get_ok("/api/1.2/asns?orderby=id")->status_is(200)->json_is( "/response/0/id", 100 )
+ ->json_is( "/response/0/cachegroup", "mid-northeast-group" )->json_is( "/response/0/asn", 9939 )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.2/asns?orderby=cachegroup")->status_is(200)->json_is( "/response/0/id", "1" )
- ->json_is( "/response/0/cachegroup", "mid-northeast-group" )->json_is( "/response/0/asn", "9939" )
+$t->get_ok("/api/1.2/asns?orderby=cachegroup")->status_is(200)->json_is( "/response/0/id", 100 )
+ ->json_is( "/response/0/cachegroup", "mid-northeast-group" )->json_is( "/response/0/asn", 9939 )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.2/asns/2")->status_is(200)->json_is( "/response/0/id", "2" )
- ->json_is( "/response/0/cachegroup", "mid-northwest-group" )->json_is( "/response/0/asn", "9940" )
+$t->get_ok("/api/1.2/asns/200")->status_is(200)->json_is( "/response/0/id", 200 )
+ ->json_is( "/response/0/cachegroup", "mid-northwest-group" )->json_is( "/response/0/asn", 9940 )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
ok $t->post_ok('/api/1.2/asns' => {Accept => 'application/json'} => json => {
"asn" => 852,
- "cachegroupId" => 1
+ "cachegroupId" => 100
})
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/asn" => 852 )
- ->json_is( "/response/cachegroupId" => 1 )
+ ->json_is( "/response/cachegroupId" => 100 )
->json_is( "/response/cachegroup" => "mid-northeast-group" )
->json_is( "/alerts/0/level" => "success" )
->json_is( "/alerts/0/text" => "ASN create was successful." )
@@ -71,7 +71,7 @@ my $asn_id = &get_asn_id(852);
ok $t->put_ok('/api/1.2/asns/' . $asn_id => {Accept => 'application/json'} => json => {
"asn" => 853,
- "cachegroupId" => 1
+ "cachegroupId" => 100
})
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/asn" => 853 )
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/api/1.2/cdn.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/cdn.t b/traffic_ops/app/t/api/1.2/cdn.t
index aed0845..6327a5e 100644
--- a/traffic_ops/app/t/api/1.2/cdn.t
+++ b/traffic_ops/app/t/api/1.2/cdn.t
@@ -29,17 +29,21 @@ use Test::TestHelper;
BEGIN { $ENV{MOJO_MODE} = "test" }
my $schema = Schema->connect_to_database;
-my $schema_values = { schema => $schema, no_transactions => 1 };
my $dbh = Schema->database_handle;
my $t = Test::Mojo->new('TrafficOps');
Test::TestHelper->unload_core_data($schema);
-Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) );
+Test::TestHelper->load_core_data($schema);
ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302)
->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?';
+$t->get_ok("/api/1.2/cdns")->status_is(200)->json_is( "/response/0/id", 100 )
+ ->json_is( "/response/0/name", "cdn1" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
+
+$t->get_ok("/api/1.2/cdns/100")->status_is(200)->json_is( "/response/0/id", 100 )
+ ->json_is( "/response/0/name", "cdn1" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
+
ok $t->post_ok('/api/1.2/cdns' => {Accept => 'application/json'} => json => {
"name" => "cdn_test", "dnssecEnabled" => "true" })
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/api/1.2/deliveryservice_server.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/deliveryservice_server.t b/traffic_ops/app/t/api/1.2/deliveryservice_server.t
index 9f705de..59a9a4d 100644
--- a/traffic_ops/app/t/api/1.2/deliveryservice_server.t
+++ b/traffic_ops/app/t/api/1.2/deliveryservice_server.t
@@ -41,23 +41,23 @@ Test::TestHelper->load_core_data($schema);
ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302)
->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?';
-ok $t->post_ok('/api/1.2/cachegroups/3/deliveryservices' => {Accept => 'application/json'} => json => {
+ok $t->post_ok('/api/1.2/cachegroups/300/deliveryservices' => {Accept => 'application/json'} => json => {
"deliveryServices" => [ 100 ]})
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
- ->json_is( "/response/id" => 3 )
+ ->json_is( "/response/id" => 300 )
->json_is( "/response/deliveryServices/0" => 100 )
->json_is( "/alerts/0/level" => "success" )
- ->json_is( "/alerts/0/text" => "Delivery services successfully assigned to all the servers of cache group 3" )
+ ->json_is( "/alerts/0/text" => "Delivery services successfully assigned to all the servers of cache group 300" )
, 'Does the delivery services assign details return?';
ok $t->get_ok('/api/1.2/deliveryserviceserver.json')
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/0/deliveryService" => "100" )
- ->json_is( "/response/0/server" => "100" )
- ->json_is( "/response/1/deliveryService" => "100" )
- ->json_is( "/response/1/server" => "300" )
- ->json_is( "/response/2/deliveryService" => "100" )
- ->json_is( "/response/2/server" => "600" )
+ ->json_is( "/response/0/server" => 100 )
+ ->json_is( "/response/1/deliveryService" => 100 )
+ ->json_is( "/response/1/server" => 300 )
+ ->json_is( "/response/2/deliveryService" => 100 )
+ ->json_is( "/response/2/server" => 600 )
, 'Does the delivery services servers details return?';
ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } );
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/api/1.2/division.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/division.t b/traffic_ops/app/t/api/1.2/division.t
index 66dfd45..eef9297 100644
--- a/traffic_ops/app/t/api/1.2/division.t
+++ b/traffic_ops/app/t/api/1.2/division.t
@@ -29,33 +29,30 @@ use Test::TestHelper;
BEGIN { $ENV{MOJO_MODE} = "test" }
my $schema = Schema->connect_to_database;
-my $schema_values = { schema => $schema, no_transactions => 1 };
my $dbh = Schema->database_handle;
my $t = Test::Mojo->new('TrafficOps');
Test::TestHelper->unload_core_data($schema);
-Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) );
+Test::TestHelper->load_core_data($schema);
ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302)
->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?';
-$t->get_ok("/api/1.2/divisions")->status_is(200)->json_is( "/response/0/id", 1 )
+$t->get_ok("/api/1.2/divisions")->status_is(200)->json_is( "/response/0/id", 100 )
->json_is( "/response/0/name", "mountain" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.2/divisions/1")->status_is(200)->json_is( "/response/0/id", 1 )
+$t->get_ok("/api/1.2/divisions/100")->status_is(200)->json_is( "/response/0/id", 100 )
->json_is( "/response/0/name", "mountain" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
ok $t->post_ok('/api/1.2/divisions' => {Accept => 'application/json'} => json => {
"name" => "division1" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/name" => "division1" )
, 'Does the division details return?';
+
ok $t->post_ok('/api/1.2/divisions' => {Accept => 'application/json'} => json => {
"name" => "division1" })->status_is(400);
-my $division_id = &get_division_id('divion1');
-
+my $division_id = &get_division_id('division1');
ok $t->put_ok('/api/1.2/divisions/' . $division_id => {Accept => 'application/json'} => json => {
"name" => "division2"
})
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/api/1.2/physlocation.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/physlocation.t b/traffic_ops/app/t/api/1.2/physlocation.t
index 02e300a..3739c9b 100644
--- a/traffic_ops/app/t/api/1.2/physlocation.t
+++ b/traffic_ops/app/t/api/1.2/physlocation.t
@@ -49,10 +49,10 @@ ok $t->post_ok('/api/1.2/regions/non_region/phys_locations' => {Accept => 'appli
"name" => "physical location1",
"shortName" => "mountain"})->status_is(400);
-$t->get_ok("/api/1.2/phys_locations")->status_is(200)->json_is( "/response/0/id", 2 )
+$t->get_ok("/api/1.2/phys_locations")->status_is(200)->json_is( "/response/0/id", 200 )
->json_is( "/response/0/name", "Boulder" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.2/phys_locations/1")->status_is(200)->json_is( "/response/0/id", 1 )
+$t->get_ok("/api/1.2/phys_locations/100")->status_is(200)->json_is( "/response/0/id", 100 )
->json_is( "/response/0/name", "Denver" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
ok $t->post_ok('/api/1.2/phys_locations' => {Accept => 'application/json'} => json => {
@@ -62,7 +62,7 @@ ok $t->post_ok('/api/1.2/phys_locations' => {Accept => 'application/json'} => js
"city" => "city",
"state" => "state",
"zip" => "zip",
- "regionId" => 1,
+ "regionId" => 100,
})
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/name" => "phys1" )
@@ -79,7 +79,7 @@ ok $t->put_ok('/api/1.2/phys_locations/' . $phys_loc_id => {Accept => 'applicat
"city" => "city",
"state" => "state",
"zip" => "zip",
- "regionId" => 1,
+ "regionId" => 100,
})
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/name" => "phys2" )
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/api/1.2/region.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/region.t b/traffic_ops/app/t/api/1.2/region.t
index a6bbbea..c4c35ad 100644
--- a/traffic_ops/app/t/api/1.2/region.t
+++ b/traffic_ops/app/t/api/1.2/region.t
@@ -29,14 +29,11 @@ use Test::TestHelper;
BEGIN { $ENV{MOJO_MODE} = "test" }
my $schema = Schema->connect_to_database;
-my $schema_values = { schema => $schema, no_transactions => 1 };
+my $dbh = Schema->database_handle;
my $t = Test::Mojo->new('TrafficOps');
Test::TestHelper->unload_core_data($schema);
-Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Division->new($schema_values) );
+Test::TestHelper->load_core_data($schema);
ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302)
->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?';
@@ -46,22 +43,23 @@ ok $t->post_ok('/api/1.2/divisions/mountain/regions' => {Accept => 'application/
->json_is( "/response/name" => "region1" )
->json_is( "/response/divisionName" => "mountain" )
, 'Does the region details return?';
+
ok $t->post_ok('/api/1.2/divisions/mountain/regions' => {Accept => 'application/json'} => json => {
"name" => "region1"})->status_is(400);
-$t->get_ok("/api/1.2/regions")->status_is(200)->json_is( "/response/0/id", 2 )
+$t->get_ok("/api/1.2/regions")->status_is(200)->json_is( "/response/0/id", 200 )
->json_is( "/response/0/name", "Boulder Region" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$t->get_ok("/api/1.2/regions/1")->status_is(200)->json_is( "/response/0/id", 1 )
+$t->get_ok("/api/1.2/regions/100")->status_is(200)->json_is( "/response/0/id", 100 )
->json_is( "/response/0/name", "Denver Region" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
ok $t->post_ok('/api/1.2/regions' => {Accept => 'application/json'} => json => {
"name" => "reg1",
- "division" => 1
+ "division" => 100
})
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/name" => "reg1" )
- ->json_is( "/response/division" => 1 )
+ ->json_is( "/response/division" => 100 )
->json_is( "/alerts/0/level" => "success" )
->json_is( "/alerts/0/text" => "Region create was successful." )
, 'Do the region details return?';
@@ -70,11 +68,11 @@ my $region_id = &get_reg_id('reg1');
ok $t->put_ok('/api/1.2/regions/' . $region_id => {Accept => 'application/json'} => json => {
"name" => "reg2",
- "division" => 1
+ "division" => 100
})
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/name" => "reg2" )
- ->json_is( "/response/division" => 1 )
+ ->json_is( "/response/division" => 100 )
->json_is( "/alerts/0/level" => "success" )
, 'Do the regions details return?';
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/api/1.2/server.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/server.t b/traffic_ops/app/t/api/1.2/server.t
index f4af185..3cc0040 100644
--- a/traffic_ops/app/t/api/1.2/server.t
+++ b/traffic_ops/app/t/api/1.2/server.t
@@ -31,23 +31,11 @@ use Data::Dumper;
BEGIN { $ENV{MOJO_MODE} = "test" }
my $schema = Schema->connect_to_database;
-my $schema_values = { schema => $schema, no_transactions => 1 };
my $dbh = Schema->database_handle;
my $t = Test::Mojo->new('TrafficOps');
Test::TestHelper->unload_core_data($schema);
-Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Status->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Parameter->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Profile->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::ProfileParameter->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Division->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Region->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::PhysLocation->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Type->new($schema_values) );
-Test::TestHelper->load_all_fixtures( Fixtures::Deliveryservice->new($schema_values) );
+Test::TestHelper->load_core_data($schema);
sub get_svr_id {
my $host_name = shift;
@@ -81,14 +69,14 @@ ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} =
, 'Does the cache group details return?';
ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => {
- "name" => "mid-northeast-group",
+ "name" => "cg-mid-northeast",
"shortName" => "mneg",
"latitude" => "10",
"longitude" => "40",
"parentCachegroup" => "",
"secondaryParentCachegroup" => "",
"typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
- ->json_is( "/response/name" => "mid-northeast-group" )
+ ->json_is( "/response/name" => "cg-mid-northeast" )
->json_is( "/response/shortName" => "mneg")
->json_is( "/response/latitude" => "10")
->json_is( "/response/longitude" => "40")
@@ -96,22 +84,25 @@ ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} =
->json_is( "/response/secondaryParentCachegroup" => "")
, 'Does the cache group details return?';
+
ok $t->get_ok('/api/1.2/servers?type=MID')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/0/hostName", "atlanta-mid-01" )
->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" )
->json_is( "/response/0/type", "MID" )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
-ok $t->get_ok('/api/1.2/servers?cdn=1')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
+
+
+ok $t->get_ok('/api/1.2/servers?cdn=100')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/0/hostName", "atlanta-edge-01" )
->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" )
- ->json_is( "/response/0/cdnId", 1 )
+ ->json_is( "/response/0/cdnId", 100 )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
-ok $t->get_ok('/api/1.2/servers?cachegroup=2')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
+ok $t->get_ok('/api/1.2/servers?cachegroup=200')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/0/hostName", "atlanta-mid-02" )
->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" )
- ->json_is( "/response/0/cachegroupId", 2 )
+ ->json_is( "/response/0/cachegroupId", 200 )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
ok $t->get_ok('/api/1.2/servers?type=MID&status=ONLINE')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
@@ -121,22 +112,26 @@ ok $t->get_ok('/api/1.2/servers?type=MID&status=ONLINE')->status_is(200)->or( su
->json_is( "/response/0/status", "ONLINE" )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
+
+
ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => {
- "name" => "edge_atl_group",
- "shortName" => "eag",
+ "name" => "edge_atl_group1",
+ "shortName" => "eag1",
"latitude" => "22",
"longitude" => "55",
"parentCachegroup" => "",
"secondaryParentCachegroup" => "",
"typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
- ->json_is( "/response/name" => "edge_atl_group" )
- ->json_is( "/response/shortName" => "eag")
+ ->json_is( "/response/name" => "edge_atl_group1" )
+ ->json_is( "/response/shortName" => "eag1")
->json_is( "/response/latitude" => "22")
->json_is( "/response/longitude" => "55")
->json_is( "/response/parentCachegroup" => "")
->json_is( "/response/secondaryParentCachegroup" => "")
, 'Does the cache group details return?';
+
+
ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => {
"hostName" => "server1",
"domainName" => "example-domain.com",
@@ -153,6 +148,7 @@ ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => js
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
, 'Is a server created when all required fields are provided?';
+
ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => {
"hostName" => "server2",
"domainName" => "example-domain.com",
@@ -313,27 +309,19 @@ ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => js
->json_is( "/response/profile" => "MID1")
, 'Does the server details return?';
-
-
ok $t->post_ok('/api/1.2/deliveryservices/test-ds1/servers' => {Accept => 'application/json'} => json => { "serverNames" => [ 'server1', 'server3' ]})
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
, 'Assign the server to the delivery service?';
-
ok $t->get_ok('/api/1.2/servers/details.json?hostName=server1')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
->json_is( "/response/0/ipGateway", "10.74.27.194" )->json_is( "/response/0/deliveryservices/0", "100" ), 'Does the hostname details return?';
-ok $t->get_ok('/api/1.2/servers/details.json?physLocationID=100')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
- ->json_is( "/response/0/ipGateway", "10.74.27.194" )->json_is( "/response/0/deliveryservices/0", "100" ), 'Does the physLocationID details return?';
-
ok $t->get_ok('/api/1.2/servers/details')->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ),
'Does the validation error occur?';
ok $t->get_ok('/api/1.2/servers/details.json?orderby=hostName')->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content}; } ),
'Does the orderby work?';
ok $t->get_ok('/api/1.2/servers?type=MID')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
- ->json_is( "/response/0/hostName", "tc1_ats1" )
- ->json_is( "/response/0/domainName", "northbound.com" )
->json_is( "/response/0/type", "MID" )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
@@ -352,8 +340,6 @@ ok $t->post_ok('/api/1.2/deliveryservices/test-ds4/servers' => {Accept => 'appli
ok $t->get_ok('/api/1.2/servers?type=MID&status=ONLINE')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
- ->json_is( "/response/0/hostName", "tc1_ats1" )
- ->json_is( "/response/0/domainName", "northbound.com" )
->json_is( "/response/0/type", "MID" )
->json_is( "/response/0/status", "ONLINE" )
->or( sub { diag $t->tx->res->content->asset->{content}; } );
@@ -445,18 +431,8 @@ ok $t->put_ok('/api/1.2/servers/' . $svr_id . '/update' => {Accept => 'applicat
"physLocation" => "HotAtlanta" })
->status_is(404)->or( sub { diag $t->tx->res->content->asset->{content}; } );
-$svr_id1 = &get_svr_id('server1');
-my $svr_id2 = &get_svr_id('server3');
-my $svr_id3 = &get_svr_id('tc1_ats1');
-my $svr_id4 = &get_svr_id('tc1_ats2');
-ok $t->get_ok('/api/1.2/servers?profileId=100&orderby=id' => {Accept => 'application/json'})->status_is(200)
- ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
- ->json_is( "/response/0/id", $svr_id1 )
- ->json_is( "/response/1/id", $svr_id2 )
- ->json_is( "/response/2/id", $svr_id3 )
- ->json_is( "/response/3/id", $svr_id4 )
- , "Does the server ids return?";
-
ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } );
$dbh->disconnect();
done_testing();
+
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/deliveryservice.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/deliveryservice.t b/traffic_ops/app/t/deliveryservice.t
index e418945..99866b1 100644
--- a/traffic_ops/app/t/deliveryservice.t
+++ b/traffic_ops/app/t/deliveryservice.t
@@ -79,7 +79,7 @@ ok $t->post_ok(
'ds.multi_site_origin' => '0',
'ds.multi_site_origin_algorithm' => '0',
'ds.profile' => '100',
- 'ds.cdn_id' => '1',
+ 'ds.cdn_id' => '100',
'ds.qstring_ignore' => '0',
're_order_0' => '0',
're_re_0' => '.*\.jvdtest\..*',
@@ -129,7 +129,7 @@ ok $t->post_ok(
'ds.multi_site_origin' => '0',
'ds.multi_site_origin_algorithm' => '0',
'ds.profile' => '100',
- 'ds.cdn_id' => '1',
+ 'ds.cdn_id' => '100',
'ds.qstring_ignore' => '0',
'ds.signed' => '0',
'ds.type' => '9',
@@ -179,7 +179,7 @@ ok $t->post_ok(
'ds.multi_site_origin' => '0',
'ds.multi_site_origin_algorithm' => '0',
'ds.profile' => '100',
- 'ds.cdn_id' => '1',
+ 'ds.cdn_id' => '100',
'ds.qstring_ignore' => '1',
'ds.signed' => '1',
'ds.type' => '9',
@@ -259,7 +259,7 @@ ok $t->post_ok(
'ds.multi_site_origin' => '0',
'ds.multi_site_origin_algorithm' => '0',
'ds.profile' => '200',
- 'ds.cdn_id' => '2',
+ 'ds.cdn_id' => '200',
'ds.qstring_ignore' => '0',
'ds.signed' => '0',
'ds.type' => '7',
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/phys_location.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/phys_location.t b/traffic_ops/app/t/phys_location.t
index 902020c..6ee5f18 100644
--- a/traffic_ops/app/t/phys_location.t
+++ b/traffic_ops/app/t/phys_location.t
@@ -69,7 +69,7 @@ $t->post_ok(
'location.poc' => 'Jan van Doorn',
'location.email' => 'jvd@comcast.com',
'location.comments' => 'boo',
- 'location.region' => '1',
+ 'location.region' => '100',
}
)->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } );
@@ -86,7 +86,7 @@ $t->post_ok(
'location.poc' => 'Bubba',
'location.email' => 'Louie was here',
'location.comments' => 'boo',
- 'location.region' => '1',
+ 'location.region' => '100',
}
)->status_is(200)->message( 'invalid email' );
@@ -115,7 +115,7 @@ sub upd_and_del() {
'location.phone' => '800-334-5545',
'location.email' => 'jvd@comcast.com',
'location.comments' => 'boo',
- 'location.region' => '1',
+ 'location.region' => '100',
}
)->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } );
$t->get_ok( "/phys_location/$id/delete" )->status_is(302);
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/496bcab5/traffic_ops/app/t/server.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/server.t b/traffic_ops/app/t/server.t
index 069d50a..5010561 100644
--- a/traffic_ops/app/t/server.t
+++ b/traffic_ops/app/t/server.t
@@ -117,10 +117,10 @@ $t->post_ok(
ip6_gateway => '2009:334:333::1',
interface_mtu => '9000',
phys_location => 100,
- cachegroup => 1,
+ cachegroup => 100,
type => 1,
profile => 100,
- cdn => 1,
+ cdn => 100,
mgmt_ip_address => '192.168.1.1',
mgmt_ip_gateway => '192.168.1.2',
mgmt_ip_netmask => '255.255.255.0',
@@ -162,10 +162,10 @@ sub upd_and_del() {
ip6_gateway => '2009:334:333::1',
interface_mtu => '9000',
phys_location => 100,
- cachegroup => 1,
+ cachegroup => 100,
type => 1,
profile => 100,
- cdn_id => 1,
+ cdn_id => 100,
mgmt_ip_address => '192.168.3.1',
mgmt_ip_netmask => '192.168.3.2',
mgmt_ip_gateway => '255.255.255.0',
[27/50] incubator-trafficcontrol git commit: Added readme file for
running the tests
Posted by mi...@apache.org.
Added readme file for running the tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/8f20dad7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/8f20dad7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/8f20dad7
Branch: refs/heads/master
Commit: 8f20dad7d427f2670d75c261b763ac6929a074e5
Parents: bd030e0
Author: David Neuman <da...@gmail.com>
Authored: Tue Dec 6 16:24:03 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/tests/integration/Readme.md | 14 ++++++++++++++
1 file changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/8f20dad7/traffic_ops/client/tests/integration/Readme.md
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/Readme.md b/traffic_ops/client/tests/integration/Readme.md
new file mode 100644
index 0000000..9889b47
--- /dev/null
+++ b/traffic_ops/client/tests/integration/Readme.md
@@ -0,0 +1,14 @@
+# Traffic Ops Client Integration Tests
+
+The Traffic Ops Client Integration tests are used to validate the clients responses against those from the Traffic Ops API. In order to run the tests you will need a Traffic Ops instance with at least one of each of the following: CDN, Delivery Service, Type, Cachegroup, User and Server.
+
+## Running the Integration Tests
+The integration tests are run using `go test`, however, there are some flags that need to be provided in order for the tests to work. The flags are:
+
+* toURL - The URL to Traffic Ops. Default is "http://localhost:3000".
+* toUser - The Traffic Ops user to use. Default is "admin".
+* toPass - The password of the user provided. Deafault is "password".
+
+Example command to run the tests: `go test -v -toUrl=https://to.kabletown.net -toUser=myUser -toPass=myPass`
+
+*It can take serveral minutes for the integration tests to complete, so using the `-v` flag is recommended to see progress.*
[26/50] incubator-trafficcontrol git commit: added Apache license to
test files
Posted by mi...@apache.org.
added Apache license to test files
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/bd030e0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/bd030e0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/bd030e0d
Branch: refs/heads/master
Commit: bd030e0d5176a8e6bc2f38922f4fd0cf2f29a677
Parents: 7ed3fab
Author: David Neuman <da...@gmail.com>
Authored: Tue Dec 6 16:12:05 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
.../client/tests/integration/cachegroup_test.go | 15 +++++++++++++++
traffic_ops/client/tests/integration/cdn_test.go | 15 +++++++++++++++
.../client/tests/integration/crconfig_test.go | 15 +++++++++++++++
.../client/tests/integration/hardware_test.go | 15 +++++++++++++++
.../client/tests/integration/parameter_test.go | 15 +++++++++++++++
traffic_ops/client/tests/integration/profile_test.go | 15 +++++++++++++++
traffic_ops/client/tests/integration/server_test.go | 15 +++++++++++++++
.../client/tests/integration/stats_summary_test.go | 15 +++++++++++++++
.../tests/integration/traffic_monitor_config_test.go | 15 +++++++++++++++
.../tests/integration/traffic_router_config_test.go | 15 +++++++++++++++
traffic_ops/client/tests/integration/type_test.go | 15 +++++++++++++++
traffic_ops/client/tests/integration/user_test.go | 15 +++++++++++++++
12 files changed, 180 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/cachegroup_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/cachegroup_test.go b/traffic_ops/client/tests/integration/cachegroup_test.go
index 4bff049..403a514 100644
--- a/traffic_ops/client/tests/integration/cachegroup_test.go
+++ b/traffic_ops/client/tests/integration/cachegroup_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/cdn_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/cdn_test.go b/traffic_ops/client/tests/integration/cdn_test.go
index 62d8cd2..0dca906 100644
--- a/traffic_ops/client/tests/integration/cdn_test.go
+++ b/traffic_ops/client/tests/integration/cdn_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/crconfig_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/crconfig_test.go b/traffic_ops/client/tests/integration/crconfig_test.go
index 7f404f7..ceb1fa6 100644
--- a/traffic_ops/client/tests/integration/crconfig_test.go
+++ b/traffic_ops/client/tests/integration/crconfig_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import "testing"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/hardware_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/hardware_test.go b/traffic_ops/client/tests/integration/hardware_test.go
index 724c875..0c12ca5 100644
--- a/traffic_ops/client/tests/integration/hardware_test.go
+++ b/traffic_ops/client/tests/integration/hardware_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/parameter_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/parameter_test.go b/traffic_ops/client/tests/integration/parameter_test.go
index 8e5f00a..e7d2220 100644
--- a/traffic_ops/client/tests/integration/parameter_test.go
+++ b/traffic_ops/client/tests/integration/parameter_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/profile_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/profile_test.go b/traffic_ops/client/tests/integration/profile_test.go
index c4af200..f678a37 100644
--- a/traffic_ops/client/tests/integration/profile_test.go
+++ b/traffic_ops/client/tests/integration/profile_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/server_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/server_test.go b/traffic_ops/client/tests/integration/server_test.go
index ba50f3a..937e519 100644
--- a/traffic_ops/client/tests/integration/server_test.go
+++ b/traffic_ops/client/tests/integration/server_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/stats_summary_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/stats_summary_test.go b/traffic_ops/client/tests/integration/stats_summary_test.go
index b419e49..401a740 100644
--- a/traffic_ops/client/tests/integration/stats_summary_test.go
+++ b/traffic_ops/client/tests/integration/stats_summary_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/traffic_monitor_config_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/traffic_monitor_config_test.go b/traffic_ops/client/tests/integration/traffic_monitor_config_test.go
index 341e53a..9c23eb8 100644
--- a/traffic_ops/client/tests/integration/traffic_monitor_config_test.go
+++ b/traffic_ops/client/tests/integration/traffic_monitor_config_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/traffic_router_config_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/traffic_router_config_test.go b/traffic_ops/client/tests/integration/traffic_router_config_test.go
index ce61557..0ce2aba 100644
--- a/traffic_ops/client/tests/integration/traffic_router_config_test.go
+++ b/traffic_ops/client/tests/integration/traffic_router_config_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/type_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/type_test.go b/traffic_ops/client/tests/integration/type_test.go
index 6dd0c94..38284c6 100644
--- a/traffic_ops/client/tests/integration/type_test.go
+++ b/traffic_ops/client/tests/integration/type_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd030e0d/traffic_ops/client/tests/integration/user_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/user_test.go b/traffic_ops/client/tests/integration/user_test.go
index b0f6ab7..7307b59 100644
--- a/traffic_ops/client/tests/integration/user_test.go
+++ b/traffic_ops/client/tests/integration/user_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
[44/50] incubator-trafficcontrol git commit: conversion -- move env
settings to separate files
Posted by mi...@apache.org.
conversion -- move env settings to separate files
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/dc136a18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/dc136a18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/dc136a18
Branch: refs/heads/master
Commit: dc136a189c1f1ca1709d5d91bc16eeda34d38f7c
Parents: eafd482
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed Dec 21 11:25:07 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:12 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/pg-migration/dataimport.env | 19 +++++++++++++++++++
traffic_ops/app/db/pg-migration/dataimport.yml | 6 ++----
.../app/db/pg-migration/docker-compose.yml | 4 ----
.../app/db/pg-migration/postgres_host.yml | 6 ++----
4 files changed, 23 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/dc136a18/traffic_ops/app/db/pg-migration/dataimport.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/dataimport.env b/traffic_ops/app/db/pg-migration/dataimport.env
new file mode 100644
index 0000000..b177869
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/dataimport.env
@@ -0,0 +1,19 @@
+#!/bin/bash -x
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+TO_SERVER=http://traffic_ops.example.com
+TO_USER=to_user
+TO_PASSWORD=twelve
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/dc136a18/traffic_ops/app/db/pg-migration/dataimport.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/dataimport.yml b/traffic_ops/app/db/pg-migration/dataimport.yml
index 1087efa..b949925 100644
--- a/traffic_ops/app/db/pg-migration/dataimport.yml
+++ b/traffic_ops/app/db/pg-migration/dataimport.yml
@@ -20,7 +20,5 @@ services:
context: .
dockerfile: Dockerfile-traffic_ops-client
restart: "no"
- environment:
- - TO_USER
- - TO_PASSWORD
- - TO_SERVER
+ env_file:
+ - dataimport.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/dc136a18/traffic_ops/app/db/pg-migration/docker-compose.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/docker-compose.yml b/traffic_ops/app/db/pg-migration/docker-compose.yml
index a9d9d85..7dc4f5b 100644
--- a/traffic_ops/app/db/pg-migration/docker-compose.yml
+++ b/traffic_ops/app/db/pg-migration/docker-compose.yml
@@ -43,10 +43,6 @@ services:
extends:
service: postgres_host
file: postgres_host.yml
- environment:
- - POSTGRES_DB=traffic_ops
- - POSTGRES_PASSWORD=twelve
- - POSTGRES_USER=traffic_ops
depends_on:
- mysql
volumes:
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/dc136a18/traffic_ops/app/db/pg-migration/postgres_host.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/postgres_host.yml b/traffic_ops/app/db/pg-migration/postgres_host.yml
index f8e0439..9e1100f 100644
--- a/traffic_ops/app/db/pg-migration/postgres_host.yml
+++ b/traffic_ops/app/db/pg-migration/postgres_host.yml
@@ -18,9 +18,7 @@ services:
build:
context: ..
dockerfile: pg-migration/Dockerfile-postgres
- environment:
- - POSTGRES_DB=traffic_ops
- - POSTGRES_PASSWORD=twelve
- - POSTGRES_USER=traffic_ops
+ env_file:
+ - postgres.env
ports:
- 5432
[31/50] incubator-trafficcontrol git commit: move shebang back to top
Posted by mi...@apache.org.
move shebang back to top
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e845962d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e845962d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e845962d
Branch: refs/heads/master
Commit: e845962dd1b364bee79e4155346d5dcdb3a3e52e
Parents: f78e8fb
Author: Dan Kirkwood <da...@gmail.com>
Authored: Mon Dec 12 15:06:16 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/pg-migration/get-to-data.sh | 2 +-
traffic_ops/app/db/pg-migration/runconvert.sh | 2 +-
traffic_ops/app/db/pg-migration/runpgloader.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e845962d/traffic_ops/app/db/pg-migration/get-to-data.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/get-to-data.sh b/traffic_ops/app/db/pg-migration/get-to-data.sh
index ea998f0..c1be98a 100755
--- a/traffic_ops/app/db/pg-migration/get-to-data.sh
+++ b/traffic_ops/app/db/pg-migration/get-to-data.sh
@@ -1,3 +1,4 @@
+#!/bin/bash -x
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -11,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-#!/bin/bash -x
output=$1
[[ -n $output ]] && output="-o $output"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e845962d/traffic_ops/app/db/pg-migration/runconvert.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runconvert.sh b/traffic_ops/app/db/pg-migration/runconvert.sh
index 1e7cced..641c966 100755
--- a/traffic_ops/app/db/pg-migration/runconvert.sh
+++ b/traffic_ops/app/db/pg-migration/runconvert.sh
@@ -1,3 +1,4 @@
+#!/bin/bash -x
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -11,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-#!/bin/bash -x
set -x
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e845962d/traffic_ops/app/db/pg-migration/runpgloader.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runpgloader.sh b/traffic_ops/app/db/pg-migration/runpgloader.sh
index 819ee67..2aa2206 100755
--- a/traffic_ops/app/db/pg-migration/runpgloader.sh
+++ b/traffic_ops/app/db/pg-migration/runpgloader.sh
@@ -1,3 +1,4 @@
+#!/bin/bash -x
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -11,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-#!/bin/bash -x
# make sure postgres and mysql ports are both active
echo "POSTGRES_HOST=$POSTGRES_HOST MYSQL_HOST=$MYSQL_HOST"
[04/50] incubator-trafficcontrol git commit: add another step to
convert bools
Posted by mi...@apache.org.
add another step to convert bools
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/ce61680f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/ce61680f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/ce61680f
Branch: refs/heads/master
Commit: ce61680f795ed836da61fe703112b3e236dceb57
Parents: 731ecd7
Author: Dan Kirkwood <da...@gmail.com>
Authored: Sun Dec 4 01:44:03 2016 +0000
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/pg-migration/Dockerfile-convert | 4 +++-
traffic_ops/app/db/pg-migration/docker-compose.yml | 16 +++++++++++++++-
.../mysql/initdb.d/AAA-wait-for-data.sh | 6 ------
traffic_ops/app/db/pg-migration/mysql/run.sh | 8 --------
traffic_ops/app/db/pg-migration/runconvert.sh | 17 +++++++++++++++++
traffic_ops/app/db/pg-migration/runpgloader.sh | 8 ++++++++
6 files changed, 43 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ce61680f/traffic_ops/app/db/pg-migration/Dockerfile-convert
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-convert b/traffic_ops/app/db/pg-migration/Dockerfile-convert
index 7f96523..b1a7dd5 100644
--- a/traffic_ops/app/db/pg-migration/Dockerfile-convert
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-convert
@@ -2,6 +2,8 @@ FROM postgres:9.6
MAINTAINER Dan Kirkwood
+RUN apt-get update && apt-get -y install netcat
+ADD pg-migration/runconvert.sh .
ADD convert_bools.sql .
-CMD psql postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB < ./convert_bools.sql
+CMD ./runconvert.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ce61680f/traffic_ops/app/db/pg-migration/docker-compose.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/docker-compose.yml b/traffic_ops/app/db/pg-migration/docker-compose.yml
index fc327fa..74b5bd8 100644
--- a/traffic_ops/app/db/pg-migration/docker-compose.yml
+++ b/traffic_ops/app/db/pg-migration/docker-compose.yml
@@ -1,5 +1,8 @@
version: '2'
+volumes:
+ sync:
+
services:
# dataimport reads data from an existing traffic_ops server running mysql thru the API
dataimport:
@@ -41,7 +44,7 @@ services:
- POSTGRES_PASSWORD=twelve
- POSTGRES_USER=traffic_ops
volumes:
- - /var/lib/postgresql/data:/var/lib/postgresql/data
+ - /opt/traffic_ops-db:/var/lib/postgresql/data
ports:
- 5432
@@ -63,6 +66,8 @@ services:
- POSTGRES_DB=traffic_ops
- POSTGRES_PASSWORD=twelve
- POSTGRES_USER=traffic_ops
+ volumes:
+ - sync:/sync
# convert runs necessary post-import conversion(s) in postgres
convert:
@@ -70,3 +75,12 @@ services:
context: ..
dockerfile: pg-migration/Dockerfile-convert
restart: "no"
+ depends_on:
+ - postgres_host
+ environment:
+ - POSTGRES_HOST=postgres_host
+ - POSTGRES_DB=traffic_ops
+ - POSTGRES_PASSWORD=twelve
+ - POSTGRES_USER=traffic_ops
+ volumes:
+ - sync:/sync
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ce61680f/traffic_ops/app/db/pg-migration/mysql/initdb.d/AAA-wait-for-data.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql/initdb.d/AAA-wait-for-data.sh b/traffic_ops/app/db/pg-migration/mysql/initdb.d/AAA-wait-for-data.sh
deleted file mode 100755
index 69681ab..0000000
--- a/traffic_ops/app/db/pg-migration/mysql/initdb.d/AAA-wait-for-data.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash -x
-
-# wait for traffic_ops.sql file to appear
-while [[ ! -f /docker-entrypoint-initdb.d/traffic_ops.sql ]]; do
- sleep 1
-done
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ce61680f/traffic_ops/app/db/pg-migration/mysql/run.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql/run.sh b/traffic_ops/app/db/pg-migration/mysql/run.sh
deleted file mode 100644
index 50c149d..0000000
--- a/traffic_ops/app/db/pg-migration/mysql/run.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-docker run \
- --name mysql \
- -p 3306:3306 \
- -v $(pwd)/mysql/conf.d:/etc/mysql/conf.d \
- -v $(pwd)/mysql/initdb.d:/docker-entrypoint-initdb.d \
- -d mysql
-
-
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ce61680f/traffic_ops/app/db/pg-migration/runconvert.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runconvert.sh b/traffic_ops/app/db/pg-migration/runconvert.sh
new file mode 100755
index 0000000..6b27f97
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/runconvert.sh
@@ -0,0 +1,17 @@
+#!/bin/bash -x
+
+set -x
+
+waiting=/sync/waiting-for-pgloader
+touch $waiting
+
+# Wait for pgloader to finish
+while [[ -f $waiting ]]; do
+ ls -l $waiting
+ sleep 3
+done
+
+echo "Looks like pgloader is finished.. Converting.."
+
+# Load required conversion of booleans
+psql postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB < ./convert_bools.sql
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ce61680f/traffic_ops/app/db/pg-migration/runpgloader.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runpgloader.sh b/traffic_ops/app/db/pg-migration/runpgloader.sh
index 9f698f3..cbbf8e3 100755
--- a/traffic_ops/app/db/pg-migration/runpgloader.sh
+++ b/traffic_ops/app/db/pg-migration/runpgloader.sh
@@ -16,3 +16,11 @@ pgloader -v \
--cast 'type double to numeric drop typemod' \
mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST/traffic_ops_db \
postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB
+
+waiting=/sync/waiting-for-pgloader
+while [[ ! -f $waiting ]]; do
+ echo "Nothing waiting for pgloader?"
+ sleep 3
+done
+
+rm $waiting
[40/50] incubator-trafficcontrol git commit: stores,
diffs and fetches CRConfig.json from the db instead of the file system
Posted by mi...@apache.org.
stores, diffs and fetches CRConfig.json from the db instead of the file system
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a4dee0d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a4dee0d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a4dee0d2
Branch: refs/heads/master
Commit: a4dee0d251a9b4a7b38df9ec2439b453e833b87c
Parents: 709f428
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Fri Dec 9 12:06:14 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700
----------------------------------------------------------------------
.../20161208000001_create_snapshots.sql | 29 ++++++
traffic_ops/app/lib/API/Topology.pm | 2 +-
traffic_ops/app/lib/Schema/Result/Cdn.pm | 19 +++-
traffic_ops/app/lib/Schema/Result/Snapshot.pm | 95 ++++++++++++++++++++
traffic_ops/app/lib/TrafficOpsRoutes.pm | 1 +
traffic_ops/app/lib/UI/Snapshot.pm | 39 ++++++++
traffic_ops/app/lib/UI/Tools.pm | 2 +-
traffic_ops/app/lib/UI/Topology.pm | 89 +++++++-----------
traffic_ops/build/traffic_ops.spec | 3 -
9 files changed, 216 insertions(+), 63 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a4dee0d2/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql b/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql
new file mode 100644
index 0000000..240a0c5
--- /dev/null
+++ b/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql
@@ -0,0 +1,29 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+-- +goose Up
+-- SQL in section 'Up' is executed when this migration is applied
+
+-- snapshots
+CREATE TABLE snapshot (
+ cdn text primary key REFERENCES cdn (name) ON UPDATE CASCADE NOT NULL,
+ content json NOT NULL,
+ last_updated timestamp with time zone DEFAULT now()
+);
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON snapshot FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
+
+-- +goose Down
+-- SQL section 'Down' is executed when this migration is rolled back
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a4dee0d2/traffic_ops/app/lib/API/Topology.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Topology.pm b/traffic_ops/app/lib/API/Topology.pm
index fa4dcb7..6270ea8 100644
--- a/traffic_ops/app/lib/API/Topology.pm
+++ b/traffic_ops/app/lib/API/Topology.pm
@@ -56,7 +56,7 @@ sub SnapshotCRConfig {
}
my $json = &UI::Topology::gen_crconfig_json($self, $cdn_name);
- &UI::Topology::write_crconfig_json($self, $cdn_name, $json);
+ &UI::Topology::write_crconfig_json_to_db($self, $cdn_name, $json);
&UI::Utils::log($self, "Snapshot CRConfig created." , "OPER");
return $self->success("SUCCESS");
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a4dee0d2/traffic_ops/app/lib/Schema/Result/Cdn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/Cdn.pm b/traffic_ops/app/lib/Schema/Result/Cdn.pm
index d8c05fd..39669cb 100644
--- a/traffic_ops/app/lib/Schema/Result/Cdn.pm
+++ b/traffic_ops/app/lib/Schema/Result/Cdn.pm
@@ -129,9 +129,24 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
+=head2 snapshot
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2016-11-18 22:45:19
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YT90F9iN3AECS+hDmj/hwQ
+Type: might_have
+
+Related object: L<Schema::Result::Snapshot>
+
+=cut
+
+__PACKAGE__->might_have(
+ "snapshot",
+ "Schema::Result::Snapshot",
+ { "foreign.cdn" => "self.name" },
+ { cascade_copy => 0, cascade_delete => 0 },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-09 09:10:09
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yBLkvGMimI0emk0nO5/CAA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a4dee0d2/traffic_ops/app/lib/Schema/Result/Snapshot.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/Snapshot.pm b/traffic_ops/app/lib/Schema/Result/Snapshot.pm
new file mode 100644
index 0000000..08f522e
--- /dev/null
+++ b/traffic_ops/app/lib/Schema/Result/Snapshot.pm
@@ -0,0 +1,95 @@
+use utf8;
+package Schema::Result::Snapshot;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Schema::Result::Snapshot
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<snapshot>
+
+=cut
+
+__PACKAGE__->table("snapshot");
+
+=head1 ACCESSORS
+
+=head2 cdn
+
+ data_type: 'text'
+ is_foreign_key: 1
+ is_nullable: 0
+
+=head2 content
+
+ data_type: 'json'
+ is_nullable: 0
+
+=head2 last_updated
+
+ data_type: 'timestamp with time zone'
+ default_value: current_timestamp
+ is_nullable: 1
+ original: {default_value => \"now()"}
+
+=cut
+
+__PACKAGE__->add_columns(
+ "cdn",
+ { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
+ "content",
+ { data_type => "json", is_nullable => 0 },
+ "last_updated",
+ {
+ data_type => "timestamp with time zone",
+ default_value => \"current_timestamp",
+ is_nullable => 1,
+ original => { default_value => \"now()" },
+ },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</cdn>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("cdn");
+
+=head1 RELATIONS
+
+=head2 cdn
+
+Type: belongs_to
+
+Related object: L<Schema::Result::Cdn>
+
+=cut
+
+__PACKAGE__->belongs_to(
+ "cdn",
+ "Schema::Result::Cdn",
+ { name => "cdn" },
+ { is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-09 12:04:19
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WQw7mw5c5UgACYTxspyMeg
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a4dee0d2/traffic_ops/app/lib/TrafficOpsRoutes.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/TrafficOpsRoutes.pm b/traffic_ops/app/lib/TrafficOpsRoutes.pm
index bad6232..8b7de9c 100644
--- a/traffic_ops/app/lib/TrafficOpsRoutes.pm
+++ b/traffic_ops/app/lib/TrafficOpsRoutes.pm
@@ -331,6 +331,7 @@ sub ui_routes {
# -- Topology - CCR Config, rewrote in json
$r->route('/genfiles/:mode/bycdnname/:cdnname/CRConfig')->via('GET')->over( authenticated => 1 )->to( 'Topology#ccr_config', namespace => $namespace );
+ $r->get('/CRConfig-Snapshots/:cdn_name/CRConfig.json')->over( authenticated => 1 )->to( 'Snapshot#get_cdn_snapshot', namespace => $namespace );
$r->get('/types')->over( authenticated => 1 )->to( 'Types#index', namespace => $namespace );
$r->route('/types/add')->via('GET')->over( authenticated => 1 )->to( 'Types#add', namespace => $namespace );
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a4dee0d2/traffic_ops/app/lib/UI/Snapshot.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Snapshot.pm b/traffic_ops/app/lib/UI/Snapshot.pm
new file mode 100644
index 0000000..c39a541
--- /dev/null
+++ b/traffic_ops/app/lib/UI/Snapshot.pm
@@ -0,0 +1,39 @@
+package UI::Snapshot;
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+
+# JvD Note: you always want to put Utils as the first use. Sh*t don't work if it's after the Mojo lines.
+use UI::Utils;
+use Mojo::Base 'Mojolicious::Controller';
+use Data::Dumper;
+
+sub get_cdn_snapshot {
+ my $self = shift;
+ my $cdn_name = $self->param('cdn_name');
+
+ my $snapshot = $self->db->resultset('Snapshot')->search( { cdn => $cdn_name } )->get_column('content')->single();
+ if ( !defined($snapshot) ) {
+ return $self->not_found();
+ }
+
+ $self->res->headers->content_type("application/download");
+ $self->res->headers->content_disposition("attachment; filename=\"CRConfig.json\"");
+ $self->render( text => $snapshot, format => 'json' );
+
+}
+
+1;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a4dee0d2/traffic_ops/app/lib/UI/Tools.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Tools.pm b/traffic_ops/app/lib/UI/Tools.pm
index 2482579..218f197 100644
--- a/traffic_ops/app/lib/UI/Tools.pm
+++ b/traffic_ops/app/lib/UI/Tools.pm
@@ -113,7 +113,7 @@ sub write_crconfig {
$self->flash( alertmsg => $error );
}
else {
- UI::Topology::write_crconfig_json( $self, $cdn_name, $json );
+ UI::Topology::write_crconfig_json_to_db( $self, $cdn_name, $json );
&log( $self, "Snapshot CRConfig created.", "OPER" );
$self->flash( alertmsg => "Successfully wrote CRConfig.json!" );
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a4dee0d2/traffic_ops/app/lib/UI/Topology.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Topology.pm b/traffic_ops/app/lib/UI/Topology.pm
index 09fb68f..465131e 100644
--- a/traffic_ops/app/lib/UI/Topology.pm
+++ b/traffic_ops/app/lib/UI/Topology.pm
@@ -554,43 +554,20 @@ sub gen_crconfig_json {
return ($data_obj);
}
-sub read_crconfig_json {
- my $cdn_name = shift;
- my $crconfig_file = "public/CRConfig-Snapshots/$cdn_name/CRConfig.json";
-
- open my $fh, '<', $crconfig_file;
- if ( $! && $! !~ m/Inappropriate ioctl for device/ ) {
- my $e = Mojo::Exception->throw("$! when opening $crconfig_file");
- }
- my $crconfig_disk = do { local $/; <$fh> };
- close($fh);
- my $crconfig_scalar = decode_json($crconfig_disk);
- return $crconfig_scalar;
-}
-
-sub write_crconfig_json {
+sub write_crconfig_json_to_db {
my $self = shift;
my $cdn_name = shift;
my $crconfig_db = shift;
my $crconfig_json = encode_json($crconfig_db);
- my $crconfig_file = "public/CRConfig-Snapshots/$cdn_name/CRConfig.json";
- my $dir = dirname($crconfig_file);
-
- if ( !-d $dir ) {
- print "$dir does not exist; attempting to create\n";
- mkpath($dir);
- }
- open my $fh, '>', $crconfig_file;
- if ( $! && $! !~ m/Inappropriate ioctl for device/ ) {
- my $e = Mojo::Exception->throw("$! when opening $crconfig_file");
+ my $snapshot = $self->db->resultset('Snapshot')->find( { cdn => $cdn_name } );
+ if ( defined($snapshot) ) {
+ $snapshot->update({ content => $crconfig_json });
+ } else {
+ my $insert = $self->db->resultset('Snapshot')->create( { cdn => $cdn_name, content => $crconfig_json } );
+ $insert->insert();
}
- print $fh $crconfig_json;
- close($fh);
- return;
- #$self->flash( alertmsg => "Success!" );
- #return $self->redirect_to($self->tx->req->content->headers->{'headers'}->{'referer'}->[0]->[0]);
}
sub diff_crconfig_json {
@@ -598,8 +575,9 @@ sub diff_crconfig_json {
my $json = shift;
my $cdn_name = shift;
- if ( !-f "public/CRConfig-Snapshots/$cdn_name/CRConfig.json"
- && &is_admin($self) )
+ my $current_snapshot = $self->db->resultset('Snapshot')->search( { cdn => $cdn_name } )->get_column('content')->single();
+
+ if ( !defined($current_snapshot) )
{
my @err = ();
$err[0] = "There is no existing CRConfig for " . $cdn_name . " to diff against... Is this the first snapshot???";
@@ -611,25 +589,24 @@ sub diff_crconfig_json {
return ( \@err, \@dummy, \@caution, \@dummy, \@dummy, \@proceed, \@dummy );
}
- # my $db_config = &gen_crconfig_json( $self, $cdn_name );
- my $disk_config = &read_crconfig_json($cdn_name);
+ $current_snapshot = decode_json($current_snapshot);
(
- my $disk_ds_strings,
- my $disk_loc_strings,
- my $disk_cs_strings,
- my $disk_csds_strings,
- my $disk_rascal_strings,
- my $disk_ccr_strings,
- my $disk_cfg_strings
- ) = &crconfig_strings($disk_config);
- my @disk_ds_strings = @$disk_ds_strings;
- my @disk_loc_strings = @$disk_loc_strings;
- my @disk_cs_strings = @$disk_cs_strings;
- my @disk_csds_strings = @$disk_csds_strings;
- my @disk_rascal_strings = @$disk_rascal_strings;
- my @disk_ccr_strings = @$disk_ccr_strings;
- my @disk_cfg_strings = @$disk_cfg_strings;
+ my $ds_strings,
+ my $loc_strings,
+ my $cs_strings,
+ my $csds_strings,
+ my $rascal_strings,
+ my $ccr_strings,
+ my $cfg_strings
+ ) = &crconfig_strings($current_snapshot);
+ my @ds_strings = @$ds_strings;
+ my @loc_strings = @$loc_strings;
+ my @cs_strings = @$cs_strings;
+ my @csds_strings = @$csds_strings;
+ my @rascal_strings = @$rascal_strings;
+ my @ccr_strings = @$ccr_strings;
+ my @cfg_strings = @$cfg_strings;
( my $db_ds_strings, my $db_loc_strings, my $db_cs_strings, my $db_csds_strings, my $db_rascal_strings, my $db_ccr_strings, my $db_cfg_strings ) =
&crconfig_strings($json);
@@ -641,13 +618,13 @@ sub diff_crconfig_json {
my @db_ccr_strings = @$db_ccr_strings;
my @db_cfg_strings = @$db_cfg_strings;
- my @ds_text = &compare_lists( \@db_ds_strings, \@disk_ds_strings, "Section: Delivery Services" );
- my @loc_text = &compare_lists( \@db_loc_strings, \@disk_loc_strings, "Section: Edge Cachegroups" );
- my @cs_text = &compare_lists( \@db_cs_strings, \@disk_cs_strings, "Section: Traffic Servers" );
- my @csds_text = &compare_lists( \@db_csds_strings, \@disk_csds_strings, "Section: Traffic Server - Delivery Services" );
- my @rascal_text = &compare_lists( \@db_rascal_strings, \@disk_rascal_strings, "Section: Traffic Monitors" );
- my @ccr_text = &compare_lists( \@db_ccr_strings, \@disk_ccr_strings, "Section: Traffic Routers" );
- my @cfg_text = &compare_lists( \@db_cfg_strings, \@disk_cfg_strings, "Section: CDN Configs" );
+ my @ds_text = &compare_lists( \@db_ds_strings, \@ds_strings, "Section: Delivery Services" );
+ my @loc_text = &compare_lists( \@db_loc_strings, \@loc_strings, "Section: Edge Cachegroups" );
+ my @cs_text = &compare_lists( \@db_cs_strings, \@cs_strings, "Section: Traffic Servers" );
+ my @csds_text = &compare_lists( \@db_csds_strings, \@csds_strings, "Section: Traffic Server - Delivery Services" );
+ my @rascal_text = &compare_lists( \@db_rascal_strings, \@rascal_strings, "Section: Traffic Monitors" );
+ my @ccr_text = &compare_lists( \@db_ccr_strings, \@ccr_strings, "Section: Traffic Routers" );
+ my @cfg_text = &compare_lists( \@db_cfg_strings, \@cfg_strings, "Section: CDN Configs" );
return ( \@ds_text, \@loc_text, \@cs_text, \@csds_text, \@rascal_text, \@ccr_text, \@cfg_text );
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a4dee0d2/traffic_ops/build/traffic_ops.spec
----------------------------------------------------------------------
diff --git a/traffic_ops/build/traffic_ops.spec b/traffic_ops/build/traffic_ops.spec
index 253d791..b559b21 100644
--- a/traffic_ops/build/traffic_ops.spec
+++ b/traffic_ops/build/traffic_ops.spec
@@ -78,9 +78,6 @@ Built: %(date) by %{getenv: USER}
%__cp -R $RPM_BUILD_DIR/traffic_ops-%{version}/* $RPM_BUILD_ROOT/%{PACKAGEDIR}
- if [ ! -d $RPM_BUILD_ROOT/%{PACKAGEDIR}/app/public/CRConfig-Snapshots ]; then
- %__mkdir -p $RPM_BUILD_ROOT/%{PACKAGEDIR}/app/public/CRConfig-Snapshots
- fi
if [ ! -d $RPM_BUILD_ROOT/%{PACKAGEDIR}/app/public/routing ]; then
%__mkdir -p $RPM_BUILD_ROOT/%{PACKAGEDIR}/app/public/routing
fi
[47/50] incubator-trafficcontrol git commit: fix cdn.t merge
Posted by mi...@apache.org.
fix cdn.t merge
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/5fe789b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/5fe789b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/5fe789b5
Branch: refs/heads/master
Commit: 5fe789b5c12aca9459b096eb3691c71f064562df
Parents: b8445d9
Author: Dan Kirkwood <da...@gmail.com>
Authored: Mon Jan 9 13:11:18 2017 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Mon Jan 9 13:11:18 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/t/api/1.2/cdn.t | 9 ---------
1 file changed, 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5fe789b5/traffic_ops/app/t/api/1.2/cdn.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/cdn.t b/traffic_ops/app/t/api/1.2/cdn.t
index b35e2e4..aed0845 100644
--- a/traffic_ops/app/t/api/1.2/cdn.t
+++ b/traffic_ops/app/t/api/1.2/cdn.t
@@ -40,12 +40,6 @@ Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) );
ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302)
->or( sub { diag $t->tx->res->content->asset->{content}; } ), 'Should login?';
-$t->get_ok("/api/1.2/cdns")->status_is(200)->json_is( "/response/0/id", 1 )
- ->json_is( "/response/0/name", "cdn1" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
-
-$t->get_ok("/api/1.2/cdns/1")->status_is(200)->json_is( "/response/0/id", 1 )
- ->json_is( "/response/0/name", "cdn1" )->or( sub { diag $t->tx->res->content->asset->{content}; } );
-
ok $t->post_ok('/api/1.2/cdns' => {Accept => 'application/json'} => json => {
"name" => "cdn_test", "dnssecEnabled" => "true" })
->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
@@ -54,9 +48,6 @@ ok $t->post_ok('/api/1.2/cdns' => {Accept => 'application/json'} => json => {
->json_is( "/alerts/0/text" => "cdn was created." )
, 'Does the cdn details return?';
-$t->get_ok("/api/1.2/cdns/capacity.json")->status_is(200)->json_is( "/response/unavailablePercent", "0" )->json_is( "/response/availablePercent", "0" )
- ->json_is( "/response/utilizedPercent", "0" )->json_is( "/response/maintenancePercent", "0" )
-
my $cdn_id = &get_cdn_id('cdn_test');
ok $t->put_ok('/api/1.2/cdns/' . $cdn_id => {Accept => 'application/json'} => json => {
[34/50] incubator-trafficcontrol git commit: adds goose down for
snapshot trigger and table creation
Posted by mi...@apache.org.
adds goose down for snapshot trigger and table creation
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/3476d776
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/3476d776
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/3476d776
Branch: refs/heads/master
Commit: 3476d77686551ee6698cb592a4f902629ae92d37
Parents: c6d312a
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Dec 12 14:30:02 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3476d776/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql b/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql
index 240a0c5..d5c2d9a 100644
--- a/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql
+++ b/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql
@@ -27,3 +27,6 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON snapshot FOR EACH RO
-- +goose Down
-- SQL section 'Down' is executed when this migration is rolled back
+DROP TRIGGER on_update_current_timestamp ON snapshot;
+
+DROP TABLE snapshot;
[37/50] incubator-trafficcontrol git commit: removes expensive
DISTINCT
Posted by mi...@apache.org.
removes expensive DISTINCT
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/b5964d85
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/b5964d85
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/b5964d85
Branch: refs/heads/master
Commit: b5964d8506d631225cbc672a41ae485515564845
Parents: a764127
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Tue Dec 20 16:53:18 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700
----------------------------------------------------------------------
.../Result/DeliveryServiceInfoForDomainList.pm | 65 +++++++++++---------
.../Result/DeliveryServiceInfoForServerList.pm | 5 +-
2 files changed, 38 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b5964d85/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm b/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm
index 438028c..7476054 100644
--- a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm
+++ b/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm
@@ -38,41 +38,48 @@ __PACKAGE__->table("DeliveryServiceInfoForDomainList:");
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition( "
-SELECT DISTINCT
- deliveryservice.xml_id AS xml_id,
+SELECT
+ deliveryservice.xml_id,
deliveryservice.id AS ds_id,
- deliveryservice.dscp AS dscp,
- deliveryservice.signed AS signed,
- deliveryservice.qstring_ignore AS qstring_ignore,
- deliveryservice.org_server_fqdn as org_server_fqdn,
- deliveryservice.multi_site_origin as multi_site_origin,
- deliveryservice.multi_site_origin_algorithm as multi_site_origin_algorithm,
- deliveryservice.range_request_handling as range_request_handling,
- deliveryservice.origin_shield as origin_shield,
- regex.pattern AS pattern,
+ deliveryservice.dscp,
+ deliveryservice.signed,
+ deliveryservice.qstring_ignore,
+ deliveryservice.org_server_fqdn,
+ deliveryservice.multi_site_origin,
+ deliveryservice.multi_site_origin_algorithm,
+ deliveryservice.range_request_handling,
+ deliveryservice.origin_shield,
+ regex.pattern,
retype.name AS re_type,
dstype.name AS ds_type,
parameter.value AS domain_name,
- deliveryservice_regex.set_number AS set_number,
- deliveryservice.edge_header_rewrite as edge_header_rewrite,
- deliveryservice.mid_header_rewrite as mid_header_rewrite,
- deliveryservice.regex_remap as regex_remap,
- deliveryservice.cacheurl as cacheurl,
- deliveryservice.remap_text as remap_text,
- deliveryservice.protocol as protocol
+ deliveryservice_regex.set_number,
+ deliveryservice.edge_header_rewrite,
+ deliveryservice.mid_header_rewrite,
+ deliveryservice.regex_remap,
+ deliveryservice.cacheurl,
+ deliveryservice.remap_text,
+ deliveryservice.protocol
FROM
deliveryservice
- JOIN deliveryservice_regex ON deliveryservice_regex.deliveryservice = deliveryservice.id
- JOIN regex ON deliveryservice_regex.regex = regex.id
- JOIN type as retype ON regex.type = retype.id
- JOIN type as dstype ON deliveryservice.type = dstype.id
- JOIN profile_parameter ON deliveryservice.profile = profile_parameter.profile
- JOIN parameter ON parameter.id = profile_parameter.parameter
- JOIN deliveryservice_server ON deliveryservice_server.deliveryservice = deliveryservice.id
- JOIN server ON deliveryservice_server.server = server.id
-WHERE parameter.name = 'domain_name' AND parameter.value = ?
-ORDER BY ds_id, re_type , deliveryservice_regex.set_number
-"
+ JOIN deliveryservice_regex ON deliveryservice_regex.deliveryservice = deliveryservice.id
+ JOIN regex ON deliveryservice_regex.regex = regex.id
+ JOIN type as retype ON regex.type = retype.id
+ JOIN type as dstype ON deliveryservice.type = dstype.id
+ JOIN profile_parameter ON deliveryservice.profile = profile_parameter.profile
+ JOIN parameter ON parameter.id = profile_parameter.parameter
+WHERE
+ parameter.name = 'domain_name'
+ AND parameter.value = ?
+ AND deliveryservice.id in (
+ SELECT
+ deliveryservice_server.deliveryservice
+ FROM
+ deliveryservice_server)
+ORDER BY
+ ds_id,
+ re_type,
+ set_number"
);
__PACKAGE__->add_columns(
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b5964d85/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForServerList.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForServerList.pm b/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForServerList.pm
index 72ff2b9..2c36f82 100644
--- a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForServerList.pm
+++ b/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForServerList.pm
@@ -38,7 +38,7 @@ __PACKAGE__->table("DeliveryServiceInfoForServerList:");
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition( "
-SELECT DISTINCT
+SELECT
deliveryservice.xml_id AS xml_id,
deliveryservice.id AS ds_id,
deliveryservice.dscp AS dscp,
@@ -69,8 +69,7 @@ FROM
JOIN profile_parameter ON deliveryservice.profile = profile_parameter.profile
JOIN parameter ON parameter.id = profile_parameter.parameter
JOIN deliveryservice_server ON deliveryservice_server.deliveryservice = deliveryservice.id
- JOIN server ON deliveryservice_server.server = server.id
-WHERE parameter.name = 'domain_name' AND server.id IN (?)
+WHERE parameter.name = 'domain_name' AND deliveryservice_server.server = ?
ORDER BY ds_id, re_type , deliveryservice_regex.set_number
"
);
[07/50] incubator-trafficcontrol git commit: add ID to CDN
Posted by mi...@apache.org.
add ID to CDN
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/470e5619
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/470e5619
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/470e5619
Branch: refs/heads/master
Commit: 470e5619f3cdc37b0579192454392cb8bc1eab03
Parents: 8797ce4
Author: David Neuman <da...@gmail.com>
Authored: Wed Nov 30 09:01:18 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/cdn.go | 1 +
traffic_ops/client/fixtures/cdn.go | 1 +
traffic_ops/client/tests/cdn_test.go | 5 +++++
3 files changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/470e5619/traffic_ops/client/cdn.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/cdn.go b/traffic_ops/client/cdn.go
index 3657fc5..187a190 100644
--- a/traffic_ops/client/cdn.go
+++ b/traffic_ops/client/cdn.go
@@ -27,6 +27,7 @@ type CDNResponse struct {
// CDN ...
type CDN struct {
+ ID int `json:"id"`
Name string `json:"name"`
LastUpdated string `json:"lastUpdated"`
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/470e5619/traffic_ops/client/fixtures/cdn.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/cdn.go b/traffic_ops/client/fixtures/cdn.go
index e322ac5..0349cbe 100644
--- a/traffic_ops/client/fixtures/cdn.go
+++ b/traffic_ops/client/fixtures/cdn.go
@@ -22,6 +22,7 @@ func CDNs() *client.CDNResponse {
return &client.CDNResponse{
Response: []client.CDN{
client.CDN{
+ ID: 1,
Name: "CDN-1",
LastUpdated: "2016-03-22 17:00:30",
},
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/470e5619/traffic_ops/client/tests/cdn_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/cdn_test.go b/traffic_ops/client/tests/cdn_test.go
index bec59a0..ebd779f 100644
--- a/traffic_ops/client/tests/cdn_test.go
+++ b/traffic_ops/client/tests/cdn_test.go
@@ -45,6 +45,11 @@ func TestCDNs(t *testing.T) {
}
for _, cdn := range cdns {
+ if cdn.ID != 1 {
+ testHelper.Error(t, "Should get back 1 for \"ID\", got %d", cdn.ID)
+ } else {
+ testHelper.Success(t, "Should get back 1 for \"ID\"")
+ }
if cdn.Name != "CDN-1" {
testHelper.Error(t, "Should get back \"CDN-1\" for \"name\", got %s", cdn.Name)
} else {
[13/50] incubator-trafficcontrol git commit: update Profile struct to
include ID
Posted by mi...@apache.org.
update Profile struct to include ID
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/b5831f43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/b5831f43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/b5831f43
Branch: refs/heads/master
Commit: b5831f437ee04b86aa52d24640ce920c3c756dfd
Parents: 470e561
Author: David Neuman <da...@gmail.com>
Authored: Wed Nov 30 09:09:23 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/fixtures/profile.go | 1 +
traffic_ops/client/profile.go | 1 +
traffic_ops/client/tests/profile_test.go | 6 ++++++
3 files changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b5831f43/traffic_ops/client/fixtures/profile.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/profile.go b/traffic_ops/client/fixtures/profile.go
index 6ef2da5..8bf6be1 100644
--- a/traffic_ops/client/fixtures/profile.go
+++ b/traffic_ops/client/fixtures/profile.go
@@ -22,6 +22,7 @@ func Profiles() *client.ProfileResponse {
return &client.ProfileResponse{
Response: []client.Profile{
client.Profile{
+ ID: 1,
Name: "TR_CDN2",
Description: "kabletown Content Router",
LastUpdated: "2012-10-08 13:34:45",
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b5831f43/traffic_ops/client/profile.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/profile.go b/traffic_ops/client/profile.go
index a770780..90f3f4d 100644
--- a/traffic_ops/client/profile.go
+++ b/traffic_ops/client/profile.go
@@ -24,6 +24,7 @@ type ProfileResponse struct {
// Profile ...
type Profile struct {
+ ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
LastUpdated string `json:"lastUpdated"`
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b5831f43/traffic_ops/client/tests/profile_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/profile_test.go b/traffic_ops/client/tests/profile_test.go
index 3b9cc7f..7c89897 100644
--- a/traffic_ops/client/tests/profile_test.go
+++ b/traffic_ops/client/tests/profile_test.go
@@ -51,6 +51,12 @@ func TestProfile(t *testing.T) {
}
for _, p := range profiles {
+ if p.ID != 1 {
+ testHelper.Error(t, "Should get back 1 for \"ID\", got: %s", p.Name)
+ } else {
+ testHelper.Success(t, "Should get back 1 for \"ID\"")
+ }
+
if p.Name != "TR_CDN2" {
testHelper.Error(t, "Should get back \"TR_CDN2\" for \"Name\", got: %s", p.Name)
} else {
[08/50] incubator-trafficcontrol git commit: update delivery_service
to make create work
Posted by mi...@apache.org.
update delivery_service to make create work
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f7754cf6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f7754cf6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f7754cf6
Branch: refs/heads/master
Commit: f7754cf6a0e2423c5e5e6313e28dda3e03186b45
Parents: 3fa2b81
Author: David Neuman <da...@gmail.com>
Authored: Tue Nov 29 15:44:27 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/delivery_service.go | 4 ++--
traffic_ops/client/delivery_service_resources.go | 9 ++++++++-
traffic_ops/client/fixtures/delivery_service.go | 8 ++++++++
traffic_ops/client/tests/delivery_service_test.go | 4 ++--
4 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f7754cf6/traffic_ops/client/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service.go b/traffic_ops/client/delivery_service.go
index 58b0df4..d1102ab 100644
--- a/traffic_ops/client/delivery_service.go
+++ b/traffic_ops/client/delivery_service.go
@@ -40,8 +40,8 @@ func (to *Session) DeliveryService(id string) (*DeliveryService, error) {
}
// CreateDeliveryService creates the DeliveryService it's passed
-func (to *Session) CreateDeliveryService(ds *DeliveryService) (*DeliveryServiceResponse, error) {
- var data DeliveryServiceResponse
+func (to *Session) CreateDeliveryService(ds *DeliveryService) (*CreateDeliveryServiceResponse, error) {
+ var data CreateDeliveryServiceResponse
jsonReq, err := json.Marshal(ds)
if err != nil {
return nil, err
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f7754cf6/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service_resources.go b/traffic_ops/client/delivery_service_resources.go
index 53e4c8e..8d53d53 100644
--- a/traffic_ops/client/delivery_service_resources.go
+++ b/traffic_ops/client/delivery_service_resources.go
@@ -21,6 +21,12 @@ type GetDeliveryServiceResponse struct {
Response []DeliveryService `json:"response"`
}
+// CreateDeliveryServiceResponse ...
+type CreateDeliveryServiceResponse struct {
+ Response []DeliveryService `json:"response"`
+ Alerts []DeliveryServiceAlert `json:"alerts"`
+}
+
// DeliveryServiceResponse ...
type DeliveryServiceResponse struct {
Response DeliveryService `json:"response"`
@@ -67,7 +73,6 @@ type DeliveryService struct {
Protocol int `json:"protocol"`
IPV6RoutingEnabled bool `json:"ipv6RoutingEnabled"`
RangeRequestHandling int `json:"rangeRequestHandling"`
- HeaderRewrite string `json:"headerRewrite"`
EdgeHeaderRewrite string `json:"edgeHeaderRewrite"`
MidHeaderRewrite string `json:"midHeaderRewrite"`
TRResponseHeaders string `json:"trResponseHeaders"`
@@ -78,6 +83,8 @@ type DeliveryService struct {
DisplayName string `json:"displayName"`
InitialDispersion int `json:"initialDispersion"`
MatchList []DeliveryServiceMatch `json:"matchList,omitempty"`
+ RegionalGeoBlocking bool `json:"regionalGeoBlocking"`
+ LogsEnabled bool `json:"logsEnabled"`
}
// DeliveryServiceMatch ...
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f7754cf6/traffic_ops/client/fixtures/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/delivery_service.go b/traffic_ops/client/fixtures/delivery_service.go
index f9996dd..80fb96d 100644
--- a/traffic_ops/client/fixtures/delivery_service.go
+++ b/traffic_ops/client/fixtures/delivery_service.go
@@ -68,6 +68,14 @@ func DeliveryService() *client.DeliveryServiceResponse {
}
}
+// CreateDeliveryService returns a default CreateDeliveryServiceResponse to be used for testing.
+func CreateDeliveryService() *client.CreateDeliveryServiceResponse {
+ return &client.CreateDeliveryServiceResponse{
+ Response: DeliveryServices().Response,
+ Alerts: alerts(),
+ }
+}
+
// DeleteDeliveryService returns a default DeleteDeliveryServiceResponse to be used for testing.
func DeleteDeliveryService() *client.DeleteDeliveryServiceResponse {
return &client.DeleteDeliveryServiceResponse{
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f7754cf6/traffic_ops/client/tests/delivery_service_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/delivery_service_test.go b/traffic_ops/client/tests/delivery_service_test.go
index bf182e4..f52a4a3 100644
--- a/traffic_ops/client/tests/delivery_service_test.go
+++ b/traffic_ops/client/tests/delivery_service_test.go
@@ -139,7 +139,7 @@ func TestDeliveryServiceUnauthorized(t *testing.T) {
}
func TestCreateDeliveryService(t *testing.T) {
- resp := fixtures.DeliveryService()
+ resp := fixtures.CreateDeliveryService()
server := testHelper.ValidHTTPServer(resp)
defer server.Close()
@@ -158,7 +158,7 @@ func TestCreateDeliveryService(t *testing.T) {
testHelper.Success(t, "Should be able to make a request to Traffic Ops")
}
- actual := ds.Response.ID
+ actual := ds.Response[0].ID
if actual != 001 {
testHelper.Error(t, "Should get back \"001\" for \"Response.ID\", got: %s", actual)
} else {
[39/50] incubator-trafficcontrol git commit: removes dead routes
Posted by mi...@apache.org.
removes dead routes
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/aeaac367
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/aeaac367
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/aeaac367
Branch: refs/heads/master
Commit: aeaac367747e0d9f2dc8d6678b75375feeee8b85
Parents: a49530c
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Thu Dec 8 12:51:17 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/lib/TrafficOpsRoutes.pm | 6 ------
1 file changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/aeaac367/traffic_ops/app/lib/TrafficOpsRoutes.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/TrafficOpsRoutes.pm b/traffic_ops/app/lib/TrafficOpsRoutes.pm
index 3193232..bad6232 100644
--- a/traffic_ops/app/lib/TrafficOpsRoutes.pm
+++ b/traffic_ops/app/lib/TrafficOpsRoutes.pm
@@ -102,12 +102,6 @@ sub ui_routes {
# -- Configfiles
$r->route('/genfiles/:mode/:id/#filename')->via('GET')->over( authenticated => 1 )->to( 'ConfigFiles#genfiles', namespace => $namespace );
- $r->route('/genfiles/:mode/byprofile/:profile/CRConfig.xml')->via('GET')->over( authenticated => 1 )
- ->to( 'ConfigFiles#genfiles_crconfig_profile', namespace => $namespace );
- $r->route('/genfiles/:mode/bycdnname/:cdnname/CRConfig.xml')->via('GET')->over( authenticated => 1 )
- ->to( 'ConfigFiles#genfiles_crconfig_cdnname', namespace => $namespace );
- $r->route('/snapshot_crconfig')->via( 'GET', 'POST' )->over( authenticated => 1 )->to( 'ConfigFiles#snapshot_crconfig', namespace => $namespace );
- $r->post('/upload_ccr_compare')->over( authenticated => 1 )->to( 'ConfigFiles#diff_ccr_xml_file', namespace => $namespace );
# -- Asn
$r->get('/asns')->over( authenticated => 1 )->to( 'Asn#index', namespace => $namespace );
[14/50] incubator-trafficcontrol git commit: added tests for all
deliveryservice methods
Posted by mi...@apache.org.
added tests for all deliveryservice methods
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/940d621a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/940d621a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/940d621a
Branch: refs/heads/master
Commit: 940d621a03a75323f2e0e3e01e3b8088dd42d233
Parents: b999e81
Author: David Neuman <da...@gmail.com>
Authored: Thu Dec 1 15:22:17 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
.../client/delivery_service_resources.go | 1 +
traffic_ops/client/fixtures/delivery_service.go | 4 +-
.../tests/integration/deliveryservice_test.go | 563 ++++++++++++++++---
.../tests/integration/integration_helper.go | 25 +
4 files changed, 520 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/940d621a/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service_resources.go b/traffic_ops/client/delivery_service_resources.go
index e7bde2a..32f2ff3 100644
--- a/traffic_ops/client/delivery_service_resources.go
+++ b/traffic_ops/client/delivery_service_resources.go
@@ -94,6 +94,7 @@ type DeliveryService struct {
MatchList []DeliveryServiceMatch `json:"matchList,omitempty"`
RegionalGeoBlocking bool `json:"regionalGeoBlocking"`
LogsEnabled bool `json:"logsEnabled"`
+ ExampleURLs []string `json:"exampleURLs"`
}
// DeliveryServiceMatch ...
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/940d621a/traffic_ops/client/fixtures/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/delivery_service.go b/traffic_ops/client/fixtures/delivery_service.go
index 97675ab..2408cb6 100644
--- a/traffic_ops/client/fixtures/delivery_service.go
+++ b/traffic_ops/client/fixtures/delivery_service.go
@@ -177,9 +177,9 @@ func DeliveryServiceServer() *client.DeliveryServiceServerResponse {
return &client.DeliveryServiceServerResponse{
Response: []client.DeliveryServiceServer{dss},
- Page: 1,
+ Size: "1",
OrderBy: "foo",
- Limit: 1,
+ Limit: "1",
}
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/940d621a/traffic_ops/client/tests/integration/deliveryservice_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/deliveryservice_test.go b/traffic_ops/client/tests/integration/deliveryservice_test.go
index c224cdf..bffa769 100644
--- a/traffic_ops/client/tests/integration/deliveryservice_test.go
+++ b/traffic_ops/client/tests/integration/deliveryservice_test.go
@@ -2,14 +2,114 @@ package integration
import (
"encoding/json"
+ "fmt"
+ "net/url"
+ "os"
"strconv"
+ "strings"
"testing"
"time"
traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
)
-// TestDeliveryServices compares the results of the Deliveryservices api and Deliveryservices client
+var (
+ testDs traffic_ops.DeliveryService
+ testDsID string
+ existingTestDS traffic_ops.DeliveryService
+ existingTestDSID string
+ sslDs traffic_ops.DeliveryService
+)
+
+func init() {
+ cdn, err := GetCdn()
+ if err != nil {
+ fmt.Printf("Deliverservice_test init -- Could not get CDNs from TO...%v\n", err)
+ os.Exit(1)
+ }
+
+ profile, err := GetProfile()
+ if err != nil {
+ fmt.Printf("Deliverservice_test init -- Could not get Profiles from TO...%v\n", err)
+ os.Exit(1)
+ }
+
+ dsType, err := GetType("deliveryservice")
+ if err != nil {
+ fmt.Printf("Deliverservice_test init -- Could not get Types from TO...%v\n", err)
+ os.Exit(1)
+ }
+
+ // existingTestDS, err := GetDeliveryService()
+ // if err != nil {
+ // fmt.Printf("Deliverservice_test init -- Could not get Deliveryservices from TO...%v\n", err)
+ // os.Exit(1)
+ // }
+ // existingTestDSID = strconv.Itoa(existingTestDS.ID)
+
+ //create DeliveryService object for testing
+ testDs.Active = false
+ testDs.CCRDNSTTL = 30
+ testDs.CDNName = cdn.Name
+ testDs.CDNID = cdn.ID
+ testDs.CacheURL = "cacheURL"
+ testDs.CheckPath = "CheckPath"
+ testDs.DNSBypassCname = "DNSBypassCNAME"
+ testDs.DNSBypassIP = "10.10.10.10"
+ testDs.DNSBypassIP6 = "FF01:0:0:0:0:0:0:FB"
+ testDs.DNSBypassTTL = 30
+ testDs.DSCP = 0
+ testDs.DisplayName = "DisplayName"
+ testDs.EdgeHeaderRewrite = "EdgeHeaderRewrite"
+ testDs.GeoLimit = 5
+ testDs.GeoProvider = 1
+ testDs.GlobalMaxMBPS = 15000
+ testDs.GlobalMaxTPS = 15000
+ testDs.HTTPBypassFQDN = "HTTPBypassFQDN"
+ testDs.IPV6RoutingEnabled = true
+ testDs.InfoURL = "InfoUrl"
+ testDs.InitialDispersion = 5
+ testDs.LongDesc = "LongDesc"
+ testDs.LongDesc1 = "LongDesc1"
+ testDs.LongDesc2 = "LongDesc2"
+ testDs.MaxDNSAnswers = 5
+ testDs.MidHeaderRewrite = "MidHeaderRewrite"
+ testDs.MissLat = 5.555
+ testDs.MissLong = -50.5050
+ testDs.MultiSiteOrigin = true
+ testDs.OrgServerFQDN = "http://OrgServerFQDN"
+ testDs.ProfileDesc = profile.Description
+ testDs.ProfileName = profile.Name
+ testDs.ProfileID = profile.ID
+ testDs.Protocol = 1
+ testDs.QStringIgnore = 1
+ testDs.RangeRequestHandling = 0
+ testDs.RegexRemap = "regexRemap"
+ testDs.RemapText = "remapText"
+ testDs.Signed = false
+ testDs.TRResponseHeaders = "TRResponseHeaders"
+ testDs.Type = dsType.Name
+ testDs.TypeID = dsType.ID
+ testDs.XMLID = "Test-DS-" + strconv.FormatInt(time.Now().Unix(), 10)
+ testDs.RegionalGeoBlocking = false
+ testDs.LogsEnabled = false
+
+ //Create method currently does not support MatchList...
+ // testDsMatch1 := new(traffic_ops.DeliveryServiceMatch)
+ // testDsMatch1.Pattern = "Pattern1"
+ // testDsMatch1.SetNumber = "0"
+ // testDsMatch1.Type = "HOST"
+
+ // testDsMatch2 := new(traffic_ops.DeliveryServiceMatch)
+ // testDsMatch2.Pattern = "Pattern2"
+ // testDsMatch2.SetNumber = "1"
+ // testDsMatch2.Type = "HOST"
+
+ // testDs.MatchList = append(testDs.MatchList, *testDsMatch1)
+ // testDs.MatchList = append(testDs.MatchList, *testDsMatch2)
+
+}
+
func TestDeliveryServices(t *testing.T) {
resp, err := Request(*to, "GET", "/api/1.2/deliveryservices.json", nil)
if err != nil {
@@ -34,6 +134,15 @@ func TestDeliveryServices(t *testing.T) {
matchFound := false
for _, apiDs := range apiDss {
+ //set these to use later...this saves time over doing it in the init() method
+ if apiDs.Protocol == 0 && existingTestDS.ID == 0 {
+ existingTestDS = apiDs
+ existingTestDSID = strconv.Itoa(existingTestDS.ID)
+ }
+ if apiDs.Protocol > 0 && strings.Contains(apiDs.Type, "DNS") && sslDs.ID == 0 {
+ sslDs = apiDs
+ }
+
for _, clientDs := range clientDss {
if clientDs.XMLID != apiDs.XMLID {
continue
@@ -47,83 +156,352 @@ func TestDeliveryServices(t *testing.T) {
}
}
-var testDsID string
-
func TestCreateDs(t *testing.T) {
//create a DS and validate response
- cdn, err := GetCdn()
+ res, err := to.CreateDeliveryService(&testDs)
if err != nil {
- t.Errorf("TestCreateDs -- Could not get CDNs from TO...%v\n", err)
+ t.Error("Failed to create deliveryservice! Error is: ", err)
+ } else {
+ testDs.ID = res.Response[0].ID
+ testDsID = strconv.Itoa(testDs.ID)
+ compareDs(testDs, res.Response[0], t)
}
+}
- profile, err := GetProfile()
+func TestUpdateDs(t *testing.T) {
+ testDs.DisplayName = "New Display Name"
+ testDs.LongDesc += "-- Update"
+ testDs.LongDesc1 += "-- Update"
+ testDs.LongDesc2 += "-- Update"
+ testDs.EdgeHeaderRewrite += "-- Update"
+ res, err := to.UpdateDeliveryService(testDsID, &testDs)
if err != nil {
- t.Errorf("TestCreateDs -- Could not get Profiles from TO...%v\n", err)
- }
-
- newDs := new(traffic_ops.DeliveryService)
- newDs.Active = false
- newDs.CCRDNSTTL = 30
- newDs.CDNName = cdn.Name
- newDs.CacheURL = "cacheURL"
- newDs.CheckPath = "CheckPath"
- newDs.DNSBypassCname = "DNSBypassCNAME"
- newDs.DNSBypassIP = "10.10.10.10"
- newDs.DNSBypassIP6 = "FF01:0:0:0:0:0:0:FB"
- newDs.DNSBypassTTL = 30
- newDs.DSCP = 0
- newDs.DisplayName = "DisplayName"
- newDs.EdgeHeaderRewrite = "EdgeHeaderRewrite"
- newDs.GeoLimit = 5
- newDs.GeoProvider = 1
- newDs.GlobalMaxMBPS = 15000
- newDs.GlobalMaxTPS = 15000
- newDs.HTTPBypassFQDN = "HTTPBypassFQDN"
- newDs.IPV6RoutingEnabled = true
- newDs.InfoURL = "InfoUrl"
- newDs.InitialDispersion = 5
- newDs.LongDesc = "LongDesc"
- newDs.LongDesc1 = "LongDesc1"
- newDs.LongDesc2 = "LongDesc2"
- newDs.MaxDNSAnswers = 5
- newDs.MidHeaderRewrite = "MidHeaderRewrite"
- newDs.MissLat = 5.555
- newDs.MissLong = -50.5050
- newDs.MultiSiteOrigin = true
- newDs.OrgServerFQDN = "http://OrgServerFQDN"
- newDs.ProfileDesc = profile.Description
- newDs.ProfileName = profile.Name
- newDs.Protocol = 1
- newDs.QStringIgnore = 1
- newDs.RangeRequestHandling = 0
- newDs.RegexRemap = "regexRemap"
- newDs.RemapText = "remapText"
- newDs.Signed = false
- newDs.TRResponseHeaders = "TRResponseHeaders"
- newDs.Type = "HTTP"
- newDs.XMLID = "Test-DS-" + strconv.FormatInt(time.Now().Unix(), 10)
- newDs.RegionalGeoBlocking = false
- newDs.LogsEnabled = false
-
- //Create currently does not write regexes...
- // newDsMatch1 := new(traffic_ops.DeliveryServiceMatch)
- // newDsMatch1.Pattern = "Pattern1"
- // newDsMatch1.SetNumber = "0"
- // newDsMatch1.Type = "HOST"
-
- // newDsMatch2 := new(traffic_ops.DeliveryServiceMatch)
- // newDsMatch2.Pattern = "Pattern2"
- // newDsMatch2.SetNumber = "1"
- // newDsMatch2.Type = "HOST"
-
- // newDs.MatchList = append(newDs.MatchList, *newDsMatch1)
- // newDs.MatchList = append(newDs.MatchList, *newDsMatch2)
-
- res, err := to.CreateDeliveryService(newDs)
+ t.Error("Failed to update deliveryservice! Error is: ", err)
+ } else {
+ compareDs(testDs, res.Response[0], t)
+ }
+}
+
+func TestDeliveryService(t *testing.T) {
+ uri := fmt.Sprintf("/api/1.2/deliveryservices/%s.json", testDsID)
+ resp, err := Request(*to, "GET", uri, nil)
if err != nil {
- t.Error("Failed to create deliveryservice! Error is: ", err)
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ }
+
+ defer resp.Body.Close()
+ var apiDsRes traffic_ops.GetDeliveryServiceResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiDsRes); err != nil {
+ t.Errorf("Could not decode Deliveryservice json. Error is: %v\n", err)
+ }
+
+ clientDss, err := to.DeliveryService(testDsID)
+ if err != nil {
+ t.Errorf("Could not get Deliveryservice from client. Error is: %v\n", err)
+ }
+
+ compareDs(apiDsRes.Response[0], *clientDss, t)
+}
+
+//Put this Test after anything using the testDS or testDsID variables
+func TestDeleteDeliveryService(t *testing.T) {
+ res, err := to.DeleteDeliveryService(testDsID)
+ if err != nil {
+ t.Errorf("Could not delete Deliveryserivce %s reponse was: %v\n", testDsID, err)
+ }
+ if res.Alerts[0].Level != "success" {
+ t.Errorf("Alert.Level -- Expected \"success\" got %s", res.Alerts[0].Level)
+ }
+ if res.Alerts[0].Text != "Delivery service was deleted." {
+ t.Errorf("Alert.Level -- Expected \"Delivery service was deleted.\" got %s", res.Alerts[0].Text)
+ }
+}
+
+func TestDeliveryServiceState(t *testing.T) {
+ uri := fmt.Sprintf("/api/1.2/deliveryservices/%s/state.json", existingTestDSID)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ }
+
+ defer resp.Body.Close()
+ var apiDsStateRes traffic_ops.DeliveryServiceStateResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiDsStateRes); err != nil {
+ t.Errorf("Could not decode DeliveryserviceState reponse. Error is: %v\n", err)
+ }
+
+ apiDsState := apiDsStateRes.Response
+
+ clientDsState, err := to.DeliveryServiceState(existingTestDSID)
+ if err != nil {
+ t.Errorf("Could not get DS State from client for %s reponse was: %v\n", existingTestDSID, err)
+ }
+
+ if apiDsState.Enabled != clientDsState.Enabled {
+ t.Errorf("Enabled -- Expected %v got %v for ID %s", apiDsState.Enabled, clientDsState.Enabled, existingTestDSID)
+ }
+ if apiDsState.Failover.Configured != clientDsState.Failover.Configured {
+ t.Errorf("Failover.Configured -- Expected %v got %v", apiDsState.Failover.Configured, clientDsState.Failover.Configured)
+ }
+ if apiDsState.Failover.Destination.Location != clientDsState.Failover.Destination.Location {
+ t.Errorf("Failover.Destination.Location -- Expected %v got %v", apiDsState.Failover.Destination.Location, clientDsState.Failover.Destination.Location)
+ }
+ if apiDsState.Failover.Destination.Type != clientDsState.Failover.Destination.Type {
+ t.Errorf("Failover.Destination.Type -- Expected %v got %v", apiDsState.Failover.Destination.Type, clientDsState.Failover.Destination.Type)
+ }
+ if apiDsState.Failover.Enabled != clientDsState.Failover.Enabled {
+ t.Errorf("res.Failover.Enabled -- Expected %v got %v", apiDsState.Failover.Enabled, clientDsState.Failover.Enabled)
+ }
+ if len(apiDsState.Failover.Locations) != len(clientDsState.Failover.Locations) {
+ t.Errorf("res.Failover.Locations len -- Expected %v got %v", len(apiDsState.Failover.Locations), len(clientDsState.Failover.Locations))
+ }
+}
+
+func TestDeliveryServiceHealth(t *testing.T) {
+ uri := fmt.Sprintf("/api/1.2/deliveryservices/%s/health.json", existingTestDSID)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ }
+
+ defer resp.Body.Close()
+ var apiDsHealthRes traffic_ops.DeliveryServiceHealthResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiDsHealthRes); err != nil {
+ t.Errorf("Could not decode DeliveryserviceHealth reponse. Error is: %v\n", err)
+ }
+
+ apiDsHealth := apiDsHealthRes.Response
+
+ clientDsHealth, err := to.DeliveryServiceHealth(existingTestDSID)
+ if err != nil {
+ t.Errorf("Could not ge Deliveryserivce Health for %s reponse was: %v\n", existingTestDSID, err)
+ }
+
+ if apiDsHealth.TotalOnline != clientDsHealth.TotalOnline {
+ t.Errorf("TotalOnline -- Expected %v got %v", apiDsHealth.TotalOnline, apiDsHealth.TotalOnline)
+ }
+
+ if apiDsHealth.TotalOffline != clientDsHealth.TotalOffline {
+ t.Errorf("TotalOffline -- Expected %v got %v", apiDsHealth.TotalOffline, clientDsHealth.TotalOffline)
+ }
+
+ if len(apiDsHealth.CacheGroups) != len(clientDsHealth.CacheGroups) {
+ t.Errorf("len Cachegroups -- Expected %v got %v", len(apiDsHealth.CacheGroups), len(clientDsHealth.CacheGroups))
+ }
+
+ for _, apiCg := range apiDsHealth.CacheGroups {
+ match := false
+ for _, clientCg := range clientDsHealth.CacheGroups {
+ if apiCg.Name != clientCg.Name {
+ continue
+ }
+ match = true
+ if apiCg.Offline != clientCg.Offline {
+ t.Errorf("Cachegroup.Offline -- Expected %v got %v", apiCg.Offline, clientCg.Offline)
+ }
+ if apiCg.Online != clientCg.Online {
+ t.Errorf("Cachegroup.Online -- Expected %v got %v", apiCg.Online, clientCg.Online)
+ }
+ }
+ if !match {
+ t.Errorf("Cachegroup -- No match from client for api cachgroup %v", apiCg.Name)
+ }
+ }
+}
+
+func TestDeliveryServiceCapacity(t *testing.T) {
+ uri := fmt.Sprintf("/api/1.2/deliveryservices/%s/capacity.json", existingTestDSID)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ }
+
+ defer resp.Body.Close()
+ var apiDsCapacityRes traffic_ops.DeliveryServiceCapacityResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiDsCapacityRes); err != nil {
+ t.Errorf("Could not decode DeliveryserviceCapacity reponse. Error is: %v\n", err)
+ }
+
+ apiDsCapacity := apiDsCapacityRes.Response
+
+ clientDsCapacity, err := to.DeliveryServiceCapacity(existingTestDSID)
+ if err != nil {
+ t.Errorf("Could not ge Deliveryserivce Capacity for %s reponse was: %v\n", existingTestDSID, err)
+ }
+
+ if apiDsCapacity.AvailablePercent != clientDsCapacity.AvailablePercent {
+ t.Errorf("AvailablePercent -- Expected %v got %v", apiDsCapacity.AvailablePercent, clientDsCapacity.AvailablePercent)
+ }
+
+ if fmt.Sprintf("%6.5f", apiDsCapacity.MaintenancePercent) != fmt.Sprintf("%6.5f", clientDsCapacity.MaintenancePercent) {
+ t.Errorf("MaintenenancePercent -- Expected %v got %v", apiDsCapacity.MaintenancePercent, clientDsCapacity.MaintenancePercent)
+ }
+
+ if apiDsCapacity.UnavailablePercent != clientDsCapacity.UnavailablePercent {
+ t.Errorf("UnavailablePercent -- Expected %v got %v", apiDsCapacity.UnavailablePercent, clientDsCapacity.UnavailablePercent)
+ }
+
+ if fmt.Sprintf("%6.5f", apiDsCapacity.UtilizedPercent) != fmt.Sprintf("%6.5f", clientDsCapacity.UtilizedPercent) {
+ t.Errorf("UtilizedPercent -- Expected %v got %v", apiDsCapacity.UtilizedPercent, clientDsCapacity.UtilizedPercent)
+ }
+
+}
+
+func TestDeliveryServiceRouting(t *testing.T) {
+ uri := fmt.Sprintf("/api/1.2/deliveryservices/%s/routing.json", existingTestDSID)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ }
+
+ defer resp.Body.Close()
+ var apiDsRoutingRes traffic_ops.DeliveryServiceRoutingResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiDsRoutingRes); err != nil {
+ t.Errorf("Could not decode DeliveryserviceRouting reponse. Error is: %v\n", err)
+ }
+
+ apiDsRouting := apiDsRoutingRes.Response
+
+ clientDsRouting, err := to.DeliveryServiceRouting(existingTestDSID)
+ if err != nil {
+ t.Errorf("Could not ge Deliveryserivce Routing for %s reponse was: %v\n", existingTestDSID, err)
+ }
+
+ if apiDsRouting.CZ != clientDsRouting.CZ {
+ t.Errorf("CZ -- Expected %v got %v", apiDsRouting.CZ, clientDsRouting.CZ)
+ }
+
+ if apiDsRouting.DSR != clientDsRouting.DSR {
+ t.Errorf("DSR -- Expected %v got %v", apiDsRouting.DSR, clientDsRouting.DSR)
+ }
+
+ if apiDsRouting.Err != clientDsRouting.Err {
+ t.Errorf("Err-- Expected %v got %v", apiDsRouting.Err, clientDsRouting.Err)
+ }
+
+ if apiDsRouting.Fed != clientDsRouting.Fed {
+ t.Errorf("Fed -- Expected %v got %v", apiDsRouting.Fed, clientDsRouting.Fed)
+ }
+
+ if apiDsRouting.Geo != clientDsRouting.Geo {
+ t.Errorf("Geo -- Expected %v got %v", apiDsRouting.Geo, clientDsRouting.Geo)
+ }
+
+ if apiDsRouting.Miss != clientDsRouting.Miss {
+ t.Errorf("Miss -- Expected %v got %v", apiDsRouting.Miss, clientDsRouting.Miss)
+ }
+
+ if apiDsRouting.RegionalAlternate != clientDsRouting.RegionalAlternate {
+ t.Errorf("RegionalAlternate -- Expected %v got %v", apiDsRouting.RegionalAlternate, clientDsRouting.RegionalAlternate)
+ }
+
+ if apiDsRouting.RegionalDenied != clientDsRouting.RegionalDenied {
+ t.Errorf("RegionalDenied -- Expected %v got %v", apiDsRouting.RegionalDenied, clientDsRouting.RegionalDenied)
+ }
+}
+
+func TestDeliveryServiceServer(t *testing.T) {
+ resp, err := Request(*to, "GET", "/api/1.2/deliveryserviceserver.json?page=1&limit=1", nil)
+ if err != nil {
+ t.Errorf("Could not get deliveryserviceserver.json reponse was: %v\n", err)
+ }
+
+ defer resp.Body.Close()
+ var apiDsServerRes traffic_ops.DeliveryServiceServerResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiDsServerRes); err != nil {
+ t.Errorf("Could not decode DeliveryserviceServer reponse. Error is: %v\n", err)
+ }
+
+ clientDsServerRes, err := to.DeliveryServiceServer("1", "1")
+
+ if err != nil {
+ t.Errorf("Could not get DeliveryserviceServer, reponse was: %v\n", err)
+ }
+
+ for _, apiDss := range apiDsServerRes.Response {
+ match := false
+ for _, clientDss := range clientDsServerRes {
+ if clientDss.DeliveryService != apiDss.DeliveryService {
+ continue
+ }
+ match = true
+ if apiDss.LastUpdated != clientDss.LastUpdated {
+ t.Errorf("LastUpdated -- Expected %v got %v", apiDss.LastUpdated, clientDss.LastUpdated)
+ }
+ if apiDss.Server != clientDss.Server {
+ t.Errorf("Server -- Expected %v got %v", apiDss.Server, clientDss.Server)
+ }
+ }
+ if match != true {
+ t.Errorf("No match found for the Deliveryservice %v in DeliveryserviceServer response: %v\n", apiDss.DeliveryService, err)
+ }
+ }
+
+}
+
+func TestDeliveryServiceSSLKeysByID(t *testing.T) {
+ if sslDs.ID > 0 {
+ uri := fmt.Sprintf("/api/1.2/deliveryservices/xmlId/%s/sslkeys.json", sslDs.XMLID)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ }
+
+ defer resp.Body.Close()
+ var apiSslRes traffic_ops.DeliveryServiceSSLKeysResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiSslRes); err != nil {
+ t.Errorf("Could not decode DeliveryServiceSSLKeysResponse reponse. Error is: %v\n", err)
+ }
+
+ clientSslRes, err := to.DeliveryServiceSSLKeysByID(sslDs.XMLID)
+
+ if err != nil {
+ t.Errorf("Could not get DeliveryserviceSSLKeys, reponse was: %v\n", err)
+ }
+ compareSSLResponse(apiSslRes.Response, *clientSslRes, t)
} else {
- compareDs(*newDs, res.Response[0], t)
+ t.Skip("Skipping TestDeliveryServiceSSLKeysByID because no Deliveryservice was found with SSL enabled")
+ }
+}
+
+func TestDeliveryServiceSSLKeysByHostname(t *testing.T) {
+ if sslDs.ID > 0 {
+ var hostname string
+ for _, exampleURL := range sslDs.ExampleURLs {
+ if strings.Contains(exampleURL, "edge.") {
+ u, err := url.Parse(exampleURL)
+ if err != nil {
+ t.Errorf("could not parse exampleURL %s\n", exampleURL)
+ t.FailNow()
+ }
+ hostname = u.Host
+ }
+ }
+ if hostname == "" {
+ t.Skipf("could not find an example URL from Deliveryservice %s to use for testing\n", sslDs.XMLID)
+ t.SkipNow()
+ }
+
+ uri := fmt.Sprintf("/api/1.2/deliveryservices/hostname/%s/sslkeys.json", hostname)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ }
+
+ defer resp.Body.Close()
+ var apiSslRes traffic_ops.DeliveryServiceSSLKeysResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiSslRes); err != nil {
+ t.Errorf("Could not decode DeliveryServiceSSLKeysResponse reponse. Error is: %v\n", err)
+ }
+
+ clientSslRes, err := to.DeliveryServiceSSLKeysByHostname(hostname)
+
+ if err != nil {
+ t.Errorf("Could not get DeliveryserviceSSLKeys, reponse was: %v\n", err)
+ }
+ compareSSLResponse(apiSslRes.Response, *clientSslRes, t)
+ } else {
+ t.Skip("Skipping TestDeliveryServiceSSLKeysByID because no Deliveryservice was found with SSL enabled")
}
}
@@ -137,6 +515,9 @@ func compareDs(ds1 traffic_ops.DeliveryService, ds2 traffic_ops.DeliveryService,
if ds1.CDNName != ds2.CDNName {
t.Errorf("CDNName -- Expected %v, Got %v\n", ds1.CDNName, ds2.CDNName)
}
+ if ds1.CDNID != ds2.CDNID {
+ t.Errorf("CDNID -- Expected %v, Got %v\n", ds1.CDNID, ds2.CDNID)
+ }
if ds1.CacheURL != ds2.CacheURL {
t.Errorf("CacheURL -- Expected %v, Got %v\n", ds1.CacheURL, ds2.CacheURL)
}
@@ -191,7 +572,7 @@ func compareDs(ds1 traffic_ops.DeliveryService, ds2 traffic_ops.DeliveryService,
if ds1.InitialDispersion != ds2.InitialDispersion {
t.Errorf("InitialDispersion -- Expected %v, Got %v\n", ds1.InitialDispersion, ds2.InitialDispersion)
}
- if ds1.LastUpdated != ds2.LastUpdated {
+ if ds1.LastUpdated != "" && ds1.LastUpdated != ds2.LastUpdated {
t.Errorf("LastUpdated -- Expected %v, Got %v\n", ds1.LastUpdated, ds2.LastUpdated)
}
if ds1.LongDesc != ds2.LongDesc {
@@ -264,4 +645,44 @@ func compareDs(ds1 traffic_ops.DeliveryService, ds2 traffic_ops.DeliveryService,
}
}
}
+ if len(ds1.ExampleURLs) > 0 {
+ for i, url := range ds1.ExampleURLs {
+ if url != ds2.ExampleURLs[i] {
+ t.Errorf("ExampleURL -- Expected %v, Got %v\n", url, ds2.ExampleURLs[i])
+ }
+ }
+ }
+}
+
+func compareSSLResponse(apiSslRes traffic_ops.DeliveryServiceSSLKeys, clientSslRes traffic_ops.DeliveryServiceSSLKeys, t *testing.T) {
+ if apiSslRes.BusinessUnit != clientSslRes.BusinessUnit {
+ t.Errorf("BusinessUnit -- Expected %v got %v", apiSslRes.BusinessUnit, clientSslRes.BusinessUnit)
+ }
+ if apiSslRes.CDN != clientSslRes.CDN {
+ t.Errorf("CDN -- Expected %v got %v", apiSslRes.CDN, clientSslRes.CDN)
+ }
+ if apiSslRes.Certificate.CSR != clientSslRes.Certificate.CSR {
+ t.Errorf("CSR -- Expected %v got %v", apiSslRes.Certificate.CSR, clientSslRes.Certificate.CSR)
+ }
+ if apiSslRes.Certificate.Crt != clientSslRes.Certificate.Crt {
+ t.Errorf("CRT -- Expected %v got %v", apiSslRes.Certificate.Crt, clientSslRes.Certificate.Crt)
+ }
+ if apiSslRes.Certificate.Key != clientSslRes.Certificate.Key {
+ t.Errorf("Key -- Expected %v got %v", apiSslRes.Certificate.Key, clientSslRes.Certificate.Key)
+ }
+ if apiSslRes.City != clientSslRes.City {
+ t.Errorf("City -- Expected %v got %v", apiSslRes.City, clientSslRes.City)
+ }
+ if apiSslRes.Country != clientSslRes.Country {
+ t.Errorf("Country -- Expected %v got %v", apiSslRes.Country, clientSslRes.Country)
+ }
+ if apiSslRes.DeliveryService != clientSslRes.DeliveryService {
+ t.Errorf("DeliveryService -- Expected %v got %v", apiSslRes.DeliveryService, clientSslRes.DeliveryService)
+ }
+ if apiSslRes.Hostname != clientSslRes.Hostname {
+ t.Errorf("Hostname -- Expected %v got %v", apiSslRes.Hostname, clientSslRes.Hostname)
+ }
+ if apiSslRes.Organization != clientSslRes.Organization {
+ t.Errorf("Organization -- Expected %v got %v", apiSslRes.Organization, clientSslRes.Organization)
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/940d621a/traffic_ops/client/tests/integration/integration_helper.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/integration_helper.go b/traffic_ops/client/tests/integration/integration_helper.go
index 73f6370..675934d 100644
--- a/traffic_ops/client/tests/integration/integration_helper.go
+++ b/traffic_ops/client/tests/integration/integration_helper.go
@@ -2,6 +2,7 @@ package integration
import (
"bytes"
+ "errors"
"flag"
"fmt"
"net/http"
@@ -49,6 +50,30 @@ func GetProfile() (traffic_ops.Profile, error) {
return profiles[0], nil
}
+//GetType returns a Type Struct
+func GetType(useInTable string) (traffic_ops.Type, error) {
+ types, err := to.Types()
+ if err != nil {
+ return *new(traffic_ops.Type), err
+ }
+ for _, myType := range types {
+ if myType.UseInTable == useInTable {
+ return myType, nil
+ }
+ }
+ nfErr := fmt.Sprintf("No Types found for useInTable %s\n", useInTable)
+ return *new(traffic_ops.Type), errors.New(nfErr)
+}
+
+//GetDeliveryService returns a DeliveryService Struct
+func GetDeliveryService() (traffic_ops.DeliveryService, error) {
+ dss, err := to.DeliveryServices()
+ if err != nil {
+ return *new(traffic_ops.DeliveryService), err
+ }
+ return dss[0], nil
+}
+
//Request sends a request to TO and returns a response.
//This is basically a copy of the private "request" method in the traffic_ops.go \
//but I didn't want to make that one public.
[46/50] incubator-trafficcontrol git commit: fixtures fixes
Posted by mi...@apache.org.
fixtures fixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/b8445d94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/b8445d94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/b8445d94
Branch: refs/heads/master
Commit: b8445d940fdfe999c36fd0968313cf6e6a3f5262
Parents: a964b50
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Jan 9 11:12:42 2017 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Mon Jan 9 11:12:42 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/lib/Fixtures/Asn.pm | 1 +
traffic_ops/app/lib/Fixtures/Profile.pm | 6 ------
2 files changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b8445d94/traffic_ops/app/lib/Fixtures/Asn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Asn.pm b/traffic_ops/app/lib/Fixtures/Asn.pm
index 8d12bb9..b2f5e07 100644
--- a/traffic_ops/app/lib/Fixtures/Asn.pm
+++ b/traffic_ops/app/lib/Fixtures/Asn.pm
@@ -22,6 +22,7 @@ my %definition_for = (
test_cran_1 => {
new => 'Asn',
using => {
+ id => 1,
asn => 9939,
cachegroup => 1,
},
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b8445d94/traffic_ops/app/lib/Fixtures/Profile.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Fixtures/Profile.pm b/traffic_ops/app/lib/Fixtures/Profile.pm
index e321029..f14f629 100644
--- a/traffic_ops/app/lib/Fixtures/Profile.pm
+++ b/traffic_ops/app/lib/Fixtures/Profile.pm
@@ -66,12 +66,6 @@ my %definition_for = (
description => 'rascal2 description',
},
},
- ## id => 6
- RIAK1 => {
- new => 'Profile',
- using => {
- name => 'RIAK1',
- description => 'riak description',
MISC => {
new => 'Profile',
using => {
[35/50] incubator-trafficcontrol git commit: avoid race condition
between dataimport and mysql
Posted by mi...@apache.org.
avoid race condition between dataimport and mysql
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c2d55a18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c2d55a18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c2d55a18
Branch: refs/heads/master
Commit: c2d55a18bf979af6e68aab96467557c12004057c
Parents: d5552db
Author: Dan Kirkwood <da...@gmail.com>
Authored: Tue Dec 13 17:36:41 2016 +0000
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700
----------------------------------------------------------------------
.../app/db/pg-migration/Dockerfile-mysql | 19 ++++++++++++++
.../app/db/pg-migration/docker-compose.yml | 8 +++---
traffic_ops/app/db/pg-migration/get-to-data.sh | 10 ++++++++
traffic_ops/app/db/pg-migration/mysql.env | 1 +
traffic_ops/app/db/pg-migration/mysql_host.yml | 4 ++-
traffic_ops/app/db/pg-migration/postgres.env | 2 +-
traffic_ops/app/db/pg-migration/runmysql.sh | 27 ++++++++++++++++++++
7 files changed, 64 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55a18/traffic_ops/app/db/pg-migration/Dockerfile-mysql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-mysql b/traffic_ops/app/db/pg-migration/Dockerfile-mysql
new file mode 100644
index 0000000..a4bf51f
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-mysql
@@ -0,0 +1,19 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+FROM mysql:5.6
+
+MAINTAINER Dan Kirkwood
+
+ADD runmysql.sh /
+CMD /runmysql.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55a18/traffic_ops/app/db/pg-migration/docker-compose.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/docker-compose.yml b/traffic_ops/app/db/pg-migration/docker-compose.yml
index b611f75..a9d9d85 100644
--- a/traffic_ops/app/db/pg-migration/docker-compose.yml
+++ b/traffic_ops/app/db/pg-migration/docker-compose.yml
@@ -23,9 +23,8 @@ services:
service: dataimport
file: dataimport.yml
volumes:
- - ./mysql/initdb.d:/docker-entrypoint-initdb.d
- volumes:
- sync:/sync
+ - ./mysql/initdb.d:/docker-entrypoint-initdb.d
# mysql_host loads mysql data locally and provides direct access for pgloader
mysql:
@@ -51,11 +50,10 @@ services:
depends_on:
- mysql
volumes:
- - /opt/traffic_ops-db:/var/lib/postgresql/data
+ - sync:/sync
+ - ./db:/var/lib/postgresql/data
ports:
- 5432
- volumes:
- - sync:/sync
# pgloader converts the data from mysql to postgres
pgloader:
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55a18/traffic_ops/app/db/pg-migration/get-to-data.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/get-to-data.sh b/traffic_ops/app/db/pg-migration/get-to-data.sh
index c1be98a..fd9f739 100755
--- a/traffic_ops/app/db/pg-migration/get-to-data.sh
+++ b/traffic_ops/app/db/pg-migration/get-to-data.sh
@@ -26,3 +26,13 @@ CREDS
curl -k -H "Accept: application/json" --cookie "$cookiejar" --cookie-jar "$cookiejar" -X POST --data @"$cred" "$TO_SERVER/api/1.2/user/login"
curl $output -k -s --cookie "$cookiejar" -X GET "$TO_SERVER/dbdump"
+
+waiting=/sync/waiting-for-dataimport
+while [[ ! -f $waiting ]]; do
+ # wait for signal that other container is waiting
+ echo "Data import finished.."
+ sleep 3
+done
+
+# signal to waiting container that we're finished
+rm $waiting
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55a18/traffic_ops/app/db/pg-migration/mysql.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql.env b/traffic_ops/app/db/pg-migration/mysql.env
index b6cba06..de12f7d 100644
--- a/traffic_ops/app/db/pg-migration/mysql.env
+++ b/traffic_ops/app/db/pg-migration/mysql.env
@@ -1,4 +1,5 @@
MYSQL_DATABASE=traffic_ops_db
+MYSQL_HOST=mysql
MYSQL_RANDOM_ROOT_PASSWORD=yes
MYSQL_PASSWORD=twelve
MYSQL_USER=to_user
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55a18/traffic_ops/app/db/pg-migration/mysql_host.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql_host.yml b/traffic_ops/app/db/pg-migration/mysql_host.yml
index e7be262..59d0b9b 100644
--- a/traffic_ops/app/db/pg-migration/mysql_host.yml
+++ b/traffic_ops/app/db/pg-migration/mysql_host.yml
@@ -15,6 +15,8 @@ version: '2'
services:
mysql_host:
- image: mysql:5.6
+ build:
+ context: .
+ dockerfile: Dockerfile-mysql
env_file:
- mysql.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55a18/traffic_ops/app/db/pg-migration/postgres.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/postgres.env b/traffic_ops/app/db/pg-migration/postgres.env
index dbd85cd..3e3c636 100644
--- a/traffic_ops/app/db/pg-migration/postgres.env
+++ b/traffic_ops/app/db/pg-migration/postgres.env
@@ -1,4 +1,4 @@
-POSTGRES_HOST=postgres_host
+POSTGRES_HOST=postgres
POSTGRES_DB=traffic_ops
POSTGRES_PASSWORD=twelve
POSTGRES_USER=traffic_ops
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55a18/traffic_ops/app/db/pg-migration/runmysql.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runmysql.sh b/traffic_ops/app/db/pg-migration/runmysql.sh
new file mode 100755
index 0000000..58185f7
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/runmysql.sh
@@ -0,0 +1,27 @@
+#!/bin/bash -x
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+waiting=/sync/waiting-for-dataimport
+touch $waiting
+
+# Wait for pgloader to finish
+while [[ -f $waiting ]]; do
+ ls -l $waiting
+ sleep 3
+done
+
+echo "Looks like dataimport is finished.. Starting mysql..."
+
+docker-entrypoint.sh mysqld
[23/50] incubator-trafficcontrol git commit: added Traffic Router
Config Test
Posted by mi...@apache.org.
added Traffic Router Config Test
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/57225e94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/57225e94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/57225e94
Branch: refs/heads/master
Commit: 57225e941a6c1429e1a0c547cc45f94d899f6e44
Parents: e47bbe1
Author: David Neuman <da...@gmail.com>
Authored: Tue Dec 6 15:11:25 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
.../integration/traffic_router_config_test.go | 205 +++++++++++++++++++
1 file changed, 205 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/57225e94/traffic_ops/client/tests/integration/traffic_router_config_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/traffic_router_config_test.go b/traffic_ops/client/tests/integration/traffic_router_config_test.go
new file mode 100644
index 0000000..ce61557
--- /dev/null
+++ b/traffic_ops/client/tests/integration/traffic_router_config_test.go
@@ -0,0 +1,205 @@
+package integration
+
+import (
+ "encoding/json"
+ "fmt"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+func TestTrafficRouterConfig(t *testing.T) {
+ cdn, err := GetCdn()
+ if err != nil {
+ t.Errorf("Could not get CDN, error was: %v\n", err)
+ }
+ uri := fmt.Sprintf("/api/1.2/cdns/%s/configs/routing.json", cdn.Name)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiTRConfigRes traffic_ops.TRConfigResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiTRConfigRes); err != nil {
+ t.Errorf("Could not decode Traffic Router Config response. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiTRConfig := apiTRConfigRes.Response
+
+ clientTRConfig, err := to.TrafficRouterConfig(cdn.Name)
+ if err != nil {
+ t.Errorf("Could not get Traffic Router Config from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiTRConfig.CacheGroups) != len(clientTRConfig.CacheGroups) {
+ t.Errorf("Length of Traffic Router config cachegroups do not match! Expected %v, got %v\n", len(apiTRConfig.CacheGroups), len(clientTRConfig.CacheGroups))
+ }
+
+ for _, apiCg := range apiTRConfig.CacheGroups {
+ match := false
+ for _, clientCg := range clientTRConfig.CacheGroups {
+ if apiCg == clientCg {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a cachegroup matching %+v\n", apiCg)
+ }
+ }
+
+ if len(apiTRConfig.DeliveryServices) != len(clientTRConfig.DeliveryServices) {
+ t.Errorf("Length of Traffic Router config deliveryserivces do not match! Expected %v, got %v\n", len(apiTRConfig.DeliveryServices), len(clientTRConfig.DeliveryServices))
+ }
+
+ for _, apiDs := range apiTRConfig.DeliveryServices {
+ match := false
+ for _, clientDs := range clientTRConfig.DeliveryServices {
+ if apiDs.XMLID == clientDs.XMLID {
+ match = true
+ if apiDs.BypassDestination != clientDs.BypassDestination {
+ t.Errorf("BypassDestination -- Expected %v, got %v\n", apiDs.BypassDestination, clientDs.BypassDestination)
+ }
+ if apiDs.CoverageZoneOnly != clientDs.CoverageZoneOnly {
+ t.Errorf("CZ Only -- Expected %v, got %v\n", apiDs.CoverageZoneOnly, clientDs.CoverageZoneOnly)
+ }
+ if len(apiDs.Domains) != len(clientDs.Domains) {
+ t.Errorf("len Domains -- Expected %v, got %v\n", len(apiDs.Domains), len(clientDs.Domains))
+ }
+ for _, apiDomain := range apiDs.Domains {
+ domainMatch := false
+ for _, clientDomain := range clientDs.Domains {
+ if apiDomain == clientDomain {
+ domainMatch = true
+ }
+ }
+ if !domainMatch {
+ t.Errorf("Domains -- Did not find a match for %v\n", apiDomain)
+ }
+ }
+ if len(apiDs.MatchSets) != len(clientDs.MatchSets) {
+ t.Errorf("len Matchsets -- Expected %v, got %v\n", len(apiDs.MatchSets), len(clientDs.MatchSets))
+ }
+ for _, apiMatch := range apiDs.MatchSets {
+ foundMatch := false
+ for _, clientMatch := range clientDs.MatchSets {
+ if apiMatch.Protocol == clientMatch.Protocol && len(apiMatch.MatchList) == len(clientMatch.MatchList) {
+ foundMatch = true
+ }
+ }
+ if !foundMatch {
+ t.Errorf("Matchsets -- Did not find a match for %+v\n", apiMatch)
+ }
+ }
+ if apiDs.MissLocation != clientDs.MissLocation {
+ t.Errorf("MissLocation -- Expected %v, got %v\n", apiDs.MissLocation, clientDs.MissLocation)
+ }
+ if apiDs.Soa != clientDs.Soa {
+ t.Errorf("Soa-- Expected %v, got %v\n", apiDs.Soa, clientDs.Soa)
+ }
+ if apiDs.TTL != clientDs.TTL {
+ t.Errorf("TTL -- Expected %v, got %v\n", apiDs.TTL, clientDs.TTL)
+ }
+ if apiDs.TTLs != clientDs.TTLs {
+ t.Errorf("TTLs -- Expected %v, got %v\n", apiDs.TTLs, clientDs.TTLs)
+ }
+ if len(apiDs.StatcDNSEntries) != len(clientDs.StatcDNSEntries) {
+ t.Errorf("len StaticDNSEntries -- Expected %v, got %v\n", len(apiDs.StatcDNSEntries), len(clientDs.StatcDNSEntries))
+ }
+ for _, apiEntry := range apiDs.StatcDNSEntries {
+ found := false
+ for _, clientEntry := range clientDs.StatcDNSEntries {
+ if apiEntry == clientEntry {
+ found = true
+ }
+ }
+ if !found {
+ t.Errorf("Static DNS -- Did not find a match for %+v\n", apiEntry)
+ }
+ }
+
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a Deliveryservice matching %+v\n", apiDs)
+ }
+ }
+
+ if len(apiTRConfig.TrafficMonitors) != len(clientTRConfig.TrafficMonitors) {
+ t.Errorf("Length of Traffic Router config Traffic Routers does not match! Expected %v, got %v\n", len(apiTRConfig.TrafficMonitors), len(clientTRConfig.TrafficMonitors))
+ }
+
+ for _, apiTM := range apiTRConfig.TrafficMonitors {
+ match := false
+ for _, clientTM := range clientTRConfig.TrafficMonitors {
+ if apiTM == clientTM {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a Traffic Router matching %+v\n", apiTM)
+ }
+ }
+
+ if len(apiTRConfig.TrafficServers) != len(clientTRConfig.TrafficServers) {
+ t.Errorf("Length of Traffic Router config traffic servers does not match! Expected %v, got %v\n", len(apiTRConfig.TrafficServers), len(clientTRConfig.TrafficServers))
+ }
+
+ for _, apiTS := range apiTRConfig.TrafficServers {
+ match := false
+ for _, clientTS := range clientTRConfig.TrafficServers {
+ if apiTS.HostName == clientTS.HostName {
+ match = true
+ if apiTS.CacheGroup != clientTS.CacheGroup {
+ t.Errorf("Cachegroup -- Expected %v, got %v\n", apiTS.CacheGroup, clientTS.CacheGroup)
+ }
+ if len(apiTS.DeliveryServices) != len(clientTS.DeliveryServices) {
+ t.Errorf("len DeliveryServices -- Expected %v, got %v\n", len(apiTS.DeliveryServices), len(clientTS.DeliveryServices))
+ }
+ for _, apiDS := range apiTS.DeliveryServices {
+ dsMatch := false
+ for _, clientDS := range clientTS.DeliveryServices {
+ if apiDS.Xmlid == clientDS.Xmlid && len(apiDS.Remaps) == len(clientDS.Remaps) {
+ dsMatch = true
+ }
+ }
+ if !dsMatch {
+ t.Errorf("Could not finding a matching DS for %v\n", apiDS.Xmlid)
+ }
+ }
+ if apiTS.FQDN != clientTS.FQDN {
+ t.Errorf("FQDN -- Expected %v, got %v\n", apiTS.FQDN, clientTS.FQDN)
+ }
+ if apiTS.HashID != clientTS.HashID {
+ t.Errorf("HashID -- Expected %v, got %v\n", apiTS.HashID, clientTS.HashID)
+ }
+ if apiTS.IP != clientTS.IP {
+ t.Errorf("IP -- Expected %v, got %v\n", apiTS.IP, clientTS.IP)
+ }
+ if apiTS.IP6 != clientTS.IP6 {
+ t.Errorf("IP6 -- Expected %v, got %v\n", apiTS.IP6, clientTS.IP6)
+ }
+ if apiTS.InterfaceName != clientTS.InterfaceName {
+ t.Errorf("Interface Name -- Expected %v, got %v\n", apiTS.InterfaceName, clientTS.InterfaceName)
+ }
+ if apiTS.Port != clientTS.Port {
+ t.Errorf("Port -- Expected %v, got %v\n", apiTS.Port, clientTS.Port)
+ }
+ if apiTS.Profile != clientTS.Profile {
+ t.Errorf("Profile -- Expected %v, got %v\n", apiTS.Profile, clientTS.Profile)
+ }
+ if apiTS.Status != clientTS.Status {
+ t.Errorf("Status -- Expected %v, got %v\n", apiTS.Status, clientTS.Status)
+ }
+ if apiTS.Type != clientTS.Type {
+ t.Errorf("Type -- Expected %v, got %v\n", apiTS.Type, clientTS.Type)
+ }
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a Traffic Server matching %+v\n", apiTS)
+ }
+ }
+}
[06/50] incubator-trafficcontrol git commit: update deliveryservice
to support actual Update response
Posted by mi...@apache.org.
update deliveryservice to support actual Update response
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/306c8618
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/306c8618
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/306c8618
Branch: refs/heads/master
Commit: 306c861825c41cc7fa9da34f57f9677c4aae1787
Parents: e769ef1
Author: David Neuman <da...@gmail.com>
Authored: Wed Nov 30 10:34:21 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/delivery_service.go | 4 ++--
traffic_ops/client/delivery_service_resources.go | 6 ++++++
traffic_ops/client/fixtures/delivery_service.go | 8 ++++++++
traffic_ops/client/tests/delivery_service_test.go | 4 ++--
4 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/306c8618/traffic_ops/client/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service.go b/traffic_ops/client/delivery_service.go
index d1102ab..db21b17 100644
--- a/traffic_ops/client/delivery_service.go
+++ b/traffic_ops/client/delivery_service.go
@@ -56,8 +56,8 @@ func (to *Session) CreateDeliveryService(ds *DeliveryService) (*CreateDeliverySe
// UpdateDeliveryService updates the DeliveryService matching the ID it's passed with
// the DeliveryService it is passed
-func (to *Session) UpdateDeliveryService(id string, ds *DeliveryService) (*DeliveryServiceResponse, error) {
- var data DeliveryServiceResponse
+func (to *Session) UpdateDeliveryService(id string, ds *DeliveryService) (*UpdateDeliveryServiceResponse, error) {
+ var data UpdateDeliveryServiceResponse
jsonReq, err := json.Marshal(ds)
if err != nil {
return nil, err
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/306c8618/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service_resources.go b/traffic_ops/client/delivery_service_resources.go
index 186c137..236382e 100644
--- a/traffic_ops/client/delivery_service_resources.go
+++ b/traffic_ops/client/delivery_service_resources.go
@@ -27,6 +27,12 @@ type CreateDeliveryServiceResponse struct {
Alerts []DeliveryServiceAlert `json:"alerts"`
}
+// UpdateDeliveryServiceResponse ...
+type UpdateDeliveryServiceResponse struct {
+ Response []DeliveryService `json:"response"`
+ Alerts []DeliveryServiceAlert `json:"alerts"`
+}
+
// DeliveryServiceResponse ...
type DeliveryServiceResponse struct {
Response DeliveryService `json:"response"`
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/306c8618/traffic_ops/client/fixtures/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/delivery_service.go b/traffic_ops/client/fixtures/delivery_service.go
index 80fb96d..3f137fb 100644
--- a/traffic_ops/client/fixtures/delivery_service.go
+++ b/traffic_ops/client/fixtures/delivery_service.go
@@ -76,6 +76,14 @@ func CreateDeliveryService() *client.CreateDeliveryServiceResponse {
}
}
+// UpdateDeliveryService returns a default UpdateDeliveryServiceResponse to be used for testing.
+func UpdateDeliveryService() *client.UpdateDeliveryServiceResponse {
+ return &client.UpdateDeliveryServiceResponse{
+ Response: DeliveryServices().Response,
+ Alerts: alerts(),
+ }
+}
+
// DeleteDeliveryService returns a default DeleteDeliveryServiceResponse to be used for testing.
func DeleteDeliveryService() *client.DeleteDeliveryServiceResponse {
return &client.DeleteDeliveryServiceResponse{
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/306c8618/traffic_ops/client/tests/delivery_service_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/delivery_service_test.go b/traffic_ops/client/tests/delivery_service_test.go
index f52a4a3..47ff74b 100644
--- a/traffic_ops/client/tests/delivery_service_test.go
+++ b/traffic_ops/client/tests/delivery_service_test.go
@@ -187,7 +187,7 @@ func TestCreateDeliveryServiceUnauthorized(t *testing.T) {
}
func TestUpdateDeliveryService(t *testing.T) {
- resp := fixtures.DeliveryService()
+ resp := fixtures.UpdateDeliveryService()
server := testHelper.ValidHTTPServer(resp)
defer server.Close()
@@ -206,7 +206,7 @@ func TestUpdateDeliveryService(t *testing.T) {
testHelper.Success(t, "Should be able to make a request to Traffic Ops")
}
- actual := ds.Response.ID
+ actual := ds.Response[0].ID
if actual != 001 {
testHelper.Error(t, "Should get back \"001\" for \"Response.ID\", got: %s", actual)
} else {
[10/50] incubator-trafficcontrol git commit: add cdnId, typeId,
and profileId to DeliveryService struct
Posted by mi...@apache.org.
add cdnId, typeId, and profileId to DeliveryService struct
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/8797ce44
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/8797ce44
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/8797ce44
Branch: refs/heads/master
Commit: 8797ce44b3733093499b12de0f3cdd55c25a0892
Parents: f7754cf
Author: David Neuman <da...@gmail.com>
Authored: Wed Nov 30 08:45:01 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/delivery_service_resources.go | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/8797ce44/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service_resources.go b/traffic_ops/client/delivery_service_resources.go
index 8d53d53..186c137 100644
--- a/traffic_ops/client/delivery_service_resources.go
+++ b/traffic_ops/client/delivery_service_resources.go
@@ -54,10 +54,13 @@ type DeliveryService struct {
DNSBypassCname string `json:"dnsBypassCname"`
DNSBypassTTL int `json:"dnsBypassTtl"`
OrgServerFQDN string `json:"orgServerFqdn"`
+ TypeID int `json:"typeId"`
Type string `json:"type"`
+ ProfileID int `json:"profileId"`
ProfileName string `json:"profileName"`
ProfileDesc string `json:"profileDescription"`
CDNName string `json:"cdnName"`
+ CDNID int `json:"cdnId"`
CCRDNSTTL int `json:"ccrDnsTtl"`
GlobalMaxMBPS int `json:"globalMaxMbps"`
GlobalMaxTPS int `json:"globalMaxTps"`
[17/50] incubator-trafficcontrol git commit: update client to always
use method passed into it when sending requests to TO
Posted by mi...@apache.org.
update client to always use method passed into it when sending requests to TO
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9341fb1a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9341fb1a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9341fb1a
Branch: refs/heads/master
Commit: 9341fb1ae0c3e5c1145499c87bdf07a33444938c
Parents: 306c861
Author: David Neuman <da...@gmail.com>
Authored: Wed Nov 30 11:34:53 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/traffic_ops.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9341fb1a/traffic_ops/client/traffic_ops.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/traffic_ops.go b/traffic_ops/client/traffic_ops.go
index 27e94b3..beb03ff 100644
--- a/traffic_ops/client/traffic_ops.go
+++ b/traffic_ops/client/traffic_ops.go
@@ -194,14 +194,14 @@ func (to *Session) request(method, path string, body []byte) (*http.Response, er
var req *http.Request
var err error
- if body != nil && method != "GET" {
+ if body != nil {
req, err = http.NewRequest(method, url, bytes.NewBuffer(body))
if err != nil {
return nil, err
}
req.Header.Set("Content-Type", "application/json")
} else {
- req, err = http.NewRequest("GET", url, nil)
+ req, err = http.NewRequest(method, url, nil)
if err != nil {
return nil, err
}
[20/50] incubator-trafficcontrol git commit: add profile test
Posted by mi...@apache.org.
add profile test
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/72d99eb9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/72d99eb9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/72d99eb9
Branch: refs/heads/master
Commit: 72d99eb9982dc9d204178c1499c90d68e5437b41
Parents: 105e1a4
Author: David Neuman <da...@gmail.com>
Authored: Fri Dec 2 15:36:11 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
.../client/tests/integration/hardware_test.go | 1 -
.../client/tests/integration/parameter_test.go | 3 +-
.../client/tests/integration/profile_test.go | 58 ++++++++++++++++++++
3 files changed, 59 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/72d99eb9/traffic_ops/client/tests/integration/hardware_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/hardware_test.go b/traffic_ops/client/tests/integration/hardware_test.go
index 6c7fb47..724c875 100644
--- a/traffic_ops/client/tests/integration/hardware_test.go
+++ b/traffic_ops/client/tests/integration/hardware_test.go
@@ -1,7 +1,6 @@
package integration
import (
- // "encoding/json"
"encoding/json"
"testing"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/72d99eb9/traffic_ops/client/tests/integration/parameter_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/parameter_test.go b/traffic_ops/client/tests/integration/parameter_test.go
index 0f57045..8e5f00a 100644
--- a/traffic_ops/client/tests/integration/parameter_test.go
+++ b/traffic_ops/client/tests/integration/parameter_test.go
@@ -1,7 +1,6 @@
package integration
import (
- // "encoding/json"
"encoding/json"
"fmt"
"testing"
@@ -32,7 +31,7 @@ func TestParameters(t *testing.T) {
clientParams, err := to.Parameters(profile.Name)
if err != nil {
- t.Errorf("Could not get Hardware from client. Error is: %v\n", err)
+ t.Errorf("Could not get parameters from client. Error is: %v\n", err)
t.FailNow()
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/72d99eb9/traffic_ops/client/tests/integration/profile_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/profile_test.go b/traffic_ops/client/tests/integration/profile_test.go
new file mode 100644
index 0000000..c4af200
--- /dev/null
+++ b/traffic_ops/client/tests/integration/profile_test.go
@@ -0,0 +1,58 @@
+package integration
+
+import (
+ "encoding/json"
+ "fmt"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+func TestProfiles(t *testing.T) {
+
+ uri := fmt.Sprintf("/api/1.2/profiles.json")
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiProfileRes traffic_ops.ProfileResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiProfileRes); err != nil {
+ t.Errorf("Could not decode profile json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiProfiles := apiProfileRes.Response
+
+ clientProfiles, err := to.Profiles()
+ if err != nil {
+ t.Errorf("Could not get profiles from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiProfiles) != len(clientProfiles) {
+ t.Errorf("Profile Response Length -- expected %v, got %v\n", len(apiProfiles), len(clientProfiles))
+ }
+
+ for _, apiProfile := range apiProfiles {
+ match := false
+ for _, clientProfile := range clientProfiles {
+ if apiProfile.ID == clientProfile.ID {
+ match = true
+ if apiProfile.Description != clientProfile.Description {
+ t.Errorf("Description -- Expected %v, got %v\n", apiProfile.Description, clientProfile.Description)
+ }
+ if apiProfile.LastUpdated != clientProfile.LastUpdated {
+ t.Errorf("Last Updated -- Expected %v, got %v\n", apiProfile.LastUpdated, clientProfile.LastUpdated)
+ }
+ if apiProfile.Name != clientProfile.Name {
+ t.Errorf("Name -- Expected %v, got %v\n", apiProfile.Name, clientProfile.Name)
+ }
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a profile matching %v\n", apiProfile.Name)
+ }
+ }
+}
[11/50] incubator-trafficcontrol git commit: update Type struct to
return ID. Updated test to check for ID and UseInTable
Posted by mi...@apache.org.
update Type struct to return ID. Updated test to check for ID and UseInTable
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e769ef19
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e769ef19
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e769ef19
Branch: refs/heads/master
Commit: e769ef198d604b9db17dd4e67d7b8d79d4d38eb0
Parents: 33d1205
Author: David Neuman <da...@gmail.com>
Authored: Wed Nov 30 10:20:38 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/fixtures/types.go | 2 ++
traffic_ops/client/tests/type_test.go | 12 ++++++++++++
traffic_ops/client/type.go | 1 +
3 files changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e769ef19/traffic_ops/client/fixtures/types.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/types.go b/traffic_ops/client/fixtures/types.go
index 9f74c59..ef77346 100644
--- a/traffic_ops/client/fixtures/types.go
+++ b/traffic_ops/client/fixtures/types.go
@@ -22,8 +22,10 @@ func Types() *client.TypeResponse {
return &client.TypeResponse{
Response: []client.Type{
client.Type{
+ ID: 1,
Name: "EDGE",
Description: "edge cache",
+ UseInTable: "server",
},
},
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e769ef19/traffic_ops/client/tests/type_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/type_test.go b/traffic_ops/client/tests/type_test.go
index e4d8a43..a0edd41 100644
--- a/traffic_ops/client/tests/type_test.go
+++ b/traffic_ops/client/tests/type_test.go
@@ -45,6 +45,12 @@ func TestTypes(t *testing.T) {
}
for _, n := range types {
+ if n.ID != 1 {
+ testHelper.Error(t, "Should get back 1 for \"ID\", got %d", n.ID)
+ } else {
+ testHelper.Success(t, "Should get back 1 for \"ID\"")
+ }
+
if n.Name != "EDGE" {
testHelper.Error(t, "Should get back \"EDGE\" for \"Name\", got %s", n.Name)
} else {
@@ -56,6 +62,12 @@ func TestTypes(t *testing.T) {
} else {
testHelper.Success(t, "Should get back \"edge cache\" for \"Description\"")
}
+
+ if n.UseInTable != "server" {
+ testHelper.Error(t, "Should get back \"server\" for \"UseInTable\", got %s", n.UseInTable)
+ } else {
+ testHelper.Success(t, "Should get back \"server\" for \"UseInTable\"")
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e769ef19/traffic_ops/client/type.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/type.go b/traffic_ops/client/type.go
index 96316f3..688c11d 100644
--- a/traffic_ops/client/type.go
+++ b/traffic_ops/client/type.go
@@ -27,6 +27,7 @@ type TypeResponse struct {
// Type contains information about a given Type in Traffic Ops.
type Type struct {
+ ID int `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
UseInTable string `json:"useInTable,omitempt"`
[05/50] incubator-trafficcontrol git commit: add HardwareTest
Posted by mi...@apache.org.
add HardwareTest
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9ca43617
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9ca43617
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9ca43617
Branch: refs/heads/master
Commit: 9ca43617820661b3d05973db98bef1818da3f944
Parents: 940d621
Author: David Neuman <da...@gmail.com>
Authored: Fri Dec 2 15:01:05 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
.../client/delivery_service_resources.go | 4 +-
.../tests/integration/deliveryservice_test.go | 11 +-
.../client/tests/integration/hardware_test.go | 105 +++++++++++++++++++
3 files changed, 109 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9ca43617/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service_resources.go b/traffic_ops/client/delivery_service_resources.go
index 32f2ff3..26d64d8 100644
--- a/traffic_ops/client/delivery_service_resources.go
+++ b/traffic_ops/client/delivery_service_resources.go
@@ -188,9 +188,9 @@ type DeliveryServiceRouting struct {
// DeliveryServiceServerResponse ...
type DeliveryServiceServerResponse struct {
Response []DeliveryServiceServer `json:"response"`
- Size string `json:"size"`
+ Size int `json:"size"`
OrderBy string `json:"orderby"`
- Limit string `json:"limit"`
+ Limit int `json:"limit"`
}
// DeliveryServiceServer ...
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9ca43617/traffic_ops/client/tests/integration/deliveryservice_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/deliveryservice_test.go b/traffic_ops/client/tests/integration/deliveryservice_test.go
index bffa769..4b56058 100644
--- a/traffic_ops/client/tests/integration/deliveryservice_test.go
+++ b/traffic_ops/client/tests/integration/deliveryservice_test.go
@@ -40,13 +40,6 @@ func init() {
os.Exit(1)
}
- // existingTestDS, err := GetDeliveryService()
- // if err != nil {
- // fmt.Printf("Deliverservice_test init -- Could not get Deliveryservices from TO...%v\n", err)
- // os.Exit(1)
- // }
- // existingTestDSID = strconv.Itoa(existingTestDS.ID)
-
//create DeliveryService object for testing
testDs.Active = false
testDs.CCRDNSTTL = 30
@@ -329,7 +322,7 @@ func TestDeliveryServiceCapacity(t *testing.T) {
t.Errorf("Could not ge Deliveryserivce Capacity for %s reponse was: %v\n", existingTestDSID, err)
}
- if apiDsCapacity.AvailablePercent != clientDsCapacity.AvailablePercent {
+ if fmt.Sprintf("%6.5f", apiDsCapacity.AvailablePercent) != fmt.Sprintf("%6.5f", clientDsCapacity.AvailablePercent) {
t.Errorf("AvailablePercent -- Expected %v got %v", apiDsCapacity.AvailablePercent, clientDsCapacity.AvailablePercent)
}
@@ -337,7 +330,7 @@ func TestDeliveryServiceCapacity(t *testing.T) {
t.Errorf("MaintenenancePercent -- Expected %v got %v", apiDsCapacity.MaintenancePercent, clientDsCapacity.MaintenancePercent)
}
- if apiDsCapacity.UnavailablePercent != clientDsCapacity.UnavailablePercent {
+ if fmt.Sprintf("%6.5f", apiDsCapacity.UnavailablePercent) != fmt.Sprintf("%6.5f", clientDsCapacity.UnavailablePercent) {
t.Errorf("UnavailablePercent -- Expected %v got %v", apiDsCapacity.UnavailablePercent, clientDsCapacity.UnavailablePercent)
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9ca43617/traffic_ops/client/tests/integration/hardware_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/hardware_test.go b/traffic_ops/client/tests/integration/hardware_test.go
new file mode 100644
index 0000000..6c7fb47
--- /dev/null
+++ b/traffic_ops/client/tests/integration/hardware_test.go
@@ -0,0 +1,105 @@
+package integration
+
+import (
+ // "encoding/json"
+ "encoding/json"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+func TestHardware(t *testing.T) {
+ resp, err := Request(*to, "GET", "/api/1.2/hwinfo.json", nil)
+ if err != nil {
+ t.Errorf("Could not get hardware.json reponse was: %v\n", err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiHwRes traffic_ops.HardwareResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiHwRes); err != nil {
+ t.Errorf("Could not decode hwinfo json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiHardware := apiHwRes.Response
+
+ clientHardware, err := to.Hardware(0)
+ if err != nil {
+ t.Errorf("Could not get Hardware from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiHardware) != len(clientHardware) {
+ t.Errorf("Hardware Response Length -- expected %v, got %v\n", len(apiHardware), len(clientHardware))
+ }
+
+ for _, apiHw := range apiHardware {
+ match := false
+ for _, clientHw := range clientHardware {
+ if apiHw.HostName == clientHw.HostName && apiHw.Description == clientHw.Description {
+ match = true
+ compareHw(apiHw, clientHw, t)
+ }
+ }
+ if !match {
+ t.Errorf("No hardware information returned from client for %s\n", apiHw.HostName)
+ }
+ }
+}
+
+func TestHardwareWithLimit(t *testing.T) {
+ resp, err := Request(*to, "GET", "/api/1.2/hwinfo.json?limit=10", nil)
+ if err != nil {
+ t.Errorf("Could not get hwinfo.json reponse was: %v\n", err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiHwRes traffic_ops.HardwareResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiHwRes); err != nil {
+ t.Errorf("Could not decode hwinfo json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiHardware := apiHwRes.Response
+
+ clientHardware, err := to.Hardware(10)
+ if err != nil {
+ t.Errorf("Could not get Hardware from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiHardware) != len(clientHardware) {
+ t.Errorf("Hardware Response Length -- expected %v, got %v\n", len(apiHardware), len(clientHardware))
+ }
+
+ for _, apiHw := range apiHardware {
+ match := false
+ for _, clientHw := range clientHardware {
+ if apiHw.HostName == clientHw.HostName && apiHw.Description == clientHw.Description {
+ match = true
+ compareHw(apiHw, clientHw, t)
+ }
+ }
+ if !match {
+ t.Errorf("No hardware information returned from client for %s\n", apiHw.HostName)
+ }
+ }
+}
+
+func compareHw(hw1 traffic_ops.Hardware, hw2 traffic_ops.Hardware, t *testing.T) {
+ if hw1.Description != hw2.Description {
+ t.Errorf("Description -- Expected %v, got %v", hw1.Description, hw2.Description)
+ }
+ if hw1.HostName != hw2.HostName {
+ t.Errorf("HostName -- Expected %v, got %v", hw1.HostName, hw2.HostName)
+ }
+ if hw1.ID != hw2.ID {
+ t.Errorf("ID -- Expected %v, got %v", hw1.ID, hw2.ID)
+ }
+ if hw1.LastUpdated != hw2.LastUpdated {
+ t.Errorf("LastUpdated -- Expected %v, got %v", hw1.LastUpdated, hw2.LastUpdated)
+ }
+ if hw1.Value != hw2.Value {
+ t.Errorf("Value -- Expected %v, got %v", hw1.Value, hw2.Value)
+ }
+}
[50/50] incubator-trafficcontrol git commit: This closes #168
Posted by mi...@apache.org.
This closes #168
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/cc1a8b77
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/cc1a8b77
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/cc1a8b77
Branch: refs/heads/master
Commit: cc1a8b77cbdded26719df5e73b11ead0947a9cb8
Parents: d417184
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Jan 9 20:37:58 2017 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Mon Jan 9 20:37:58 2017 -0700
----------------------------------------------------------------------
----------------------------------------------------------------------
[22/50] incubator-trafficcontrol git commit: added test for type
Posted by mi...@apache.org.
added test for type
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/18efd3d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/18efd3d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/18efd3d4
Branch: refs/heads/master
Commit: 18efd3d49a7e008123328dcf4254d64430355b7c
Parents: 57225e9
Author: David Neuman <da...@gmail.com>
Authored: Tue Dec 6 16:08:29 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
.../client/tests/integration/type_test.go | 58 ++++++++++++++++++++
1 file changed, 58 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/18efd3d4/traffic_ops/client/tests/integration/type_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/type_test.go b/traffic_ops/client/tests/integration/type_test.go
new file mode 100644
index 0000000..6dd0c94
--- /dev/null
+++ b/traffic_ops/client/tests/integration/type_test.go
@@ -0,0 +1,58 @@
+package integration
+
+import (
+ "encoding/json"
+ "fmt"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+func TestTypes(t *testing.T) {
+
+ uri := fmt.Sprintf("/api/1.2/types.json")
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiTypeRes traffic_ops.TypeResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiTypeRes); err != nil {
+ t.Errorf("Could not decode type json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiTypes := apiTypeRes.Response
+
+ clientTypes, err := to.Types()
+ if err != nil {
+ t.Errorf("Could not get types from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiTypes) != len(clientTypes) {
+ t.Errorf("Types Response Length -- expected %v, got %v\n", len(apiTypes), len(clientTypes))
+ }
+
+ for _, apiType := range apiTypes {
+ match := false
+ for _, clientType := range clientTypes {
+ if apiType.ID == clientType.ID {
+ match = true
+ if apiType.Description != clientType.Description {
+ t.Errorf("Description -- Expected %v, got %v\n", apiType.Description, clientType.Description)
+ }
+ if apiType.Name != clientType.Name {
+ t.Errorf("Name -- Expected %v, got %v\n", apiType.Name, clientType.Name)
+ }
+ if apiType.UseInTable != clientType.UseInTable {
+ t.Errorf("UseInTable -- Expected %v, got %v\n", apiType.UseInTable, clientType.UseInTable)
+ }
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a type matching %v\n", apiType.Name)
+ }
+ }
+}
[15/50] incubator-trafficcontrol git commit: update
DeliveryserviceServer struct to match output from TO
Posted by mi...@apache.org.
update DeliveryserviceServer struct to match output from TO
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/b999e813
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/b999e813
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/b999e813
Branch: refs/heads/master
Commit: b999e813a2079f172bf7cb61751b0e0ce9156caa
Parents: 7f5c81a
Author: David Neuman <da...@gmail.com>
Authored: Thu Dec 1 14:00:58 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/delivery_service_resources.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/b999e813/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service_resources.go b/traffic_ops/client/delivery_service_resources.go
index 1d00c94..e7bde2a 100644
--- a/traffic_ops/client/delivery_service_resources.go
+++ b/traffic_ops/client/delivery_service_resources.go
@@ -187,9 +187,9 @@ type DeliveryServiceRouting struct {
// DeliveryServiceServerResponse ...
type DeliveryServiceServerResponse struct {
Response []DeliveryServiceServer `json:"response"`
- Page int `json:"page"`
+ Size string `json:"size"`
OrderBy string `json:"orderby"`
- Limit int `json:"limit"`
+ Limit string `json:"limit"`
}
// DeliveryServiceServer ...
[36/50] incubator-trafficcontrol git commit: break docker-compose to
smaller components
Posted by mi...@apache.org.
break docker-compose to smaller components
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d5552db9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d5552db9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d5552db9
Branch: refs/heads/master
Commit: d5552db921282a1315c9f38a83e97bf284581691
Parents: 3476d77
Author: Dan Kirkwood <da...@gmail.com>
Authored: Mon Dec 12 15:10:27 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/pg-migration/convert.yml | 23 ++++++
traffic_ops/app/db/pg-migration/dataimport.yml | 26 +++++++
.../app/db/pg-migration/docker-compose.yml | 76 ++++++++------------
traffic_ops/app/db/pg-migration/mysql.env | 4 ++
traffic_ops/app/db/pg-migration/mysql_host.yml | 20 ++++++
traffic_ops/app/db/pg-migration/pgloader.yml | 24 +++++++
traffic_ops/app/db/pg-migration/postgres.env | 4 ++
.../app/db/pg-migration/postgres_host.yml | 26 +++++++
8 files changed, 155 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/convert.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/convert.yml b/traffic_ops/app/db/pg-migration/convert.yml
new file mode 100644
index 0000000..ab547e1
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/convert.yml
@@ -0,0 +1,23 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+version: '2'
+
+services:
+ # convert runs necessary post-import conversion(s) in postgres
+ convert:
+ build:
+ context: ..
+ dockerfile: pg-migration/Dockerfile-convert
+ env_file:
+ - postgres.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/dataimport.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/dataimport.yml b/traffic_ops/app/db/pg-migration/dataimport.yml
new file mode 100644
index 0000000..1087efa
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/dataimport.yml
@@ -0,0 +1,26 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+version: '2'
+
+services:
+ # dataimport reads data from an existing traffic_ops server running mysql thru the API
+ dataimport:
+ build:
+ context: .
+ dockerfile: Dockerfile-traffic_ops-client
+ restart: "no"
+ environment:
+ - TO_USER
+ - TO_PASSWORD
+ - TO_SERVER
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/docker-compose.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/docker-compose.yml b/traffic_ops/app/db/pg-migration/docker-compose.yml
index ce7c8b3..b611f75 100644
--- a/traffic_ops/app/db/pg-migration/docker-compose.yml
+++ b/traffic_ops/app/db/pg-migration/docker-compose.yml
@@ -19,81 +19,61 @@ volumes:
services:
# dataimport reads data from an existing traffic_ops server running mysql thru the API
dataimport:
- build:
- context: .
- dockerfile: Dockerfile-traffic_ops-client
- restart: "no"
- environment:
- - TO_USER
- - TO_PASSWORD
- - TO_SERVER
-
+ extends:
+ service: dataimport
+ file: dataimport.yml
volumes:
- ./mysql/initdb.d:/docker-entrypoint-initdb.d
+ volumes:
+ - sync:/sync
# mysql_host loads mysql data locally and provides direct access for pgloader
- mysql_host:
- image: mysql:5.6
- restart: "no"
- environment:
- - MYSQL_DATABASE=traffic_ops_db
- - MYSQL_RANDOM_ROOT_PASSWORD=yes
- - MYSQL_PASSWORD=twelve
- - MYSQL_USER=to_user
+ mysql:
+ extends:
+ service: mysql_host
+ file: mysql_host.yml
depends_on:
- dataimport
volumes:
+ - sync:/sync
- ./mysql/conf.d:/etc/mysql/conf.d
- ./mysql/initdb.d:/docker-entrypoint-initdb.d
# postgres_host provides a postgres data to import data to
- postgres_host:
- build:
- context: ..
- dockerfile: pg-migration/Dockerfile-postgres
- restart: "no"
+ postgres:
+ extends:
+ service: postgres_host
+ file: postgres_host.yml
environment:
- POSTGRES_DB=traffic_ops
- POSTGRES_PASSWORD=twelve
- POSTGRES_USER=traffic_ops
+ depends_on:
+ - mysql
volumes:
- /opt/traffic_ops-db:/var/lib/postgresql/data
ports:
- 5432
+ volumes:
+ - sync:/sync
# pgloader converts the data from mysql to postgres
pgloader:
- build:
- context: ..
- dockerfile: pg-migration/Dockerfile-pgloader
- restart: "no"
+ extends:
+ service: pgloader
+ file: pgloader.yml
depends_on:
- - mysql_host
- - postgres_host
- environment:
- - MYSQL_HOST=mysql_host
- - MYSQL_DATABASE=traffic_ops_db
- - MYSQL_PASSWORD=twelve
- - MYSQL_USER=to_user
- - POSTGRES_HOST=postgres_host
- - POSTGRES_DB=traffic_ops
- - POSTGRES_PASSWORD=twelve
- - POSTGRES_USER=traffic_ops
+ - mysql
+ - postgres
volumes:
- sync:/sync
- # convert runs necessary post-import conversion(s) in postgres
+ # convert runs needed post-migration conversions
convert:
- build:
- context: ..
- dockerfile: pg-migration/Dockerfile-convert
- restart: "no"
+ extends:
+ service: convert
+ file: convert.yml
depends_on:
- - postgres_host
- environment:
- - POSTGRES_HOST=postgres_host
- - POSTGRES_DB=traffic_ops
- - POSTGRES_PASSWORD=twelve
- - POSTGRES_USER=traffic_ops
+ - postgres
volumes:
- sync:/sync
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/mysql.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql.env b/traffic_ops/app/db/pg-migration/mysql.env
new file mode 100644
index 0000000..b6cba06
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/mysql.env
@@ -0,0 +1,4 @@
+MYSQL_DATABASE=traffic_ops_db
+MYSQL_RANDOM_ROOT_PASSWORD=yes
+MYSQL_PASSWORD=twelve
+MYSQL_USER=to_user
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/mysql_host.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql_host.yml b/traffic_ops/app/db/pg-migration/mysql_host.yml
new file mode 100644
index 0000000..e7be262
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/mysql_host.yml
@@ -0,0 +1,20 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+version: '2'
+
+services:
+ mysql_host:
+ image: mysql:5.6
+ env_file:
+ - mysql.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/pgloader.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/pgloader.yml b/traffic_ops/app/db/pg-migration/pgloader.yml
new file mode 100644
index 0000000..23329a7
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/pgloader.yml
@@ -0,0 +1,24 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+version: '2'
+
+services:
+ # pgloader converts the data from mysql to postgres
+ pgloader:
+ build:
+ context: ..
+ dockerfile: pg-migration/Dockerfile-pgloader
+ env_file:
+ - mysql.env
+ - postgres.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/postgres.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/postgres.env b/traffic_ops/app/db/pg-migration/postgres.env
new file mode 100644
index 0000000..dbd85cd
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/postgres.env
@@ -0,0 +1,4 @@
+POSTGRES_HOST=postgres_host
+POSTGRES_DB=traffic_ops
+POSTGRES_PASSWORD=twelve
+POSTGRES_USER=traffic_ops
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/postgres_host.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/postgres_host.yml b/traffic_ops/app/db/pg-migration/postgres_host.yml
new file mode 100644
index 0000000..f8e0439
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/postgres_host.yml
@@ -0,0 +1,26 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+version: '2'
+
+services:
+ postgres_host:
+ build:
+ context: ..
+ dockerfile: pg-migration/Dockerfile-postgres
+ environment:
+ - POSTGRES_DB=traffic_ops
+ - POSTGRES_PASSWORD=twelve
+ - POSTGRES_USER=traffic_ops
+ ports:
+ - 5432
[16/50] incubator-trafficcontrol git commit: update
DeliveryserviceServer to match API output
Posted by mi...@apache.org.
update DeliveryserviceServer to match API output
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/7f5c81ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/7f5c81ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/7f5c81ac
Branch: refs/heads/master
Commit: 7f5c81acc8ce6b0815caf8b02343066dfd7e05da
Parents: 9341fb1
Author: David Neuman <da...@gmail.com>
Authored: Thu Dec 1 09:06:38 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/delivery_service_resources.go | 4 ++--
traffic_ops/client/fixtures/delivery_service.go | 4 ++--
traffic_ops/client/tests/delivery_service_test.go | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/7f5c81ac/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service_resources.go b/traffic_ops/client/delivery_service_resources.go
index 236382e..1d00c94 100644
--- a/traffic_ops/client/delivery_service_resources.go
+++ b/traffic_ops/client/delivery_service_resources.go
@@ -195,8 +195,8 @@ type DeliveryServiceServerResponse struct {
// DeliveryServiceServer ...
type DeliveryServiceServer struct {
LastUpdated string `json:"lastUpdated"`
- Server string `json:"server"`
- DeliveryService string `json:"deliveryService"`
+ Server int `json:"server"`
+ DeliveryService int `json:"deliveryService"`
}
// DeliveryServiceSSLKeysResponse ...
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/7f5c81ac/traffic_ops/client/fixtures/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/delivery_service.go b/traffic_ops/client/fixtures/delivery_service.go
index 3f137fb..97675ab 100644
--- a/traffic_ops/client/fixtures/delivery_service.go
+++ b/traffic_ops/client/fixtures/delivery_service.go
@@ -171,8 +171,8 @@ func DeliveryServiceRouting() *client.DeliveryServiceRoutingResponse {
func DeliveryServiceServer() *client.DeliveryServiceServerResponse {
dss := client.DeliveryServiceServer{
LastUpdated: "lastUpdated",
- Server: "someServer",
- DeliveryService: "someService",
+ Server: 1,
+ DeliveryService: 1,
}
return &client.DeliveryServiceServerResponse{
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/7f5c81ac/traffic_ops/client/tests/delivery_service_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/delivery_service_test.go b/traffic_ops/client/tests/delivery_service_test.go
index 47ff74b..66a5ee9 100644
--- a/traffic_ops/client/tests/delivery_service_test.go
+++ b/traffic_ops/client/tests/delivery_service_test.go
@@ -526,16 +526,16 @@ func TestDeliveryServiceServer(t *testing.T) {
testHelper.Success(t, "Should get back \"lastUpdated\" for \"LastUpdated\"")
}
- if s[0].Server != "someServer" {
- testHelper.Error(t, "Should get back \"someServer\" for \"Server\", got: %s", s[0].Server)
+ if s[0].Server != 1 {
+ testHelper.Error(t, "Should get back 1 for \"Server\", got: %s", s[0].Server)
} else {
- testHelper.Success(t, "Should get back \"someServer\" for \"Server\"")
+ testHelper.Success(t, "Should get back 1 for \"Server\"")
}
- if s[0].DeliveryService != "someService" {
- testHelper.Error(t, "Should get back \"someService\" for \"DeliveryService\", got: %s", s[0].DeliveryService)
+ if s[0].DeliveryService != 1 {
+ testHelper.Error(t, "Should get back 1 for \"DeliveryService\", got: %s", s[0].DeliveryService)
} else {
- testHelper.Success(t, "Should get back \"someService\" for \"DeliveryService\"")
+ testHelper.Success(t, "Should get back 1 for \"DeliveryService\"")
}
}
[30/50] incubator-trafficcontrol git commit: use later pgloader image
Posted by mi...@apache.org.
use later pgloader image
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a49530c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a49530c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a49530c6
Branch: refs/heads/master
Commit: a49530c63860b6b14b2ce6487a67185f52efdde8
Parents: e845962
Author: Dan Kirkwood <da...@gmail.com>
Authored: Mon Dec 12 15:06:40 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/db/pg-migration/Dockerfile-pgloader | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a49530c6/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-pgloader b/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
index bb44384..faf98b3 100644
--- a/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
@@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM dimitri/pgloader
+FROM dimitri/pgloader:ccl.latest
MAINTAINER Dan Kirkwood <da...@apache.org>
# install nc to check that postgres and mysql are ready..
[33/50] incubator-trafficcontrol git commit: ensures only ops or
admin role can snapshot crconfig
Posted by mi...@apache.org.
ensures only ops or admin role can snapshot crconfig
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c6d312a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c6d312a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c6d312a8
Branch: refs/heads/master
Commit: c6d312a8dc80151df1f57a8aafe4d72e06aa66e9
Parents: a4dee0d
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Fri Dec 9 12:37:08 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/lib/UI/Tools.pm | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c6d312a8/traffic_ops/app/lib/UI/Tools.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Tools.pm b/traffic_ops/app/lib/UI/Tools.pm
index 218f197..8b385fb 100644
--- a/traffic_ops/app/lib/UI/Tools.pm
+++ b/traffic_ops/app/lib/UI/Tools.pm
@@ -113,9 +113,13 @@ sub write_crconfig {
$self->flash( alertmsg => $error );
}
else {
- UI::Topology::write_crconfig_json_to_db( $self, $cdn_name, $json );
- &log( $self, "Snapshot CRConfig created.", "OPER" );
- $self->flash( alertmsg => "Successfully wrote CRConfig.json!" );
+ if ( !&is_oper($self) ) {
+ $self->flash( alertmsg => "No can do. Get more privs." );
+ } else {
+ UI::Topology::write_crconfig_json_to_db( $self, $cdn_name, $json );
+ &log( $self, "Snapshot CRConfig created.", "OPER" );
+ $self->flash( alertmsg => "Successfully wrote CRConfig.json!" );
+ }
}
return $self->redirect_to('/utils/close_fancybox');
}
[21/50] incubator-trafficcontrol git commit: added stats summary test
Posted by mi...@apache.org.
added stats summary test
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/93df9fb6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/93df9fb6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/93df9fb6
Branch: refs/heads/master
Commit: 93df9fb65b45df61718a2743b4d0c4788c20ba23
Parents: d247815
Author: David Neuman <da...@gmail.com>
Authored: Mon Dec 5 13:24:00 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
.../tests/integration/stats_summary_test.go | 226 +++++++++++++++++++
1 file changed, 226 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/93df9fb6/traffic_ops/client/tests/integration/stats_summary_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/stats_summary_test.go b/traffic_ops/client/tests/integration/stats_summary_test.go
new file mode 100644
index 0000000..b419e49
--- /dev/null
+++ b/traffic_ops/client/tests/integration/stats_summary_test.go
@@ -0,0 +1,226 @@
+package integration
+
+import (
+ "encoding/json"
+ "fmt"
+ "testing"
+ "time"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+func TestStatsSummaryAll(t *testing.T) {
+
+ uri := fmt.Sprintf("/api/1.2/stats_summary.json")
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiStatsSummaryRes traffic_ops.StatsSummaryResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiStatsSummaryRes); err != nil {
+ t.Errorf("Could not decode stats summary json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiStatsSummary := apiStatsSummaryRes.Response
+
+ clientStatsSummary, err := to.SummaryStats("", "", "")
+ if err != nil {
+ t.Errorf("Could not get stats summary from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiStatsSummary) != len(clientStatsSummary) {
+ t.Errorf("Stats Summary Response Length -- expected %v, got %v\n", len(apiStatsSummary), len(clientStatsSummary))
+ }
+
+ for _, apiSs := range apiStatsSummary {
+ match := false
+ for _, clientSs := range clientStatsSummary {
+ if apiSs == clientSs {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a stats summary matching %+v\n", apiSs)
+ }
+ }
+}
+
+func TestStatsSummarybyCDN(t *testing.T) {
+ cdn, err := GetCdn()
+ if err != nil {
+ t.Error("Could not get a CDN, response was %v\n", err)
+ t.FailNow()
+ }
+ uri := fmt.Sprintf("/api/1.2/stats_summary.json?cdnName=%s", cdn.Name)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiStatsSummaryRes traffic_ops.StatsSummaryResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiStatsSummaryRes); err != nil {
+ t.Errorf("Could not decode stats summary json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiStatsSummary := apiStatsSummaryRes.Response
+
+ clientStatsSummary, err := to.SummaryStats(cdn.Name, "", "")
+ if err != nil {
+ t.Errorf("Could not get stats summary from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiStatsSummary) != len(clientStatsSummary) {
+ t.Errorf("Stats Summary Response Length -- expected %v, got %v\n", len(apiStatsSummary), len(clientStatsSummary))
+ }
+
+ for _, apiSs := range apiStatsSummary {
+ match := false
+ for _, clientSs := range clientStatsSummary {
+ if apiSs == clientSs {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a stats summary matching %+v\n", apiSs)
+ }
+ }
+}
+
+func TestStatsSummaryByDs(t *testing.T) {
+ ds, err := GetDeliveryService("")
+ if err != nil {
+ t.Error("Could not get a DS, response was %v\n", err)
+ t.FailNow()
+ }
+ uri := fmt.Sprintf("/api/1.2/stats_summary.json?deliveryServiceName=%s", ds.XMLID)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiStatsSummaryRes traffic_ops.StatsSummaryResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiStatsSummaryRes); err != nil {
+ t.Errorf("Could not decode stats summary json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiStatsSummary := apiStatsSummaryRes.Response
+
+ clientStatsSummary, err := to.SummaryStats("", ds.XMLID, "")
+ if err != nil {
+ t.Errorf("Could not get stats summary from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiStatsSummary) != len(clientStatsSummary) {
+ t.Errorf("Stats Summary Response Length -- expected %v, got %v\n", len(apiStatsSummary), len(clientStatsSummary))
+ }
+
+ for _, apiSs := range apiStatsSummary {
+ match := false
+ for _, clientSs := range clientStatsSummary {
+ if apiSs == clientSs {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a stats summary matching %+v\n", apiSs)
+ }
+ }
+}
+
+func TestStatsSummaryByStatName(t *testing.T) {
+ uri := fmt.Sprintf("/api/1.2/stats_summary.json?statName=daily_bytesserved")
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiStatsSummaryRes traffic_ops.StatsSummaryResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiStatsSummaryRes); err != nil {
+ t.Errorf("Could not decode stats summary json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiStatsSummary := apiStatsSummaryRes.Response
+
+ clientStatsSummary, err := to.SummaryStats("", "", "daily_bytesserved")
+ if err != nil {
+ t.Errorf("Could not get stats summary from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiStatsSummary) != len(clientStatsSummary) {
+ t.Errorf("Stats Summary Response Length -- expected %v, got %v\n", len(apiStatsSummary), len(clientStatsSummary))
+ }
+
+ for _, apiSs := range apiStatsSummary {
+ match := false
+ for _, clientSs := range clientStatsSummary {
+ if apiSs == clientSs {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a stats summary matching %+v\n", apiSs)
+ }
+ }
+}
+
+func TestAddSummaryStats(t *testing.T) {
+ cdn, err := GetCdn()
+ if err != nil {
+ t.Errorf("Could not get a CDN, response was %v\n", err)
+ t.FailNow()
+ }
+ ds, err := GetDeliveryService(cdn.Name)
+ if err != nil {
+ t.Errorf("Could not get a DS, response was %v\n", err)
+ t.FailNow()
+ }
+ now := time.Now()
+ summaryTime := now.Format(time.RFC3339)
+ statDate := now.Format("2006-01-02")
+
+ testStatsSummay := new(traffic_ops.StatsSummary)
+ testStatsSummay.CDNName = cdn.Name
+ testStatsSummay.DeliveryService = ds.XMLID
+ testStatsSummay.StatDate = statDate
+ testStatsSummay.StatName = "testStatName"
+ testStatsSummay.StatValue = "1234"
+ testStatsSummay.SummaryTime = summaryTime
+
+ err = to.AddSummaryStats(*testStatsSummay)
+ if err != nil {
+ t.Errorf("Could not add Summary Stats, response was %v\n", err)
+ t.FailNow()
+ }
+
+ ssRes, err := to.SummaryStats(testStatsSummay.CDNName, testStatsSummay.DeliveryService, testStatsSummay.StatName)
+ if err != nil {
+ t.Errorf("Could not get a SummaryStats, error was: %v\n", err)
+ t.FailNow()
+ }
+ match := false
+ for _, ss := range ssRes {
+ if ss.CDNName == testStatsSummay.CDNName &&
+ ss.DeliveryService == testStatsSummay.DeliveryService &&
+ ss.StatDate == testStatsSummay.StatDate &&
+ ss.StatName == testStatsSummay.StatName &&
+ ss.StatValue == testStatsSummay.StatValue {
+ match = true
+ }
+ }
+ if !match {
+ t.Errorf("Stats Summary not found in Traffic Ops after Adding. Summary Stats Response was: %+v, expecting: %+v\n", ssRes, *testStatsSummay)
+ }
+}
[49/50] incubator-trafficcontrol git commit: Merge branch
'merge-postgres' of https://github.com/dangogh/incubator-trafficcontrol
Posted by mi...@apache.org.
Merge branch 'merge-postgres' of https://github.com/dangogh/incubator-trafficcontrol
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d4171849
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d4171849
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d4171849
Branch: refs/heads/master
Commit: d4171849789f9bb000e4ff379fb8581ac4a9c71c
Parents: 9328758 496bcab
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Jan 9 20:36:53 2017 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Mon Jan 9 20:36:53 2017 -0700
----------------------------------------------------------------------
infrastructure/docker/traffic_ops/Dockerfile | 20 +-
traffic_ops/app/conf/development/database.conf | 8 +-
traffic_ops/app/conf/integration/database.conf | 8 +-
traffic_ops/app/conf/production/database.conf | 8 +-
traffic_ops/app/conf/test/database.conf | 8 +-
traffic_ops/app/cpanfile | 4 +-
traffic_ops/app/db/admin.pl | 156 +-
traffic_ops/app/db/convert_bools.sql | 95 +
traffic_ops/app/db/create_tables.sql | 3564 +-
traffic_ops/app/db/dbconf.yml | 22 +-
traffic_ops/app/db/migrations/.keep | 0
.../db/migrations/20141222103718_extension.sql | 95 -
.../20150108100000_add_job_deliveryservice.sql | 21 -
.../migrations/20150205100000_cg_location.sql | 57 -
.../migrations/20150209100000_cran_to_asn.sql | 22 -
.../db/migrations/20150210100000_ds_keyinfo.sql | 25 -
.../20150304100000_add_ip6_ds_routing.sql | 26 -
.../migrations/20150310100000_add_bg_fetch.sql | 24 -
.../migrations/20150316100000_move_hdr_rw.sql | 30 -
.../20150331105256_add_origin_shield.sql | 23 -
.../20150501100000_add_mid_hdr_rw.sql | 24 -
.../20150503100001_add_regex_remap.sql | 23 -
.../migrations/20150504100000_rr_handling.sql | 22 -
.../20150504100001_add_param_index.sql | 22 -
.../20150521100000_add_cacheurl_to_ds.sql | 22 -
.../migrations/20150530100000_add_any_remap.sql | 24 -
.../migrations/20150618100000_add_multisite.sql | 23 -
.../migrations/20150626100000_add_cg_uniq.sql | 25 -
.../20150706084134_stats_summary_table.sql | 29 -
.../migrations/20150721000000_add_stat_date.sql | 21 -
.../20150722100000_add_disname_tr_headers.sql | 24 -
.../20150728000000_add_initial_dispersion.sql | 22 -
.../20150804000000_add_preprod_status.sql | 22 -
.../20150807000000_add_dns_bypass_cname.sql | 22 -
.../20150825175644_shorten_display_name.sql | 31 -
.../app/db/migrations/20150922092122_cdn.sql | 69 -
.../20150925020500_drop_cdn_param.sql | 23 -
.../20151020143912_unique_cdn_name.sql | 27 -
.../20151021000000_federation_tables.sql | 76 -
.../20151027152323_tr_request_headers.sql | 23 -
.../20151107000000_cdn_dnssec_enabled.sql | 23 -
.../migrations/20151202193037_secondary_cg.sql | 23 -
.../migrations/20151207000000_unique_email.sql | 25 -
.../20151208000000_add_job_status.sql | 27 -
.../20160102193037_drop_local_user.sql | 23 -
...20160202000000_add_regional_geo_blocking.sql | 22 -
.../migrations/20160222104337_add_ssh_key.sql | 23 -
.../20160323160333_add_geo_provider.sql | 23 -
.../20160329141600_add_ds_protocol_not_null.sql | 22 -
...0160510082300_add_ds_geo_limit_countries.sql | 25 -
.../20160510202613_add_ds_steering.sql | 35 -
.../20160526140027_add_deploy_role.sql | 23 -
.../20160603084204_add_logs_enabled.sql | 25 -
.../db/migrations/20160613153313_add_guid.sql | 23 -
.../20160614000000_mod_param_cfg_len.sql | 24 -
...20160628000000_update_cdn_dnssec_enabled.sql | 24 -
.../20160630000000_add_multisite_algrithom.sql | 23 -
.../20160630010009_add_secure_parameter.sql | 23 -
.../20160718000000_drop_ttl_max_hours_param.sql | 23 -
.../20160718000005_drop_ttl_min_hours_param.sql | 23 -
...20160729000000_add_geolimit_redirect_url.sql | 23 -
.../20160809092015_update_serverchecks.sql | 24 -
.../20160817171741_server_add_https_port.sql | 23 -
.../20160826111234_modify_server_table.sql | 58 -
.../20160909141413_add_offline_reason.sql | 24 -
.../20161208000000_alter_cdn_name_not_null.sql | 23 +
.../20161208000001_create_snapshots.sql | 32 +
.../app/db/pg-migration/Dockerfile-convert | 22 +
.../app/db/pg-migration/Dockerfile-mysql | 19 +
.../app/db/pg-migration/Dockerfile-pgloader | 21 +
.../app/db/pg-migration/Dockerfile-postgres | 22 +
.../pg-migration/Dockerfile-traffic_ops-client | 27 +
traffic_ops/app/db/pg-migration/README.md | 21 +
traffic_ops/app/db/pg-migration/convert.yml | 23 +
traffic_ops/app/db/pg-migration/dataimport.env | 17 +
traffic_ops/app/db/pg-migration/dataimport.yml | 24 +
.../app/db/pg-migration/docker-compose.yml | 73 +
traffic_ops/app/db/pg-migration/get-to-data.sh | 38 +
traffic_ops/app/db/pg-migration/mysql.env | 18 +
.../app/db/pg-migration/mysql/conf.d/mysql.cnf | 21 +
traffic_ops/app/db/pg-migration/mysql_host.yml | 22 +
traffic_ops/app/db/pg-migration/pgloader.yml | 24 +
traffic_ops/app/db/pg-migration/postgres.env | 17 +
.../app/db/pg-migration/postgres_host.yml | 24 +
traffic_ops/app/db/pg-migration/runconvert.sh | 30 +
traffic_ops/app/db/pg-migration/runmysql.sh | 27 +
traffic_ops/app/db/pg-migration/runpgloader.sh | 39 +
traffic_ops/app/db/seeds.sql | 314 +-
traffic_ops/app/lib/API/Cachegroup.pm | 16 +-
traffic_ops/app/lib/API/Cdn.pm | 30 +-
traffic_ops/app/lib/API/ChangeLog.pm | 3 -
.../app/lib/API/DeliveryService/Steering.pm | 2 +-
.../app/lib/API/DeliveryServiceServer.pm | 3 +
traffic_ops/app/lib/API/Deliveryservice.pm | 64 +-
traffic_ops/app/lib/API/Federation.pm | 4 +-
traffic_ops/app/lib/API/HwInfo.pm | 1 +
traffic_ops/app/lib/API/Parameter.pm | 3 +-
traffic_ops/app/lib/API/Profile.pm | 2 +-
traffic_ops/app/lib/API/Server.pm | 2 +-
traffic_ops/app/lib/API/ServerCheck.pm | 2 +-
traffic_ops/app/lib/API/ToExtension.pm | 4 +-
traffic_ops/app/lib/API/Topology.pm | 2 +-
traffic_ops/app/lib/API/User.pm | 2 +-
traffic_ops/app/lib/Fixtures/Asn.pm | 9 +-
traffic_ops/app/lib/Fixtures/Cachegroup.pm | 20 +-
.../app/lib/Fixtures/CachegroupParameter.pm | 8 +-
traffic_ops/app/lib/Fixtures/Cdn.pm | 9 +-
traffic_ops/app/lib/Fixtures/Deliveryservice.pm | 301 +-
.../app/lib/Fixtures/DeliveryserviceRegex.pm | 99 +-
.../app/lib/Fixtures/DeliveryserviceServer.pm | 46 +-
.../app/lib/Fixtures/DeliveryserviceTmuser.pm | 26 +-
traffic_ops/app/lib/Fixtures/Division.pm | 6 +-
traffic_ops/app/lib/Fixtures/EdgeCachegroup.pm | 6 +-
traffic_ops/app/lib/Fixtures/Federation.pm | 3 +-
.../lib/Fixtures/FederationDeliveryservice.pm | 8 +-
.../app/lib/Fixtures/FederationResolver.pm | 3 +-
.../app/lib/Fixtures/FederationTmuser.pm | 5 +-
traffic_ops/app/lib/Fixtures/Hwinfo.pm | 13 +-
traffic_ops/app/lib/Fixtures/Integration/Asn.pm | 87 +-
.../app/lib/Fixtures/Integration/Cachegroup.pm | 175 +-
traffic_ops/app/lib/Fixtures/Integration/Cdn.pm | 27 +-
.../lib/Fixtures/Integration/Deliveryservice.pm | 390 +-
.../Integration/DeliveryserviceRegex.pm | 79 +-
.../Integration/DeliveryserviceServer.pm | 2023 +-
.../app/lib/Fixtures/Integration/Division.pm | 25 +-
.../lib/Fixtures/Integration/GooseDbVersion.pm | 286 +-
.../app/lib/Fixtures/Integration/Parameter.pm | 4909 ++-
.../lib/Fixtures/Integration/PhysLocation.pm | 276 +-
.../app/lib/Fixtures/Integration/Profile.pm | 232 +-
.../Fixtures/Integration/ProfileParameter.pm | 35717 +++++++++++++++--
.../app/lib/Fixtures/Integration/Regex.pm | 90 +-
.../app/lib/Fixtures/Integration/Region.pm | 38 +-
.../app/lib/Fixtures/Integration/Role.pm | 70 +-
.../app/lib/Fixtures/Integration/Server.pm | 3164 +-
.../app/lib/Fixtures/Integration/Servercheck.pm | 173 +-
.../app/lib/Fixtures/Integration/Status.pm | 70 +-
.../app/lib/Fixtures/Integration/TmUser.pm | 169 +-
.../app/lib/Fixtures/Integration/ToExtension.pm | 65 +-
.../app/lib/Fixtures/Integration/Type.pm | 352 +-
traffic_ops/app/lib/Fixtures/Job.pm | 7 +-
traffic_ops/app/lib/Fixtures/JobAgent.pm | 3 +-
traffic_ops/app/lib/Fixtures/JobStatus.pm | 3 +-
traffic_ops/app/lib/Fixtures/Log.pm | 4 +-
traffic_ops/app/lib/Fixtures/Parameter.pm | 3 +-
traffic_ops/app/lib/Fixtures/PhysLocation.pm | 15 +-
traffic_ops/app/lib/Fixtures/Profile.pm | 16 +-
.../app/lib/Fixtures/ProfileParameter.pm | 238 +-
traffic_ops/app/lib/Fixtures/Regex.pm | 95 +-
traffic_ops/app/lib/Fixtures/Region.pm | 8 +-
traffic_ops/app/lib/Fixtures/Role.pm | 3 +-
traffic_ops/app/lib/Fixtures/Server.pm | 165 +-
traffic_ops/app/lib/Fixtures/Staticdnsentry.pm | 22 +-
traffic_ops/app/lib/Fixtures/StatsSummary.pm | 46 +
traffic_ops/app/lib/Fixtures/Status.pm | 3 +-
traffic_ops/app/lib/Fixtures/TmUser.pm | 61 +-
traffic_ops/app/lib/MojoPlugins/Health.pm | 16 +-
traffic_ops/app/lib/MojoPlugins/Server.pm | 2 +
traffic_ops/app/lib/Schema/Result/Asn.pm | 38 +-
traffic_ops/app/lib/Schema/Result/Cachegroup.pm | 72 +-
.../lib/Schema/Result/CachegroupParameter.pm | 26 +-
traffic_ops/app/lib/Schema/Result/Cdn.pm | 58 +-
.../Result/DeliveryServiceInfoForDomainList.pm | 65 +-
.../Result/DeliveryServiceInfoForServerList.pm | 5 +-
.../app/lib/Schema/Result/Deliveryservice.pm | 282 +-
.../lib/Schema/Result/DeliveryserviceRegex.pm | 20 +-
.../lib/Schema/Result/DeliveryserviceServer.pm | 26 +-
.../lib/Schema/Result/DeliveryserviceTmuser.pm | 26 +-
traffic_ops/app/lib/Schema/Result/Division.pm | 33 +-
traffic_ops/app/lib/Schema/Result/Federation.pm | 52 +-
.../Schema/Result/FederationDeliveryservice.pm | 44 +-
.../Result/FederationFederationResolver.pm | 44 +-
.../app/lib/Schema/Result/FederationResolver.pm | 57 +-
.../app/lib/Schema/Result/FederationTmuser.pm | 50 +-
.../app/lib/Schema/Result/GooseDbVersion.pm | 31 +-
traffic_ops/app/lib/Schema/Result/Hwinfo.pm | 44 +-
.../lib/Schema/Result/InfluxDBHostsOnline.pm | 2 +-
traffic_ops/app/lib/Schema/Result/Job.pm | 96 +-
traffic_ops/app/lib/Schema/Result/JobAgent.pm | 34 +-
traffic_ops/app/lib/Schema/Result/JobResult.pm | 46 +-
traffic_ops/app/lib/Schema/Result/JobStatus.pm | 34 +-
traffic_ops/app/lib/Schema/Result/Log.pm | 45 +-
traffic_ops/app/lib/Schema/Result/Parameter.pm | 47 +-
.../app/lib/Schema/Result/PhysLocation.pm | 88 +-
traffic_ops/app/lib/Schema/Result/Profile.pm | 38 +-
.../app/lib/Schema/Result/ProfileParameter.pm | 26 +-
traffic_ops/app/lib/Schema/Result/Regex.pm | 39 +-
traffic_ops/app/lib/Schema/Result/Region.pm | 39 +-
.../app/lib/Schema/Result/RiakHostsOnline.pm | 2 +-
traffic_ops/app/lib/Schema/Result/Role.pm | 28 +-
traffic_ops/app/lib/Schema/Result/Server.pm | 214 +-
.../app/lib/Schema/Result/Servercheck.pm | 162 +-
traffic_ops/app/lib/Schema/Result/Snapshot.pm | 95 +
.../app/lib/Schema/Result/Staticdnsentry.pm | 60 +-
.../app/lib/Schema/Result/StatsSummary.pm | 67 +-
traffic_ops/app/lib/Schema/Result/Status.pm | 34 +-
.../app/lib/Schema/Result/SteeringTarget.pm | 48 +-
traffic_ops/app/lib/Schema/Result/TmUser.pm | 140 +-
.../app/lib/Schema/Result/ToExtension.pm | 75 +-
traffic_ops/app/lib/Schema/Result/Type.pm | 43 +-
.../app/lib/Test/IntegrationTestHelper.pm | 40 +-
traffic_ops/app/lib/Test/TestHelper.pm | 100 +-
traffic_ops/app/lib/TrafficOpsRoutes.pm | 11 +-
traffic_ops/app/lib/UI/Cdn.pm | 8 +-
traffic_ops/app/lib/UI/ChangeLog.pm | 4 +-
traffic_ops/app/lib/UI/ConfigFiles.pm | 15 +-
traffic_ops/app/lib/UI/DeliveryService.pm | 3 +-
traffic_ops/app/lib/UI/GenDbDump.pm | 21 +-
traffic_ops/app/lib/UI/Parameter.pm | 2 +-
traffic_ops/app/lib/UI/Profile.pm | 4 +-
traffic_ops/app/lib/UI/Region.pm | 2 +-
traffic_ops/app/lib/UI/Server.pm | 7 +-
traffic_ops/app/lib/UI/Snapshot.pm | 39 +
traffic_ops/app/lib/UI/Tools.pm | 16 +-
traffic_ops/app/lib/UI/Topology.pm | 98 +-
traffic_ops/app/lib/UI/UploadHandlerCsv.pm | 2 +-
traffic_ops/app/t/api/1.1/asn.t | 12 +-
traffic_ops/app/t/api/1.1/cachegroup.t | 2 +-
traffic_ops/app/t/api/1.1/cdn.t | 51 +
.../app/t/api/1.1/deliveryservice/ssl_keys.t | 2 +-
.../app/t/api/1.1/deliveryserviceserver.t | 2 +-
traffic_ops/app/t/api/1.1/job.t | 30 +-
traffic_ops/app/t/api/1.1/server.t | 10 +-
traffic_ops/app/t/api/1.2/asn.t | 22 +-
traffic_ops/app/t/api/1.2/cachegroup.t | 35 +-
traffic_ops/app/t/api/1.2/cdn.t | 9 +-
traffic_ops/app/t/api/1.2/deliveryservice.t | 10 +-
.../app/t/api/1.2/deliveryservice_matches.t | 8 +-
.../app/t/api/1.2/deliveryservice_regex.t | 6 +-
.../app/t/api/1.2/deliveryservice_server.t | 26 +-
traffic_ops/app/t/api/1.2/division.t | 15 +-
traffic_ops/app/t/api/1.2/federation_external.t | 87 +-
traffic_ops/app/t/api/1.2/parameter.t | 50 +-
traffic_ops/app/t/api/1.2/physlocation.t | 8 +-
traffic_ops/app/t/api/1.2/profile.t | 6 +-
traffic_ops/app/t/api/1.2/profile_parameter.t | 85 +-
traffic_ops/app/t/api/1.2/region.t | 14 +-
traffic_ops/app/t/api/1.2/server.t | 310 +-
traffic_ops/app/t/api/1.2/server_create.t | 189 -
traffic_ops/app/t/api/1.2/stats_summary.t | 12 +-
traffic_ops/app/t/deliveryservice.t | 108 +-
traffic_ops/app/t/deliveryserviceserver.t | 25 +-
traffic_ops/app/t/health.t | 6 +-
traffic_ops/app/t/hwinfo.t | 2 +
traffic_ops/app/t/parameter.t | 4 +-
traffic_ops/app/t/phys_location.t | 6 +-
traffic_ops/app/t/profile.t | 6 -
traffic_ops/app/t/purge.t | 6 +-
traffic_ops/app/t/server.t | 18 +-
traffic_ops/app/t/staticdnsentry.t | 2 +-
traffic_ops/app/t/status.t | 88 -
traffic_ops/app/t/types.t | 82 -
traffic_ops/app/t/uploadhandlercsv.t | 57 -
traffic_ops/app/t/user.t | 16 +-
traffic_ops/app/t_integration/extensions.t | 8 +-
traffic_ops/app/t_integration/server.t | 73 +-
traffic_ops/build/traffic_ops.spec | 8 +-
traffic_ops/client/cachegroup.go | 5 +-
traffic_ops/client/cdn.go | 4 +-
traffic_ops/client/delivery_service.go | 8 +-
.../client/delivery_service_resources.go | 58 +-
traffic_ops/client/fixtures/cachegroup.go | 4 +-
traffic_ops/client/fixtures/cdn.go | 1 +
traffic_ops/client/fixtures/delivery_service.go | 52 +-
traffic_ops/client/fixtures/hardware.go | 15 +-
traffic_ops/client/fixtures/profile.go | 1 +
traffic_ops/client/fixtures/server.go | 22 +-
traffic_ops/client/fixtures/types.go | 2 +
traffic_ops/client/fixtures/user.go | 2 +-
traffic_ops/client/hardware.go | 10 +-
traffic_ops/client/parameter.go | 1 -
traffic_ops/client/profile.go | 2 +-
traffic_ops/client/server.go | 7 +-
traffic_ops/client/stats_summary.go | 1 -
traffic_ops/client/tests/cachegroup_test.go | 12 +-
traffic_ops/client/tests/cdn_test.go | 5 +
.../client/tests/delivery_service_test.go | 28 +-
traffic_ops/client/tests/hardware_test.go | 27 +-
traffic_ops/client/tests/integration/Readme.md | 14 +
.../client/tests/integration/cachegroup_test.go | 83 +
.../client/tests/integration/cdn_test.go | 106 +
.../client/tests/integration/crconfig_test.go | 40 +
.../tests/integration/deliveryservice_test.go | 696 +
.../client/tests/integration/hardware_test.go | 119 +
.../tests/integration/integration_helper.go | 136 +
.../client/tests/integration/parameter_test.go | 68 +
.../client/tests/integration/profile_test.go | 73 +
.../client/tests/integration/server_test.go | 236 +
.../tests/integration/stats_summary_test.go | 241 +
.../integration/traffic_monitor_config_test.go | 175 +
.../integration/traffic_router_config_test.go | 220 +
.../client/tests/integration/type_test.go | 73 +
.../client/tests/integration/user_test.go | 67 +
traffic_ops/client/tests/profile_test.go | 6 +
traffic_ops/client/tests/type_test.go | 12 +
traffic_ops/client/tests/user_test.go | 4 +-
traffic_ops/client/traffic_monitor_config.go | 1 -
traffic_ops/client/traffic_ops.go | 7 +-
traffic_ops/client/traffic_router_config.go | 1 -
traffic_ops/client/type.go | 2 +-
traffic_ops/client/user.go | 10 +-
.../src/common/models/DeliveryServicesModel.js | 6 +-
.../DashboardDeliveryServicesController.js | 2 +-
302 files changed, 52724 insertions(+), 10455 deletions(-)
----------------------------------------------------------------------
[28/50] incubator-trafficcontrol git commit: merge psql-rebase branch
Posted by mi...@apache.org.
merge psql-rebase branch
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/580c4c8d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/580c4c8d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/580c4c8d
Branch: refs/heads/master
Commit: 580c4c8d46ca344a29ea56378f9185288d9c9829
Parents: 4eaa1a7
Author: Dave Neuman <ne...@apache.org>
Authored: Fri Dec 2 15:21:59 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
.../app/lib/API/DeliveryServiceServer.pm | 3 +++
traffic_ops/app/lib/API/Deliveryservice.pm | 24 ++++++++++----------
traffic_ops/app/lib/API/HwInfo.pm | 1 +
.../client/delivery_service_resources.go | 2 +-
traffic_ops/client/fixtures/delivery_service.go | 2 +-
.../tests/integration/deliveryservice_test.go | 15 ++++++++++++
.../tests/integration/integration_helper.go | 24 +++++++++++++++++++-
7 files changed, 56 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/580c4c8d/traffic_ops/app/lib/API/DeliveryServiceServer.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/DeliveryServiceServer.pm b/traffic_ops/app/lib/API/DeliveryServiceServer.pm
index 0aec9cd..a142809 100644
--- a/traffic_ops/app/lib/API/DeliveryServiceServer.pm
+++ b/traffic_ops/app/lib/API/DeliveryServiceServer.pm
@@ -40,6 +40,9 @@ sub index {
}
);
}
+ #update to be ints
+ $limit += 0;
+ $page += 0;
$self->success( \@data, undef, $orderby, $limit, $page );
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/580c4c8d/traffic_ops/app/lib/API/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index 6df1a50..d202691 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -303,7 +303,7 @@ sub update {
my @response;
push(
@response, {
- "active" => \$rs->active,
+ "active" => $rs->active,
"cacheurl" => $rs->cacheurl,
"ccrDnsTtl" => $rs->ccr_dns_ttl,
"cdnId" => $rs->cdn->id,
@@ -326,9 +326,9 @@ sub update {
"id" => $rs->id,
"infoUrl" => $rs->info_url,
"initialDispersion" => $rs->initial_dispersion,
- "ipv6RoutingEnabled" => \$rs->ipv6_routing_enabled,
+ "ipv6RoutingEnabled" => $rs->ipv6_routing_enabled,
"lastUpdated" => $rs->last_updated,
- "logsEnabled" => \$rs->logs_enabled,
+ "logsEnabled" => $rs->logs_enabled,
"longDesc" => $rs->long_desc,
"longDesc1" => $rs->long_desc_1,
"longDesc2" => $rs->long_desc_2,
@@ -336,7 +336,7 @@ sub update {
"midHeaderRewrite" => $rs->mid_header_rewrite,
"missLat" => 0.0 + $rs->miss_lat,
"missLong" => 0.0 + $rs->miss_long,
- "multiSiteOrigin" => \$rs->multi_site_origin,
+ "multiSiteOrigin" => $rs->multi_site_origin,
"multiSiteOriginAlgorithm" => $rs->multi_site_origin_algorithm,
"orgServerFqdn" => $rs->org_server_fqdn,
"originShield" => $rs->origin_shield,
@@ -347,9 +347,9 @@ sub update {
"qstringIgnore" => $rs->qstring_ignore,
"rangeRequestHandling" => $rs->range_request_handling,
"regexRemap" => $rs->regex_remap,
- "regionalGeoBlocking" => \$rs->regional_geo_blocking,
+ "regionalGeoBlocking" => $rs->regional_geo_blocking,
"remapText" => $rs->remap_text,
- "signed" => \$rs->signed,
+ "signed" => $rs->signed,
"sslKeyVersion" => $rs->ssl_key_version,
"trRequestHeaders" => $rs->tr_request_headers,
"trResponseHeaders" => $rs->tr_response_headers,
@@ -444,7 +444,7 @@ sub create {
my @response;
push(
@response, {
- "active" => \$rs->active,
+ "active" => $rs->active,
"cacheurl" => $rs->cacheurl,
"ccrDnsTtl" => $rs->ccr_dns_ttl,
"cdnId" => $rs->cdn->id,
@@ -467,9 +467,9 @@ sub create {
"id" => $rs->id,
"infoUrl" => $rs->info_url,
"initialDispersion" => $rs->initial_dispersion,
- "ipv6RoutingEnabled" => \$rs->ipv6_routing_enabled,
+ "ipv6RoutingEnabled" => $rs->ipv6_routing_enabled,
"lastUpdated" => $rs->last_updated,
- "logsEnabled" => \$rs->logs_enabled,
+ "logsEnabled" => $rs->logs_enabled,
"longDesc" => $rs->long_desc,
"longDesc1" => $rs->long_desc_1,
"longDesc2" => $rs->long_desc_2,
@@ -477,7 +477,7 @@ sub create {
"midHeaderRewrite" => $rs->mid_header_rewrite,
"missLat" => $rs->miss_lat,
"missLong" => $rs->miss_long,
- "multiSiteOrigin" => \$rs->multi_site_origin,
+ "multiSiteOrigin" => $rs->multi_site_origin,
"multiSiteOriginAlgorithm" => $rs->multi_site_origin_algorithm,
"orgServerFqdn" => $rs->org_server_fqdn,
"originShield" => $rs->origin_shield,
@@ -488,9 +488,9 @@ sub create {
"qstringIgnore" => $rs->qstring_ignore,
"rangeRequestHandling" => $rs->range_request_handling,
"regexRemap" => $rs->regex_remap,
- "regionalGeoBlocking" => \$rs->regional_geo_blocking,
+ "regionalGeoBlocking" => $rs->regional_geo_blocking,
"remapText" => $rs->remap_text,
- "signed" => \$rs->signed,
+ "signed" => $rs->signed,
"sslKeyVersion" => $rs->ssl_key_version,
"trRequestHeaders" => $rs->tr_request_headers,
"trResponseHeaders" => $rs->tr_response_headers,
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/580c4c8d/traffic_ops/app/lib/API/HwInfo.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/HwInfo.pm b/traffic_ops/app/lib/API/HwInfo.pm
index 972f76a..15ef143 100644
--- a/traffic_ops/app/lib/API/HwInfo.pm
+++ b/traffic_ops/app/lib/API/HwInfo.pm
@@ -39,6 +39,7 @@ sub index {
}
);
}
+
$limit += 0; #converts to int.
$self->success( \@data, undef, undef, $limit, undef );
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/580c4c8d/traffic_ops/client/delivery_service_resources.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/delivery_service_resources.go b/traffic_ops/client/delivery_service_resources.go
index 26d64d8..be6667e 100644
--- a/traffic_ops/client/delivery_service_resources.go
+++ b/traffic_ops/client/delivery_service_resources.go
@@ -190,7 +190,7 @@ type DeliveryServiceServerResponse struct {
Response []DeliveryServiceServer `json:"response"`
Size int `json:"size"`
OrderBy string `json:"orderby"`
- Limit int `json:"limit"`
+ Limit string `json:"limit"`
}
// DeliveryServiceServer ...
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/580c4c8d/traffic_ops/client/fixtures/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/delivery_service.go b/traffic_ops/client/fixtures/delivery_service.go
index 2408cb6..8d600b3 100644
--- a/traffic_ops/client/fixtures/delivery_service.go
+++ b/traffic_ops/client/fixtures/delivery_service.go
@@ -177,7 +177,7 @@ func DeliveryServiceServer() *client.DeliveryServiceServerResponse {
return &client.DeliveryServiceServerResponse{
Response: []client.DeliveryServiceServer{dss},
- Size: "1",
+ Size: 1,
OrderBy: "foo",
Limit: "1",
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/580c4c8d/traffic_ops/client/tests/integration/deliveryservice_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/deliveryservice_test.go b/traffic_ops/client/tests/integration/deliveryservice_test.go
index 4b56058..036bb1f 100644
--- a/traffic_ops/client/tests/integration/deliveryservice_test.go
+++ b/traffic_ops/client/tests/integration/deliveryservice_test.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/580c4c8d/traffic_ops/client/tests/integration/integration_helper.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/integration_helper.go b/traffic_ops/client/tests/integration/integration_helper.go
index 675934d..2468a2c 100644
--- a/traffic_ops/client/tests/integration/integration_helper.go
+++ b/traffic_ops/client/tests/integration/integration_helper.go
@@ -1,3 +1,18 @@
+/*
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
package integration
import (
@@ -66,11 +81,18 @@ func GetType(useInTable string) (traffic_ops.Type, error) {
}
//GetDeliveryService returns a DeliveryService Struct
-func GetDeliveryService() (traffic_ops.DeliveryService, error) {
+func GetDeliveryService(cdn string) (traffic_ops.DeliveryService, error) {
dss, err := to.DeliveryServices()
if err != nil {
return *new(traffic_ops.DeliveryService), err
}
+ if cdn != "" {
+ for _, ds := range dss {
+ if ds.CDNName == cdn {
+ return ds, nil
+ }
+ }
+ }
return dss[0], nil
}
[24/50] incubator-trafficcontrol git commit: update user response to
have 'response' field to be consistent with other API responses
Posted by mi...@apache.org.
update user response to have 'response' field to be consistent with other API responses
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/7ed3faba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/7ed3faba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/7ed3faba
Branch: refs/heads/master
Commit: 7ed3faba020e561c86aa08dbf3b32345560613e1
Parents: f706d99
Author: Dave Neuman <ne...@apache.org>
Authored: Tue Dec 6 16:09:48 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/lib/API/User.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/7ed3faba/traffic_ops/app/lib/API/User.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/User.pm b/traffic_ops/app/lib/API/User.pm
index fab4b85..690b176 100644
--- a/traffic_ops/app/lib/API/User.pm
+++ b/traffic_ops/app/lib/API/User.pm
@@ -101,7 +101,7 @@ sub index {
}
);
}
- $self->render( json => \@data );
+ $self->success( \@data );
}
sub show {
[19/50] incubator-trafficcontrol git commit: added test for servers
Posted by mi...@apache.org.
added test for servers
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d2478158
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d2478158
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d2478158
Branch: refs/heads/master
Commit: d2478158d71b89c86095aa4dfe1d8c5f7dffaf9c
Parents: 72d99eb
Author: David Neuman <da...@gmail.com>
Authored: Mon Dec 5 10:41:58 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
.../client/tests/integration/server_test.go | 221 +++++++++++++++++++
1 file changed, 221 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d2478158/traffic_ops/client/tests/integration/server_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/integration/server_test.go b/traffic_ops/client/tests/integration/server_test.go
new file mode 100644
index 0000000..ba50f3a
--- /dev/null
+++ b/traffic_ops/client/tests/integration/server_test.go
@@ -0,0 +1,221 @@
+package integration
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/url"
+ "testing"
+
+ traffic_ops "github.com/apache/incubator-trafficcontrol/traffic_ops/client"
+)
+
+func TestServers(t *testing.T) {
+
+ uri := fmt.Sprintf("/api/1.2/servers.json")
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiServerRes traffic_ops.ServerResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiServerRes); err != nil {
+ t.Errorf("Could not decode server json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiServers := apiServerRes.Response
+
+ clientServers, err := to.Servers()
+ if err != nil {
+ t.Errorf("Could not get servers from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiServers) != len(clientServers) {
+ t.Errorf("Server Response Length -- expected %v, got %v\n", len(apiServers), len(clientServers))
+ }
+
+ for _, apiServer := range apiServers {
+ match := false
+ for _, clientServer := range clientServers {
+ if apiServer.ID == clientServer.ID {
+ match = true
+ compareServer(apiServer, clientServer, t)
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a server matching %v\n", apiServer.ID)
+ }
+ }
+}
+
+func TestServersByType(t *testing.T) {
+ serverType, err := GetType("server")
+ if err != nil {
+ t.Error("Could not get Type from client for TestServersByType")
+ t.FailNow()
+ }
+ uri := fmt.Sprintf("/api/1.2/servers.json?type=%s", serverType.Name)
+ resp, err := Request(*to, "GET", uri, nil)
+ if err != nil {
+ t.Errorf("Could not get %s reponse was: %v\n", uri, err)
+ t.FailNow()
+ }
+
+ defer resp.Body.Close()
+ var apiServerRes traffic_ops.ServerResponse
+ if err := json.NewDecoder(resp.Body).Decode(&apiServerRes); err != nil {
+ t.Errorf("Could not decode server json. Error is: %v\n", err)
+ t.FailNow()
+ }
+ apiServers := apiServerRes.Response
+
+ params := make(url.Values)
+ params.Add("type", serverType.Name)
+ clientServers, err := to.ServersByType(params)
+ if err != nil {
+ t.Errorf("Could not get servers from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ if len(apiServers) != len(clientServers) {
+ t.Errorf("Server Response Length -- expected %v, got %v\n", len(apiServers), len(clientServers))
+ }
+
+ for _, apiServer := range apiServers {
+ match := false
+ for _, clientServer := range clientServers {
+ if apiServer.ID == clientServer.ID {
+ match = true
+ compareServer(apiServer, clientServer, t)
+ }
+ }
+ if !match {
+ t.Errorf("Did not get a server matching %v\n", apiServer.ID)
+ }
+ }
+
+}
+
+func TestServersFQDN(t *testing.T) {
+ serverType, err := GetType("server")
+ if err != nil {
+ t.Error("Could not get Type from client")
+ t.FailNow()
+ }
+
+ params := make(url.Values)
+ params.Add("type", serverType.Name)
+ servers, err := to.ServersByType(params)
+ if err != nil {
+ t.Errorf("Could not get servers from client. Error is: %v\n", err)
+ t.FailNow()
+ }
+
+ serverFQDN := fmt.Sprintf("%s.%s", servers[0].HostName, servers[0].DomainName)
+
+ clientFQDN, err := to.ServersFqdn(servers[0].HostName)
+ if err != nil {
+ t.Errorf("Servers FQDN failed...err: %v\n", err)
+ }
+ if clientFQDN != serverFQDN {
+ t.Errorf("Client FQDN -- expected %v, got %v", serverFQDN, clientFQDN)
+ }
+}
+
+func compareServer(server1 traffic_ops.Server, server2 traffic_ops.Server, t *testing.T) {
+ if server1.CDNName != server2.CDNName {
+ t.Errorf("CDNName -- Expected %v, got %v", server1.CDNName, server2.CDNName)
+ }
+ if server1.Cachegroup != server2.Cachegroup {
+ t.Errorf("Cachegroup -- Expected %v, got %v", server1.Cachegroup, server2.Cachegroup)
+ }
+ if server1.DomainName != server2.DomainName {
+ t.Errorf("DomainName -- Expected %v, got %v", server1.DomainName, server2.DomainName)
+ }
+ if server1.HostName != server2.HostName {
+ t.Errorf("HostName -- Expected %v, got %v", server1.HostName, server2.HostName)
+ }
+ if server1.IP6Address != server2.IP6Address {
+ t.Errorf("IP6Address -- Expected %v, got %v", server1.IPAddress, server2.IP6Address)
+ }
+ if server1.IP6Gateway != server2.IP6Gateway {
+ t.Errorf("IP6Gateway -- Expected %v, got %v", server1.IP6Gateway, server2.IP6Gateway)
+ }
+ if server1.IPAddress != server2.IPAddress {
+ t.Errorf("IPAddress -- Expected %v, got %v", server1.IPAddress, server2.IPAddress)
+ }
+ if server1.IPGateway != server2.IPGateway {
+ t.Errorf("IPGateway -- Expected %v, got %v", server1.IPGateway, server2.IPGateway)
+ }
+ if server1.IPNetmask != server2.IPNetmask {
+ t.Errorf("IPNetmask -- Expected %v, got %v", server1.IPNetmask, server2.IPNetmask)
+ }
+ if server1.IloIPAddress != server2.IloIPAddress {
+ t.Errorf("IloIPAddress -- Expected %v, got %v", server1.IloIPAddress, server2.IloIPAddress)
+ }
+ if server1.IloIPGateway != server2.IloIPGateway {
+ t.Errorf("IloIPGateway -- Expected %v, got %v", server1.IloIPGateway, server2.IloIPGateway)
+ }
+ if server1.IloIPNetmask != server2.IloIPNetmask {
+ t.Errorf("IloIPNetmast -- Expected %v, got %v", server1.IloIPNetmask, server2.IloIPNetmask)
+ }
+ if server1.IloPassword != server2.IloPassword {
+ t.Errorf("IloPassword -- Expected %v, got %v", server1.IloPassword, server2.IloPassword)
+ }
+ if server1.IloUsername != server2.IloUsername {
+ t.Errorf("IloUsername -- Expected %v, got %v", server1.IloUsername, server2.IloUsername)
+ }
+ if server1.InterfaceMtu != server2.InterfaceMtu {
+ t.Errorf("InterfaceMty -- Expected %v, got %v", server1.InterfaceMtu, server2.InterfaceMtu)
+ }
+ if server1.InterfaceName != server2.InterfaceName {
+ t.Errorf("InterfaceName -- Expected %v, got %v", server1.InterfaceName, server2.InterfaceName)
+ }
+ if server1.LastUpdated != server2.LastUpdated {
+ t.Errorf("LastUpdated -- Expected %v, got %v", server1.LastUpdated, server2.LastUpdated)
+ }
+ if server1.MgmtIPAddress != server2.MgmtIPAddress {
+ t.Errorf("MgmtIPAddress -- Expected %v, got %v", server1.MgmtIPAddress, server2.MgmtIPAddress)
+ }
+ if server1.MgmtIPGateway != server2.MgmtIPGateway {
+ t.Errorf("MgmtIPGateway -- Expected %v, got %v", server1.MgmtIPGateway, server2.MgmtIPGateway)
+ }
+ if server1.MgmtIPNetmask != server2.MgmtIPNetmask {
+ t.Errorf("MgmtIPNetmask -- Expected %v, got %v", server1.MgmtIPNetmask, server2.MgmtIPNetmask)
+ }
+ if server1.PhysLocation != server2.PhysLocation {
+ t.Errorf("PhysLocation -- Expected %v, got %v", server1.PhysLocation, server2.PhysLocation)
+ }
+ if server1.Profile != server2.Profile {
+ t.Errorf("Profile -- Expected %v, got %v", server1.Profile, server2.Profile)
+ }
+ if server1.ProfileDesc != server2.ProfileDesc {
+ t.Errorf("ProfileDesc -- Expected %v, got %v", server1.ProfileDesc, server2.ProfileDesc)
+ }
+ if server1.Rack != server2.Rack {
+ t.Errorf("Rack -- Expected %v, got %v", server1.Rack, server2.Rack)
+ }
+ if server1.RouterHostName != server2.RouterHostName {
+ t.Errorf("RouterHostName -- Expected %v, got %v", server1.RouterHostName, server2.RouterHostName)
+ }
+ if server1.RouterPortName != server2.RouterPortName {
+ t.Errorf("RouterPortName -- Expected %v, got %v", server1.RouterPortName, server2.RouterPortName)
+ }
+ if server1.Status != server2.Status {
+ t.Errorf("Status -- Expected %v, got %v", server1.Status, server2.Status)
+ }
+ if server1.TCPPort != server2.TCPPort {
+ t.Errorf("TCPPort -- Expected %v, got %v", server1.TCPPort, server2.TCPPort)
+ }
+ if server1.Type != server2.Type {
+ t.Errorf("Type -- Expected %v, got %v", server1.Type, server2.Type)
+ }
+ if server1.XMPPID != server2.XMPPID {
+ t.Errorf("XMPPID -- Expected %v, got %v", server1.XMPPID, server2.XMPPID)
+ }
+ if server1.XMPPPasswd != server2.XMPPPasswd {
+ t.Errorf("XMPPasswd -- Expected %v, got %v", server1.XMPPPasswd, server2.XMPPPasswd)
+ }
+}
[12/50] incubator-trafficcontrol git commit: update profile test to
log correct error for ID
Posted by mi...@apache.org.
update profile test to log correct error for ID
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/33d12055
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/33d12055
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/33d12055
Branch: refs/heads/master
Commit: 33d1205537407f2763eb2f1e2b5bb8d04fcb8b8d
Parents: b5831f4
Author: David Neuman <da...@gmail.com>
Authored: Wed Nov 30 10:19:50 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/tests/profile_test.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/33d12055/traffic_ops/client/tests/profile_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/profile_test.go b/traffic_ops/client/tests/profile_test.go
index 7c89897..46ecced 100644
--- a/traffic_ops/client/tests/profile_test.go
+++ b/traffic_ops/client/tests/profile_test.go
@@ -52,7 +52,7 @@ func TestProfile(t *testing.T) {
for _, p := range profiles {
if p.ID != 1 {
- testHelper.Error(t, "Should get back 1 for \"ID\", got: %s", p.Name)
+ testHelper.Error(t, "Should get back 1 for \"ID\", got: %d", p.ID)
} else {
testHelper.Success(t, "Should get back 1 for \"ID\"")
}
[29/50] incubator-trafficcontrol git commit: fixed tests
Posted by mi...@apache.org.
fixed tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f78e8fb8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f78e8fb8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f78e8fb8
Branch: refs/heads/master
Commit: f78e8fb8004f333764b46f00f06c6e6f6085ef2f
Parents: 8f20dad
Author: David Neuman <da...@gmail.com>
Authored: Wed Dec 7 11:19:47 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:00 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/fixtures/delivery_service.go | 2 +-
traffic_ops/client/tests/user_test.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f78e8fb8/traffic_ops/client/fixtures/delivery_service.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/delivery_service.go b/traffic_ops/client/fixtures/delivery_service.go
index 8d600b3..d48879b 100644
--- a/traffic_ops/client/fixtures/delivery_service.go
+++ b/traffic_ops/client/fixtures/delivery_service.go
@@ -179,7 +179,7 @@ func DeliveryServiceServer() *client.DeliveryServiceServerResponse {
Response: []client.DeliveryServiceServer{dss},
Size: 1,
OrderBy: "foo",
- Limit: "1",
+ Limit: 1,
}
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f78e8fb8/traffic_ops/client/tests/user_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/user_test.go b/traffic_ops/client/tests/user_test.go
index bcddcce..478d3f1 100644
--- a/traffic_ops/client/tests/user_test.go
+++ b/traffic_ops/client/tests/user_test.go
@@ -26,7 +26,7 @@ import (
func TestUsers(t *testing.T) {
resp := fixtures.Users()
- server := testHelper.ValidHTTPServer(resp.Response)
+ server := testHelper.ValidHTTPServer(resp)
defer server.Close()
var httpClient http.Client
[45/50] incubator-trafficcontrol git commit: Add Snapshot db cleanup
for test
Posted by mi...@apache.org.
Add Snapshot db cleanup for test
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a964b50a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a964b50a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a964b50a
Branch: refs/heads/master
Commit: a964b50a6a09d4c5ad3f73a90df59a8e58093598
Parents: 0df488b
Author: Jan van Doorn <ja...@cable.comcast.com>
Authored: Thu Dec 29 13:19:43 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:29 2017 -0700
----------------------------------------------------------------------
traffic_ops/app/lib/Test/IntegrationTestHelper.pm | 1 +
traffic_ops/app/lib/Test/TestHelper.pm | 1 +
2 files changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a964b50a/traffic_ops/app/lib/Test/IntegrationTestHelper.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Test/IntegrationTestHelper.pm b/traffic_ops/app/lib/Test/IntegrationTestHelper.pm
index f0c1eef..1abf9d2 100644
--- a/traffic_ops/app/lib/Test/IntegrationTestHelper.pm
+++ b/traffic_ops/app/lib/Test/IntegrationTestHelper.pm
@@ -191,6 +191,7 @@ sub unload_core_data {
$self->teardown( $schema, 'PhysLocation' );
$self->teardown( $schema, 'Region' );
$self->teardown( $schema, 'Division' );
+ $self->teardown( $schema, 'Snapshot' );
$self->teardown( $schema, 'Cdn' );
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a964b50a/traffic_ops/app/lib/Test/TestHelper.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Test/TestHelper.pm b/traffic_ops/app/lib/Test/TestHelper.pm
index f5d5756..2b53dcd 100644
--- a/traffic_ops/app/lib/Test/TestHelper.pm
+++ b/traffic_ops/app/lib/Test/TestHelper.pm
@@ -151,6 +151,7 @@ sub unload_core_data {
$self->teardown($schema, 'ProfileParameter');
$self->teardown($schema, 'Type');
$self->teardown($schema, 'Status');
+ $self->teardown( $schema, 'Snapshot' );
$self->teardown($schema, 'Cdn');
}