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

API testing services implement concrete services #7599

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

ocket8888
Copy link
Contributor

What this PR is primarily meant to do is make keeping parity between API services and their mock testing services easier for developers. It does this by, for each API service, ensuring it is implemented by the corresponding mock/testing service. For example, with the API service:

export class FooService extends APIService {
	//...
}

in experimental/traffic-portal/src/app/api, this PR ensures there is a corresponding service in experimental/traffic-portal/src/app/api/testing such that:

import { FooService as ConcreteFooService } from "../foo.service.ts";

export class FooService implements ConcreteFooService {
	//...
}

This means that adding functionality to the "concrete" service that isn't being properly mocked will result in testing compilation errors.

In order to ensure the services are working properly, this PR also adds 100% test coverage to experimental/traffic-portal/src/app/api/testing and fills any gaps in testing coverage for experimental/traffic-portal/src/app/api.


Which Traffic Control components are affected by this PR?

  • Traffic Portal (experimental v2)

What is the best way to verify this PR?

Make sure the provided tests pass.

PR submission checklist

  • This PR has tests
  • This PR doesn't need documentation
  • This PR doesn't need a CHANGELOG.md entry
  • This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY

@ocket8888 ocket8888 added low impact affects only a small portion of a CDN, and cannot itself break one tests related to tests and/or testing infrastructure improvement The functionality exists but it could be improved in some way. experimental a feature/component not directly supported by ATC Traffic Portal v2 Related to the experimental Traffic Portal version 2 labels Jun 26, 2023
@ocket8888 ocket8888 added this to In progress in TPv2 via automation Jun 26, 2023
@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Merging #7599 (1fed230) into master (9cfe018) will increase coverage by 37.76%.
Report is 3 commits behind head on master.
The diff coverage is 99.51%.

@@              Coverage Diff              @@
##             master    #7599       +/-   ##
=============================================
+ Coverage     31.83%   69.60%   +37.76%     
  Complexity       98       98               
=============================================
  Files           717      324      -393     
  Lines         82720    12865    -69855     
  Branches        965      974        +9     
=============================================
- Hits          26338     8955    -17383     
+ Misses        54217     3574    -50643     
+ Partials       2165      336     -1829     
Flag Coverage Δ
golib_unit ?
grove_unit ?
t3c_unit ?
traffic_monitor_unit ?
traffic_ops_unit ?
traffic_portal_v2 83.78% <99.51%> (+9.38%) ⬆️
traffic_stats_unit ?
unit_tests 83.78% <99.51%> (+54.61%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...mental/traffic-portal/src/app/api/testing/index.ts 100.00% <ø> (ø)
...tatuses/status-details/status-details.component.ts 58.33% <0.00%> (ø)
experimental/traffic-portal/src/app/utils/index.ts 100.00% <ø> (ø)
...tal/traffic-portal/src/app/api/base-api.service.ts 100.00% <100.00%> (ø)
...fic-portal/src/app/api/delivery-service.service.ts 100.00% <100.00%> (ø)
...ental/traffic-portal/src/app/api/server.service.ts 100.00% <100.00%> (+16.50%) ⬆️
...fic-portal/src/app/api/testing/base-api.service.ts 100.00% <100.00%> (ø)
...-portal/src/app/api/testing/cache-group.service.ts 100.00% <100.00%> (+69.44%) ⬆️
.../traffic-portal/src/app/api/testing/cdn.service.ts 100.00% <100.00%> (+81.81%) ⬆️
...-portal/src/app/api/testing/change-logs.service.ts 100.00% <100.00%> (+50.00%) ⬆️
... and 10 more

... and 399 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

That was the only way I could implement the abstract class without
extending it.
allowed creation of regions in non-existent divisions, wouldn't delete
things by object as well as ID, etc. Also added 100% test coverage.
Also added 100% test coverage
Some were accepting IDs but not response structures. Also added 100%
test coverage.
Used to only work on Ids. Also added 100% test coverage.
Also fixed some bugs in the testing server service and added 100% test
coverage.
@ocket8888 ocket8888 force-pushed the tpv2/api-testing-implementation branch from e00087c to 1fed230 Compare September 21, 2023 21:37
@ocket8888 ocket8888 requested review from shamrickus and removed request for shamrickus September 22, 2023 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental a feature/component not directly supported by ATC improvement The functionality exists but it could be improved in some way. low impact affects only a small portion of a CDN, and cannot itself break one tests related to tests and/or testing infrastructure Traffic Portal v2 Related to the experimental Traffic Portal version 2
Projects
TPv2
In progress
Development

Successfully merging this pull request may close these issues.

None yet

1 participant