trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [incubator-trafficcontrol] 26/36: Change deep_caching_type from an int to an ENUM
Date Wed, 24 Jan 2018 17:23:35 GMT
This is an automated email from the ASF dual-hosted git repository.

elsloo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git

commit d8612e76afa587cf8387bc1a142255787d4c2c23
Author: Rawlin Peters <rawlin_peters@comcast.com>
AuthorDate: Thu Nov 9 16:50:36 2017 -0700

    Change deep_caching_type from an int to an ENUM
---
 lib/go-tc/deliveryservices.go                      |  2 +-
 .../20171101000000_add_deep_caching_type.sql       |  8 ++++--
 traffic_ops/app/lib/API/Deliveryservice.pm         |  2 +-
 traffic_ops/app/lib/Fixtures/Deliveryservice.pm    | 30 +++++++++++-----------
 .../lib/Fixtures/Integration/Deliveryservice.pm    | 16 ++++++------
 .../app/lib/Schema/Result/Deliveryservice.pm       | 26 +++++++++++--------
 traffic_ops/app/t/api/1.2/deliveryservice.t        | 10 ++++----
 traffic_ops/app/t/api/1.2/deliveryservice_crud.t   | 26 +++++++++----------
 traffic_ops/app/t/deliveryservice.t                | 10 ++++----
 .../app/templates/delivery_service/_form.html.ep   |  9 +++----
 .../client_tests/fixtures/delivery_service.go      |  2 +-
 .../client_tests/fixtures/traffic_router_config.go |  2 +-
 .../tests/integration/deliveryservice_test.go      |  2 +-
 .../FormDeliveryServiceController.js               |  4 +--
 14 files changed, 77 insertions(+), 72 deletions(-)

diff --git a/lib/go-tc/deliveryservices.go b/lib/go-tc/deliveryservices.go
index 6c1f381..b27b655 100644
--- a/lib/go-tc/deliveryservices.go
+++ b/lib/go-tc/deliveryservices.go
@@ -56,7 +56,7 @@ type DeliveryService struct {
 	Active               bool                   `json:"active"`
 	DSCP                 int                    `json:"dscp"`
 	RoutingName          string                 `json:"routingName"`
-	DeepCachingType      int                    `json:"deepCachingType"`
+	DeepCachingType      string                 `json:"deepCachingType"`
 	Signed               bool                   `json:"signed"`
 	QStringIgnore        int                    `json:"qstringIgnore"`
 	GeoLimit             int                    `json:"geoLimit"`
diff --git a/traffic_ops/app/db/migrations/20171101000000_add_deep_caching_type.sql b/traffic_ops/app/db/migrations/20171101000000_add_deep_caching_type.sql
index 17c78cc..7c6d94b 100644
--- a/traffic_ops/app/db/migrations/20171101000000_add_deep_caching_type.sql
+++ b/traffic_ops/app/db/migrations/20171101000000_add_deep_caching_type.sql
@@ -15,9 +15,13 @@
 -- +goose Up
 -- SQL in section 'Up' is executed when this migration is applied
 
-alter table deliveryservice add column deep_caching_type smallint default 0;
+CREATE TYPE deep_caching_type AS ENUM ('NEVER', 'ALWAYS');
+
+ALTER TABLE deliveryservice ADD COLUMN deep_caching_type deep_caching_type DEFAULT 'NEVER';
 
 -- +goose Down
 -- SQL section 'Down' is executed when this migration is rolled back
 
- alter table deliveryservice drop column deep_caching_type;
+ALTER TABLE deliveryservice DROP COLUMN IF EXISTS deep_caching_type;
+
+DROP TYPE IF EXISTS deep_caching_type;
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index b78b5a7..675c1da 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -1387,7 +1387,7 @@ sub is_deliveryservice_valid {
 			active				=> [ is_required("is required") ],
 			cdnId				=> [ is_required("is required"), \&is_valid_int_or_undef ],
 			ccrDnsTtl			=> [ \&is_valid_int_or_undef ],
-			deepCachingType      => [ is_like( qr/^[01]$/, "must be 0 (never) or 1 (always)" )
],
+			deepCachingType      => [ is_like( qr/^NEVER|ALWAYS$/, "must be NEVER or ALWAYS" )
],
 			dnsBypassTtl			=> [ \&is_valid_int_or_undef ],
 			dscp				=> [ is_required("is required"), \&is_valid_int_or_undef ],
 			displayName			=> [ is_required("is required"), is_long_at_most( 48, 'too long' ) ],
diff --git a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm
index 7cd06dc..4069ccc 100644
--- a/traffic_ops/app/lib/Fixtures/Deliveryservice.pm
+++ b/traffic_ops/app/lib/Fixtures/Deliveryservice.pm
@@ -27,7 +27,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -67,7 +67,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -107,7 +107,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -147,7 +147,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -187,7 +187,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -227,7 +227,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -267,7 +267,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -305,7 +305,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -343,7 +343,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -381,7 +381,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -419,7 +419,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -457,7 +457,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -495,7 +495,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -533,7 +533,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => 10**9,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
@@ -573,7 +573,7 @@ my %definition_for = (
 			active                => 1,
 			tenant_id             => undef,
 			dscp                  => 40,
-			deep_caching_type     => 0,
+			deep_caching_type     => 'NEVER',
 			routing_name          => 'foo',
 			qstring_ignore        => 0,
 			geo_limit             => 0,
diff --git a/traffic_ops/app/lib/Fixtures/Integration/Deliveryservice.pm b/traffic_ops/app/lib/Fixtures/Integration/Deliveryservice.pm
index 6578119..c4e3a3a 100644
--- a/traffic_ops/app/lib/Fixtures/Integration/Deliveryservice.pm
+++ b/traffic_ops/app/lib/Fixtures/Integration/Deliveryservice.pm
@@ -47,7 +47,7 @@ my %definition_for = (
 			type                        => '16',
 			dns_bypass_ip6              => undef,
 			dscp                        => '40',
-			deep_caching_type           => 0,
+			deep_caching_type           => 'NEVER',
 			routing_name                => 'foo',
 			mid_header_rewrite          => 'cond %{REMAP_PSEUDO_HOOK} __RETURN__ set-config proxy.config.http.parent_origin.dead_server_retry_enabled
1',
 			active                      => '1',
@@ -122,7 +122,7 @@ my %definition_for = (
 			max_dns_answers             => '0',
 			miss_lat                    => '41.881944',
 			dscp                        => '40',
-			deep_caching_type           => 0,
+			deep_caching_type           => 'NEVER',
 			routing_name                => 'foo',
 			mid_header_rewrite          => undef,
 			regex_remap                 => undef,
@@ -145,7 +145,7 @@ my %definition_for = (
 			qstring_ignore              => '0',
 			ccr_dns_ttl                 => '3600',
 			dscp                        => '40',
-			deep_caching_type           => 0,
+			deep_caching_type           => 'NEVER',
 			routing_name                => 'foo',
 			last_updated                => '2015-12-10 15:44:37',
 			org_server_fqdn             => 'http://images.origin.kabletown.net',
@@ -197,7 +197,7 @@ my %definition_for = (
 			mid_header_rewrite	 				=>
 				'cond %{REMAP_PSEUDO_HOOK} __RETURN__ set-config proxy.config.http.parent_origin.dead_server_retry_enabled
1__RETURN__ set-config proxy.config.http.parent_origin.simple_retry_enabled 1__RETURN__ set-config
proxy.config.http.parent_origin.simple_retry_response_codes "400,404,412"__RETURN__ set-config
proxy.config.http.parent_origin.dead_server_retry_response_codes "502,503" __RETURN__ set-config
proxy.config.http.connect_attempts_timeout 2 __RETURN__ set-config proxy.config.http.conne
[...]
 			dscp                        => '40',
-			deep_caching_type           => 0,
+			deep_caching_type           => 'NEVER',
 			routing_name                => 'foo',
 			info_url                    => 'http://movies.info.kabletown.net',
 			last_updated                => '2015-12-10 15:44:37',
@@ -255,7 +255,7 @@ my %definition_for = (
 			regex_remap                 => undef,
 			dns_bypass_ip6              => undef,
 			dscp                        => '40',
-			deep_caching_type           => 0,
+			deep_caching_type           => 'NEVER',
 			routing_name                => 'foo',
 			range_request_handling      => '0',
 			display_name                => 'tv-c1',
@@ -310,7 +310,7 @@ my %definition_for = (
 			check_path                  => '/crossdomain.xml',
 			dns_bypass_cname            => undef,
 			dscp                        => '40',
-			deep_caching_type           => 0,
+			deep_caching_type           => 'NEVER',
 			routing_name                => 'foo',
 			remap_text                  => undef,
 			global_max_mbps             => '0',
@@ -362,7 +362,7 @@ my %definition_for = (
 			ccr_dns_ttl                 => '3600',
 			dns_bypass_cname            => undef,
 			dscp                        => '40',
-			deep_caching_type           => 0,
+			deep_caching_type           => 'NEVER',
 			routing_name                => 'foo',
 			global_max_tps              => '0',
 			initial_dispersion          => '1',
@@ -401,7 +401,7 @@ my %definition_for = (
 			signing_algorithm           => undef,
 			dns_bypass_cname            => undef,
 			dscp                        => '40',
-			deep_caching_type           => 0,
+			deep_caching_type           => 'NEVER',
 			routing_name                => 'foo',
 			geo_limit                   => '0',
 			initial_dispersion          => '1',
diff --git a/traffic_ops/app/lib/Schema/Result/Deliveryservice.pm b/traffic_ops/app/lib/Schema/Result/Deliveryservice.pm
index d2e64f8..b458b40 100644
--- a/traffic_ops/app/lib/Schema/Result/Deliveryservice.pm
+++ b/traffic_ops/app/lib/Schema/Result/Deliveryservice.pm
@@ -49,7 +49,6 @@ __PACKAGE__->table("deliveryservice");
 =head2 signing_algorithm
 
   data_type: 'deliveryservice_signature_type'
-  default_value: null
   is_nullable: 1
 
 =head2 qstring_ignore
@@ -302,8 +301,9 @@ __PACKAGE__->table("deliveryservice");
 
 =head2 deep_caching_type
 
-  data_type: 'smallint'
-  default_value: 0
+  data_type: 'enum'
+  default_value: 'NEVER'
+  extra: {custom_type_name => "deep_caching_type",list => ["NEVER","ALWAYS"]}
   is_nullable: 1
 
 =cut
@@ -323,11 +323,7 @@ __PACKAGE__->add_columns(
   "dscp",
   { data_type => "bigint", is_nullable => 0 },
   "signing_algorithm",
-  {
-    data_type     => "deliveryservice_signature_type",
-    default_value => \"null",
-    is_nullable   => 1,
-  },
+  { data_type => "deliveryservice_signature_type", is_nullable => 1 },
   "qstring_ignore",
   { data_type => "smallint", is_nullable => 1 },
   "geo_limit",
@@ -426,7 +422,15 @@ __PACKAGE__->add_columns(
   "routing_name",
   { data_type => "text", default_value => "cdn", is_nullable => 0 },
   "deep_caching_type",
-  { data_type => "smallint", default_value => 0, is_nullable => 1 },
+  {
+    data_type => "enum",
+    default_value => "NEVER",
+    extra => {
+      custom_type_name => "deep_caching_type",
+      list => ["NEVER", "ALWAYS"],
+    },
+    is_nullable => 1,
+  },
 );
 
 =head1 PRIMARY KEY
@@ -662,8 +666,8 @@ __PACKAGE__->belongs_to(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-10-12 15:07:17
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JOlBU3gXo4iidTQarqMAcA
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-11-09 14:44:59
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IA1IQ3w/BEYermjf9PoVtA
 
 # You can replace this text with custom code or comments, and it will be preserved on regeneration
 #
diff --git a/traffic_ops/app/t/api/1.2/deliveryservice.t b/traffic_ops/app/t/api/1.2/deliveryservice.t
index 6c3f3bf..c34eb76 100644
--- a/traffic_ops/app/t/api/1.2/deliveryservice.t
+++ b/traffic_ops/app/t/api/1.2/deliveryservice.t
@@ -82,7 +82,7 @@ $t->get_ok('/api/1.2/deliveryservices/100/servers/eligible')->status_is(200)->$c
 ok $t->get_ok("/api/1.2/deliveryservices")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}
} )
 		->json_is( "/response/0/xmlId", "steering-ds1" )
 		->json_is( "/response/0/routingName", "foo" )
-		->json_is( "/response/0/deepCachingType", 0 )
+		->json_is( "/response/0/deepCachingType", "NEVER" )
 		->json_is( "/response/0/logsEnabled", 0 )
 		->json_is( "/response/0/ipv6RoutingEnabled", 1 )
 		->json_is( "/response/1/xmlId", "steering-ds2" );
@@ -230,7 +230,7 @@ ok $t->get_ok("/api/1.2/deliveryservices?logsEnabled=true")->status_is(200)->or(
         ->json_is( "/response/0/tenantId" => $tenant_id)
         ->json_is( "/response/0/cdnName" => "cdn1")
 		->json_is( "/response/0/routingName" => "foo")
-		->json_is( "/response/0/deepCachingType" => 0)
+		->json_is( "/response/0/deepCachingType" => "NEVER")
 		->json_is( "/response/0/displayName" => "ds_displayname_1")
 		->json_is( "/response/0/xmlId" => "ds_1")
 		->json_is( "/response/0/multiSiteOrigin" => 0)
@@ -269,7 +269,7 @@ ok $t->get_ok("/api/1.2/deliveryservices?logsEnabled=true")->status_is(200)->or(
 		->json_is( "/response/0/displayName" => "ds_displayname_11")
 		->json_is( "/response/0/xmlId" => "ds_1")
 		->json_is( "/response/0/routingName" => "bar")
-		->json_is( "/response/0/deepCachingType" => 0)
+		->json_is( "/response/0/deepCachingType" => "NEVER")
 		->json_is( "/response/0/multiSiteOrigin" => 0)
 		->json_is( "/response/0/orgServerFqdn" => "http://10.75.168.91")
 		->json_is( "/response/0/protocol" => 2)
@@ -282,7 +282,7 @@ ok $t->get_ok("/api/1.2/deliveryservices?logsEnabled=true")->status_is(200)->or(
 				"displayName" => "ds_displayname_11",
 				"dscp" => 1,
 				"routingName" => "baz",
-				"deepCachingType" => 0,
+				"deepCachingType" => "NEVER",
 				"geoLimit" => 1,
 				"geoProvider" => 1,
 				"ipv6RoutingEnabled" => 1,
@@ -312,7 +312,7 @@ ok $t->get_ok("/api/1.2/deliveryservices?logsEnabled=true")->status_is(200)->or(
 				"displayName" => "ds_displayname_11",
 				"dscp" => 1,
 				"routingName" => "foo",
-				"deepCachingType" => 0,
+				"deepCachingType" => "NEVER",
 				"geoLimit" => 1,
 				"geoProvider" => 1,
 				"initialDispersion" => 2,
diff --git a/traffic_ops/app/t/api/1.2/deliveryservice_crud.t b/traffic_ops/app/t/api/1.2/deliveryservice_crud.t
index cb36541..fe666d0 100644
--- a/traffic_ops/app/t/api/1.2/deliveryservice_crud.t
+++ b/traffic_ops/app/t/api/1.2/deliveryservice_crud.t
@@ -62,7 +62,7 @@ sub run_ut {
 	ok $t->get_ok("/api/1.2/deliveryservices")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}
} )
 			->json_is( "/response/0/xmlId", "steering-ds1" )
 			->json_is( "/response/0/routingName", "foo" )
-			->json_is( "/response/0/deepCachingType", 0)
+			->json_is( "/response/0/deepCachingType", "NEVER")
 			->json_is( "/response/0/logsEnabled", 0 )
 			->json_is( "/response/0/ipv6RoutingEnabled", 1 )
 			->json_is( "/response/1/xmlId", "steering-ds2" );
@@ -144,7 +144,7 @@ sub run_ut {
         	"active" => "false",
         	"dscp" => 0,
         	"routingName" => "foo",
-			"deepCachingType" => 0,
+        	"deepCachingType" => "NEVER",
         	"ipv6RoutingEnabled" => "true",
         	"logsEnabled" => "true",
         	"initialDispersion" => 1,
@@ -161,7 +161,7 @@ sub run_ut {
 	    ->json_is( "/response/0/orgServerFqdn" => "http://10.75.168.91")
 	    ->json_is( "/response/0/cdnId" => 100)
 	    ->json_is( "/response/0/routingName" => "foo")
-	    ->json_is( "/response/0/deepCachingType" => 0)
+	    ->json_is( "/response/0/deepCachingType" => "NEVER")
 	    ->json_is( "/response/0/tenantId" => $tenant_id)
 	    ->json_is( "/response/0/profileId" => 300)
 	    ->json_is( "/response/0/protocol" => "1")
@@ -180,7 +180,7 @@ sub run_ut {
 	    ->json_is( "/response/0/orgServerFqdn" => "http://10.75.168.91")
 	    ->json_is( "/response/0/cdnId" => 100)
 	    ->json_is( "/response/0/routingName" => "foo")
-	    ->json_is( "/response/0/deepCachingType" => 0)
+	    ->json_is( "/response/0/deepCachingType" => "NEVER")
 	    ->json_is( "/response/0/tenantId" => $tenant_id)
 	    ->json_is( "/response/0/tenant" => $tenant_name)
 	    ->json_is( "/response/0/profileId" => 300)
@@ -208,7 +208,7 @@ sub run_ut {
 	        "active" => "false",
 	        "dscp" => 0,
 	        "routingName" => "foo",
-	        "deepCachingType" => 0,
+	        "deepCachingType" => "NEVER",
 	        "ipv6RoutingEnabled" => "true",
 	        "logsEnabled" => "true",
 	        "initialDispersion" => 1,
@@ -251,7 +251,7 @@ sub run_ut {
 					"active"               => "false",
 					"dscp"                 => 0,
 					"routingName"          => "foo",
-					"deepCachingType"      => 0,
+					"deepCachingType"      => "NEVER",
 					"ipv6RoutingEnabled"   => "true",
 					"logsEnabled"          => "true",
 					"initialDispersion"    => 1,
@@ -285,7 +285,7 @@ sub run_ut {
 					"active"               => "false",
 					"dscp"                 => 0,
 					"routingName"          => "foo",
-					"deepCachingType"      => 0,
+					"deepCachingType"      => "NEVER",
 					"ipv6RoutingEnabled"   => "true",
 					"logsEnabled"          => "true",
 					"initialDispersion"    => 1,
@@ -319,7 +319,7 @@ sub run_ut {
        	        "active" => "false",
        	        "dscp" => 0,
        	        "routingName" => "foo",
-       	        "deepCachingType" => 0,
+       	        "deepCachingType" => "NEVER",
        	        "ipv6RoutingEnabled" => "true",
        	        "logsEnabled" => "true",
        	        "initialDispersion" => 1,
@@ -353,7 +353,7 @@ sub run_ut {
        	        "active" => "false",
        	        "dscp" => 0,
        	        "routingName" => "foo",
-       	        "deepCachingType" => 0,
+       	        "deepCachingType" => "NEVER",
        	        "ipv6RoutingEnabled" => "true",
        	        "logsEnabled" => "true",
        	        "initialDispersion" => 1,
@@ -388,7 +388,7 @@ sub run_ut {
        	        "active" => "false",
        	        "dscp" => 0,
        	        "routingName" => "foo",
-       	        "deepCachingType" => 0,
+       	        "deepCachingType" => "NEVER",
        	        "ipv6RoutingEnabled" => "true",
        	        "logsEnabled" => "true",
        	        "initialDispersion" => 1,
@@ -423,7 +423,7 @@ sub run_ut {
 	        "active" => "false",
 	        "dscp" => 0,
 	        "routingName" => "foo",
-	        "deepCachingType" => 0,
+	        "deepCachingType" => "NEVER",
 	        "ipv6RoutingEnabled" => "true",
 	        "logsEnabled" => "true",
 	        "initialDispersion" => 1,
@@ -474,7 +474,7 @@ sub run_ut {
         "active" => "false",
         "dscp" => 0,
         "routingName" => "foo",
-        "deepCachingType" => 0,
+        "deepCachingType" => "NEVER",
         "ipv6RoutingEnabled" => "true",
         "logsEnabled" => "true",
         "initialDispersion" => 1,
@@ -521,7 +521,7 @@ sub run_ut {
         "active" => "false",
         "dscp" => 0,
         "routingName" => "foo",
-        "deepCachingType" => 0,
+        "deepCachingType" => "NEVER",
         "ipv6RoutingEnabled" => "true",
         "logsEnabled" => "true",
         "initialDispersion" => 1,
diff --git a/traffic_ops/app/t/deliveryservice.t b/traffic_ops/app/t/deliveryservice.t
index 2e47697..c6b76ce 100644
--- a/traffic_ops/app/t/deliveryservice.t
+++ b/traffic_ops/app/t/deliveryservice.t
@@ -63,7 +63,7 @@ ok $t->post_ok(
 		'ds.dns_bypass_ttl'              => '30',
 		'ds.dscp'                        => '40',
 		'ds.routing_name'                => 'foo',
-		'ds.deep_caching_type'           => '0',
+		'ds.deep_caching_type'           => 'NEVER',
 		'ds.geo_limit'                   => '0',
 		'ds.geo_limit_countries'         => '',
 		'ds.geo_provider'                => '1',
@@ -116,7 +116,7 @@ ok $t->post_ok(
 		'ds.dns_bypass_ttl'              => '30',
 		'ds.dscp'                        => '42',
 		'ds.routing_name'                => '',
-		'ds.deep_caching_type'           => '0',
+		'ds.deep_caching_type'           => 'NEVER',
 		'ds.geo_limit'                   => '0',
 		'ds.geo_limit_countries'         => '',
 		'ds.global_max_mbps'             => '',
@@ -168,7 +168,7 @@ ok $t->post_ok(
 		'ds.dns_bypass_ttl'              => '30',
 		'ds.dscp'                        => '40',
 		'ds.routing_name'                => 'foo',
-		'ds.deep_caching_type'           => '0',
+		'ds.deep_caching_type'           => 'NEVER',
 		'ds.geo_limit'                   => '1',
 		'ds.geo_limit_countries'         => '',
 		'ds.global_max_mbps'             => '30G',
@@ -249,7 +249,7 @@ ok $t->post_ok(
 		'ds.dns_bypass_ttl'              => '31',
 		'ds.dscp'                        => '41',
 		'ds.routing_name'                => 'bar',
-		'ds.deep_caching_type'           => '0',
+		'ds.deep_caching_type'           => 'NEVER',
 		'ds.geo_limit'                   => '2',
 		'ds.geo_limit_countries'         => '',
 		'ds.geo_provider'                => '1',
@@ -298,7 +298,7 @@ ok $t->get_ok('/datadeliveryservice')->status_is(200)
   ->or( sub { diag $t->tx->res->content->asset->{content}; } )
   ->json_is( '/1/dscp' => '41' )
   ->json_is( '/1/routing_name' => 'bar' )
-  ->json_is( '/1/deep_caching_type' => '0' )
+  ->json_is( '/1/deep_caching_type' => 'NEVER' )
   ->json_is( '/1/active' => '0' )
   ->json_is( '/1/profile_description' => 'mid description' )
   ->json_is( '/1/org_server_fqdn'     => 'http://update.knutsel.com' )
diff --git a/traffic_ops/app/templates/delivery_service/_form.html.ep b/traffic_ops/app/templates/delivery_service/_form.html.ep
index 50d1802..b2e0156 100644
--- a/traffic_ops/app/templates/delivery_service/_form.html.ep
+++ b/traffic_ops/app/templates/delivery_service/_form.html.ep
@@ -623,13 +623,10 @@
 		<% } %>
 		%= label_for 'deep_caching_type' => '* Deep Caching', class => 'label'
 		<% if ($priv_level >= 20) { %>
-		%= field('ds.deep_caching_type')->select([["Never" => 0], ["Always" => 1]]);
+		%= field('ds.deep_caching_type')->select([["NEVER" => "NEVER"], ["ALWAYS" => "ALWAYS"]]);
 		<% } else { %>
-			<%  if ($ds->deep_caching_type == 0 ) {%>
-				%= field('ds.deep_caching_type')->text(class => 'field', readonly => 'readonly',
value => 'Never');
-			<% } elsif ($ds->deep_caching_type == 1 ) {%>
-				%= field('ds.deep_caching_type')->text(class => 'field', readonly => 'readonly',
value => 'Always');
-			<% } %>
+		%= field('ds.deep_caching_type')->text(class => 'field', readonly => 'readonly',
value => $ds->deep_caching_type);
+
 		<% } %>
 	</div>
 </div>
diff --git a/traffic_ops/client_tests/fixtures/delivery_service.go b/traffic_ops/client_tests/fixtures/delivery_service.go
index dcc714b..f7c7cc9 100644
--- a/traffic_ops/client_tests/fixtures/delivery_service.go
+++ b/traffic_ops/client_tests/fixtures/delivery_service.go
@@ -26,7 +26,7 @@ func DeliveryServices() *client.GetDeliveryServiceResponse {
 				XMLID:                "ds-test",
 				Active:               true,
 				DSCP:                 40,
-				DeepCachingType:      0,
+				DeepCachingType:      "NEVER",
 				RoutingName:          "edge",
 				Signed:               false,
 				QStringIgnore:        1,
diff --git a/traffic_ops/client_tests/fixtures/traffic_router_config.go b/traffic_ops/client_tests/fixtures/traffic_router_config.go
index b4508b3..82ee5fe 100644
--- a/traffic_ops/client_tests/fixtures/traffic_router_config.go
+++ b/traffic_ops/client_tests/fixtures/traffic_router_config.go
@@ -114,7 +114,7 @@ func TrafficRouterConfig() *client.TRConfigResponse {
 						"ga.atlanta.kabletown.net",
 					},
 					RoutingName:     "edge",
-					DeepCachingType: 0,
+					DeepCachingType: "NEVER",
 					MissLocation: client.MissLocation{
 						Latitude:  75,
 						Longitude: 65,
diff --git a/traffic_ops/client_tests/tests/integration/deliveryservice_test.go b/traffic_ops/client_tests/tests/integration/deliveryservice_test.go
index 14193af..b2fb797 100644
--- a/traffic_ops/client_tests/tests/integration/deliveryservice_test.go
+++ b/traffic_ops/client_tests/tests/integration/deliveryservice_test.go
@@ -62,7 +62,7 @@ func init() {
 	testDs.CDNID = cdn.ID
 	testDs.CacheURL = "cacheURL"
 	testDs.CheckPath = "CheckPath"
-	testDs.DeepCachingType = 0
+	testDs.DeepCachingType = "NEVER"
 	testDs.DNSBypassCname = "DNSBypassCNAME"
 	testDs.DNSBypassIP = "10.10.10.10"
 	testDs.DNSBypassIP6 = "FF01:0:0:0:0:0:0:FB"
diff --git a/traffic_portal/app/src/common/modules/form/deliveryService/FormDeliveryServiceController.js
b/traffic_portal/app/src/common/modules/form/deliveryService/FormDeliveryServiceController.js
index 049a11b..e554e76 100644
--- a/traffic_portal/app/src/common/modules/form/deliveryService/FormDeliveryServiceController.js
+++ b/traffic_portal/app/src/common/modules/form/deliveryService/FormDeliveryServiceController.js
@@ -129,8 +129,8 @@ var FormDeliveryServiceController = function(deliveryService, type, types,
$scop
     ];
 
     $scope.deepCachingTypes = [
-        { value: 0, label: '0 - Never' },
-        { value: 1, label: '1 - Always' }
+        { value: 'NEVER', label: 'NEVER' },
+        { value: 'ALWAYS', label: 'ALWAYS' }
     ]
 
     $scope.dispersions = [

-- 
To stop receiving notification emails like this one, please contact
elsloo@apache.org.

Mime
View raw message