Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit Delivery Services returned for GET /servers/{id}/deliveryservices to ones in the same CDN #7888

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Fixed
- [#7846](https://github.com/apache/trafficcontrol/pull/7846) *Traffic Portal* Increase State character limit
- [#7887](https://github.com/apache/trafficcontrol/pull/7887) *Traffic Ops* Limit Delivery Services returned for GET /servers/{id}/deliveryservices to ones in the same CDN

## [8.0.0] - 2023-09-20
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ func TestServersIDDeliveryServices(t *testing.T) {
[]int{
GetDeliveryServiceId(t, "ds-top")(),
GetDeliveryServiceId(t, "ds-top-req-cap2")(),
GetDeliveryServiceId(t, "ds-forked-topology")(),
},
3)),
2)),
},
"CONFLICT when SERVER NOT IN SAME CDN as DELIVERY SERVICE": {
EndpointID: GetServerID(t, "cdn2-test-edge"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ func TestServersIDDeliveryServices(t *testing.T) {
[]int{
totest.GetDeliveryServiceId(t, TOSession, "ds-top")(),
totest.GetDeliveryServiceId(t, TOSession, "ds-top-req-cap2")(),
totest.GetDeliveryServiceId(t, TOSession, "ds-forked-topology")(),
},
3)),
2)),
},
"CONFLICT when SERVER NOT IN SAME CDN as DELIVERY SERVICE": {
EndpointID: totest.GetServerID(t, TOSession, "cdn2-test-edge"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ func TestServersIDDeliveryServices(t *testing.T) {
[]int{
GetDeliveryServiceId(t, "ds-top")(),
GetDeliveryServiceId(t, "ds-top-req-cap2")(),
GetDeliveryServiceId(t, "ds-forked-topology")(),
},
3)),
2)),
},
"CONFLICT when SERVER NOT IN SAME CDN as DELIVERY SERVICE": {
EndpointID: GetServerID(t, "cdn2-test-edge"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -948,14 +948,16 @@
(ds.id in (
SELECT deliveryService FROM deliveryservice_server WHERE server = :server
) OR ds.id in (
SELECT id FROM deliveryservice
WHERE topology in (
SELECT d.id FROM deliveryservice d
JOIN cdn c ON d.cdn_id = c.id
WHERE d.topology in (

Check warning on line 953 in traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go

View check run for this annotation

Codecov / codecov/patch

traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go#L951-L953

Added lines #L951 - L953 were not covered by tests
SELECT topology FROM topology_cachegroup
WHERE cachegroup = (
SELECT name FROM cachegroup
WHERE id = (
SELECT cachegroup FROM server WHERE id = :server
)))))
)))
AND d.cdn_id = (SELECT cdn_id FROM server WHERE id = :server)))

Check warning on line 960 in traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go

View check run for this annotation

Codecov / codecov/patch

traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go#L959-L960

Added lines #L959 - L960 were not covered by tests
AND
((
(SELECT (t.name = 'ORG') FROM type t JOIN server s ON s.type = t.id WHERE s.id = :server)
Expand Down
Loading