-
Notifications
You must be signed in to change notification settings - Fork 3
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
Include the client version in BundleUploads #101
Conversation
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.
Very nice work! ✨
cli/src/main.rs
Outdated
} | ||
} |
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.
I'm not sure why the Trunk Check runner isn't working, but it seems you need to run trunk check -y
on this PR
cli/tests/upload.rs
Outdated
let request = requests_iter.next().unwrap(); | ||
if let RequestPayload::CreateBundleUpload(upload_request) = request { | ||
assert_eq!( | ||
upload_request.repo, | ||
Repo { | ||
host: String::from("github.com"), | ||
owner: String::from("trunk-io"), | ||
name: String::from("analytics-cli"), | ||
}, | ||
org_url_slug: String::from("test-org"), | ||
}) | ||
); | ||
} | ||
); | ||
assert_eq!(upload_request.org_url_slug, String::from("test-org")); | ||
assert!(upload_request.client_version.starts_with("trunk-analytics-cli cargo=")); | ||
assert!(upload_request.client_version.contains(" git=")); | ||
assert!(upload_request.client_version.contains(" rustc=")); | ||
} else { | ||
panic!("Expected CreateBundleUpload request, got {:?}", request); | ||
} |
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.
nit: You can use the fancy assert_matches
macro to do the failure for when the pattern isn't matched here
let request = requests_iter.next().unwrap(); | |
if let RequestPayload::CreateBundleUpload(upload_request) = request { | |
assert_eq!( | |
upload_request.repo, | |
Repo { | |
host: String::from("github.com"), | |
owner: String::from("trunk-io"), | |
name: String::from("analytics-cli"), | |
}, | |
org_url_slug: String::from("test-org"), | |
}) | |
); | |
} | |
); | |
assert_eq!(upload_request.org_url_slug, String::from("test-org")); | |
assert!(upload_request.client_version.starts_with("trunk-analytics-cli cargo=")); | |
assert!(upload_request.client_version.contains(" git=")); | |
assert!(upload_request.client_version.contains(" rustc=")); | |
} else { | |
panic!("Expected CreateBundleUpload request, got {:?}", request); | |
} | |
let upload_request = | |
assert_matches!(requests_iter.next().unwrap(), RequestPayload::CreateBundleUpload(ur) => ur); | |
assert_eq!( | |
upload_request.repo, | |
Repo { | |
host: String::from("github.com"), | |
owner: String::from("trunk-io"), | |
name: String::from("analytics-cli"), | |
} | |
); | |
assert_eq!(upload_request.org_url_slug, String::from("test-org")); | |
assert!(upload_request.client_version.starts_with("trunk-analytics-cli cargo=")); | |
assert!(upload_request.client_version.contains(" git=")); | |
assert!(upload_request.client_version.contains(" rustc=")); |
354 tests were run on |
Summary: Adding client version information for upload bundles will allow us to help Flaky Test users who may be using outdated versions of the Analytics CLI. If a user is running into an old bug, we can direct them to update their tooling version. Should help with onboarding. Closes TRUNK-12763
cli/tests/upload.rs
Outdated
use test_utils::{ | ||
mock_git_repo::setup_repo_with_commit, | ||
mock_server::{spawn_mock_server, RequestPayload}, | ||
}; | ||
use test_utils::mock_git_repo::setup_repo_with_commit; | ||
use test_utils::mock_server::{spawn_mock_server, RequestPayload}; |
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.
nit: no need to split these up
cli/tests/upload.rs
Outdated
); | ||
assert_eq!(upload_request.org_url_slug, String::from("test-org")); |
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.
optional, nit: you shouldn't need String::from()
here, the string literal is just fine
Summary:
Adding client version information for upload bundles will allow
us to help Flaky Test users who may be using outdated versions
of the Analytics CLI.
If a user is running into an old bug, we can direct them to update
their tooling version. Should help with onboarding.
Can't be merged until the corresponding API change (https://github.com/trunk-io/trunk/pull/16896) is in.
Closes TRUNK-12763
EDIT (10/8/24) - manually tested against prod, confirmed working https://api.trunk.io/metabase/question#eyJkYXRhc2V0X3F1ZXJ5Ijp7ImRhdGFiYXNlIjo1LCJ0eXBlIjoicXVlcnkiLCJxdWVyeSI6eyJzb3VyY2UtdGFibGUiOjE3ODgsImZpbHRlciI6WyJub3QtZW1wdHkiLFsiZmllbGQiLDg5MzIzLHsiYmFzZS10eXBlIjoidHlwZS9UZXh0In1dXX19LCJkaXNwbGF5IjoidGFibGUiLCJ2aXN1YWxpemF0aW9uX3NldHRpbmdzIjp7fX0=