-
-
Notifications
You must be signed in to change notification settings - Fork 242
feat(code-mappings): Wire up API integration for code-mappings upload #3209
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
129ffc1
feat(cli): Wire up API integration for code-mappings upload
romtsn 6a216be
style: Fix formatting in upload test
romtsn aada310
fix(code-mappings): Use OrganizationNotFound for org-scoped endpoint
romtsn 42740cf
ref(code-mappings): Simplify result display and extract table helper
romtsn bbd9516
fix(code-mappings): Move print_results_table before test module and u…
romtsn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| //! Data types for the bulk code mappings API. | ||
|
|
||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| #[derive(Debug, Serialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct BulkCodeMappingsRequest<'a> { | ||
| pub project: &'a str, | ||
| pub repository: &'a str, | ||
| pub default_branch: &'a str, | ||
| pub mappings: &'a [BulkCodeMapping], | ||
| } | ||
|
|
||
| #[derive(Debug, Deserialize, Serialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct BulkCodeMapping { | ||
| pub stack_root: String, | ||
| pub source_root: String, | ||
| } | ||
|
|
||
| #[derive(Debug, Deserialize)] | ||
| pub struct BulkCodeMappingsResponse { | ||
| pub created: u64, | ||
| pub updated: u64, | ||
| pub errors: u64, | ||
| pub mappings: Vec<BulkCodeMappingResult>, | ||
| } | ||
|
|
||
| #[derive(Debug, Deserialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct BulkCodeMappingResult { | ||
| pub stack_root: String, | ||
| pub source_root: String, | ||
| pub status: String, | ||
| #[serde(default)] | ||
| pub detail: Option<String>, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| //! Data types used in the api module | ||
|
|
||
| mod chunking; | ||
| mod code_mappings; | ||
| mod deploy; | ||
| mod snapshots; | ||
|
|
||
| pub use self::chunking::*; | ||
| pub use self::code_mappings::*; | ||
| pub use self::deploy::*; | ||
| pub use self::snapshots::*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/integration/_cases/code_mappings/code-mappings-upload.trycmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ``` | ||
| $ sentry-cli code-mappings upload tests/integration/_fixtures/code_mappings/mappings.json --org wat-org --project wat-project --repo owner/repo --default-branch main | ||
| ? success | ||
| Uploading 2 code mapping(s)... | ||
| +------------------+---------------------------------------------+---------+ | ||
| | Stack Root | Source Root | Status | | ||
| +------------------+---------------------------------------------+---------+ | ||
| | com/example/core | modules/core/src/main/java/com/example/core | created | | ||
| | com/example/maps | modules/maps/src/main/java/com/example/maps | created | | ||
| +------------------+---------------------------------------------+---------+ | ||
|
|
||
| Created: 2, Updated: 0, Errors: 0 | ||
|
|
||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [ | ||
| {"stackRoot": "com/example/core", "sourceRoot": "modules/core/src/main/java/com/example/core"}, | ||
| {"stackRoot": "com/example/maps", "sourceRoot": "modules/maps/src/main/java/com/example/maps"} | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "created": 2, | ||
| "updated": 0, | ||
| "errors": 0, | ||
| "mappings": [ | ||
| {"stackRoot": "com/example/core", "sourceRoot": "modules/core/src/main/java/com/example/core", "status": "created"}, | ||
| {"stackRoot": "com/example/maps", "sourceRoot": "modules/maps/src/main/java/com/example/maps", "status": "created"} | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| use crate::integration::{MockEndpointBuilder, TestManager}; | ||
|
|
||
| #[test] | ||
| fn command_code_mappings_upload() { | ||
| TestManager::new() | ||
| .mock_endpoint( | ||
| MockEndpointBuilder::new("POST", "/api/0/organizations/wat-org/code-mappings/bulk/") | ||
| .with_response_file("code_mappings/post-bulk.json"), | ||
| ) | ||
| .register_trycmd_test("code_mappings/code-mappings-upload.trycmd") | ||
| .with_default_token(); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.