-
-
Notifications
You must be signed in to change notification settings - Fork 21
Implement tagging #93
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
Conversation
Warning Rate Limit Exceeded@nylonee has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 6 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe project now supports tagging for Sonarr and Radarr, enabling dynamic content management through tags. This feature allows users to specify Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
src/test/resources/tag-response.json
is excluded by:!**/*.json
Files selected for processing (12)
- docker/entrypoint.sh (1 hunks)
- src/main/scala/configuration/Configuration.scala (1 hunks)
- src/main/scala/configuration/ConfigurationRedactor.scala (1 hunks)
- src/main/scala/configuration/ConfigurationUtils.scala (7 hunks)
- src/main/scala/configuration/Keys.scala (1 hunks)
- src/main/scala/plex/PlexUtils.scala (1 hunks)
- src/main/scala/radarr/RadarrPost.scala (1 hunks)
- src/main/scala/radarr/RadarrUtils.scala (1 hunks)
- src/main/scala/sonarr/SonarrPost.scala (1 hunks)
- src/main/scala/sonarr/SonarrUtils.scala (1 hunks)
- src/test/scala/PlexTokenSyncSpec.scala (1 hunks)
- src/test/scala/configuration/ConfigurationUtilsSpec.scala (4 hunks)
Files skipped from review due to trivial changes (1)
- src/main/scala/plex/PlexUtils.scala
Additional comments: 18
src/main/scala/radarr/RadarrPost.scala (1)
- 3-10: Changes to
RadarrPost
correctly introduce thetags
field with appropriate default value and type.src/main/scala/sonarr/SonarrPost.scala (1)
- 10-11: Changes to
SonarrPost
correctly introduce thetags
field with appropriate default value and type.src/main/scala/configuration/Keys.scala (2)
- 12-12: Addition of
sonarrTags
key is correctly implemented.- 19-19: Addition of
radarrTags
key is correctly implemented.src/main/scala/configuration/ConfigurationRedactor.scala (2)
- 16-16: Inclusion of
sonarrTagIds
in the configuration output is correctly implemented.- 24-24: Inclusion of
radarrTagIds
in the configuration output is correctly implemented.src/main/scala/configuration/Configuration.scala (2)
- 22-23: Addition of
sonarrTagIds
field toSonarrConfiguration
is correctly implemented.- 31-32: Addition of
radarrTagIds
field toRadarrConfiguration
is correctly implemented.docker/entrypoint.sh (1)
- 86-92: Conditional inclusion of
SONARR_TAGS
andRADARR_TAGS
environment variables in the command array is correctly implemented.src/main/scala/radarr/RadarrUtils.scala (1)
- 30-30: Modification to
addToRadarr
function to includetags
parameter inRadarrPost
instantiation is correctly implemented.src/main/scala/sonarr/SonarrUtils.scala (1)
- 38-38: Modification to include
tags
parameter inSonarrPost
instantiation is correctly implemented.src/test/scala/PlexTokenSyncSpec.scala (2)
- 44-45: Addition of
sonarrTagIds
to the test configuration for Sonarr is correctly implemented.- 52-53: Addition of
radarrTagIds
to the test configuration for Radarr is correctly implemented.src/main/scala/configuration/ConfigurationUtils.scala (5)
- 24-28: Modifications to
create
function to includesonarrTagIds
andradarrTagIds
in configurations are correctly implemented.- 82-104: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [76-112]
Changes to
getSonarrConfig
to handlesonarrTagIds
are correctly implemented.
- 115-141: Changes to
getRadarrConfig
to handleradarrTagIds
are correctly implemented.- 144-159: Implementation of
getTagIdsFromConfig
to fetch tag information is correctly implemented.- 261-267: Refactoring of
toArr
to handle POST requests with payloads is correctly implemented.
it should "fetch a tag from Sonarr/Radarr" in { | ||
|
||
val mockConfigReader = createMockConfigReader(tags = Some("test-tag")) | ||
val mockHttpClient = createMockHttpClient() | ||
|
||
val config = ConfigurationUtils.create(mockConfigReader, mockHttpClient).unsafeRunSync() | ||
noException should be thrownBy config | ||
config.sonarrConfiguration.sonarrTagIds shouldBe Set(3) | ||
config.radarrConfiguration.radarrTagIds shouldBe Set(3) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case "fetch a tag from Sonarr/Radarr" lacks assertions to verify the HTTP request details, such as the request path, method, and body. Adding these assertions would ensure that the correct API endpoints are called with the expected parameters.
Consider adding assertions to verify the HTTP request details to ensure the correctness of the API calls.
(mockHttpClient.httpRequest _).expects( | ||
Method.POST, | ||
Uri.unsafeFromString("http://localhost:8989").withPath(Uri.Path.unsafeFromString("/api/v3/tag")), | ||
Some("sonarr-api-key"), | ||
* | ||
).returning(IO.pure(parse(Source.fromResource("tag-response.json").getLines().mkString("\n")))).anyNumberOfTimes() | ||
(mockHttpClient.httpRequest _).expects( | ||
Method.POST, | ||
Uri.unsafeFromString("http://localhost:7878").withPath(Uri.Path.unsafeFromString("/api/v3/tag")), | ||
Some("radarr-api-key"), | ||
* | ||
).returning(IO.pure(parse(Source.fromResource("tag-response.json").getLines().mkString("\n")))).anyNumberOfTimes() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wildcard matcher *
used in the httpRequest
mock setup for POST requests to Sonarr and Radarr tag APIs does not validate the request body. This could lead to false positives in tests if the request body format changes.
Replace the wildcard matcher with a specific matcher that validates the structure and content of the request body.
This closes #41
Summary by CodeRabbit
New Features
SONARR_TAGS
andRADARR_TAGS
environment variables to customize media management.Enhancements
Refactor
Tests