Skip to content

Commit d007e82

Browse files
committed
init
1 parent aa7df72 commit d007e82

File tree

9 files changed

+32
-39
lines changed

9 files changed

+32
-39
lines changed

.github/actions/run_tests/action.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ runs:
3030
shell: bash
3131
run: |
3232
set +e
33-
cargo llvm-cov --no-report nextest --features=bindings --workspace ${{ contains(inputs.target, 'musl') && '--exclude context-js --exclude context-py --exclude context_ruby' || '' }} --profile=ci
33+
cargo llvm-cov --all-features --no-report nextest --features=bindings --workspace ${{ contains(inputs.target, 'musl') && '--exclude context-js --exclude context-py --exclude context_ruby' || '' }} --profile=ci
3434
exitcode="$?"
3535
cargo llvm-cov --no-report --doc
36-
cargo llvm-cov report --doctests --lcov --output-path lcov.info
3736
exit "$exitcode"
3837
3938
- name: Upload coverage reports to Codecov

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# will have compiled files and executables
33
debug/
44
target/
5+
lcov.info
56

67
# These are backup files generated by rustfmt
78
**/*.rs.bk

cli-tests/Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,17 @@ edition = "2021"
55

66
[dev-dependencies]
77
api = { path = "../api" }
8-
assert_cmd = "2.0.16"
98
assert_matches = "1.5.0"
109
axum = { version = "0.7.5", features = ["macros"] }
11-
bazel-bep = { path = "../bazel-bep" }
1210
bundle = { path = "../bundle" }
13-
chrono = "0.4.33"
1411
codeowners = { path = "../codeowners" }
15-
constants = { path = "../constants" }
1612
context = { path = "../context" }
17-
escargot = "0.5.12"
1813
exitcode = "1.1.1"
19-
junit-mock = { path = "../junit-mock" }
20-
lazy_static = "1.4"
2114
more-asserts = "0.3.1"
2215
predicates = "3.0.3"
23-
serde_json = "1.0.133"
2416
tempfile = "3.2.0"
2517
prost-wkt-types = { version = "0.5.1", features = ["vendored-protox"] }
2618
prost = "0.12.6"
27-
test_utils = { path = "../test_utils" }
2819
tokio = { version = "*" }
2920
trunk-analytics-cli = { path = "../cli", features = ["force-sentry-env-dev"] }
3021
pretty_assertions = "0.6"
@@ -34,6 +25,15 @@ default = []
3425
wasm = []
3526

3627
[dependencies]
28+
chrono = "0.4.33"
29+
constants = { path = "../constants" }
30+
bazel-bep = { path = "../bazel-bep" }
31+
escargot = "0.5.12"
32+
lazy_static = "1.4"
33+
test_utils = { path = "../test_utils" }
34+
junit-mock = { path = "../junit-mock" }
35+
assert_cmd = "2.0.16"
36+
serde_json = "1.0.133"
3737
anyhow = "1.0.96"
3838
proto = { version = "0.0.0", path = "../proto" }
3939
superconsole = "0.2.0"

cli-tests/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod command_builder;
2+
pub mod utils;

cli-tests/src/main.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

cli-tests/src/test.rs renamed to cli-tests/tests/test.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ use api::message::{
1010
use assert_matches::assert_matches;
1111
use axum::{extract::State, Json};
1212
use bundle::BundleMeta;
13-
use context::{bazel_bep::parser::BazelBepParser, junit::parser::JunitParser};
14-
use predicates::prelude::*;
15-
use tempfile::tempdir;
16-
use test_utils::mock_server::{MockServerBuilder, RequestPayload, SharedMockServerState};
17-
18-
use crate::{
13+
use cli_tests::{
1914
command_builder::CommandBuilder,
2015
utils::{
2116
generate_mock_bazel_bep, generate_mock_codeowners, generate_mock_git_repo,
2217
generate_mock_valid_junit_xmls,
2318
},
2419
};
20+
use context::{bazel_bep::parser::BazelBepParser, junit::parser::JunitParser};
21+
use predicates::prelude::*;
22+
use tempfile::tempdir;
23+
use test_utils::mock_server::{MockServerBuilder, RequestPayload, SharedMockServerState};
2524

2625
// NOTE: must be multi threaded to start a mock server
2726
#[tokio::test(flavor = "multi_thread")]

cli-tests/src/upload.rs renamed to cli-tests/tests/upload.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ use assert_matches::assert_matches;
1010
use axum::{extract::State, http::StatusCode, Json};
1111
use bundle::{BundleMeta, FileSetType, INTERNAL_BIN_FILENAME};
1212
use chrono::TimeDelta;
13+
use cli_tests::command_builder::CommandBuilder;
14+
use cli_tests::utils::{
15+
generate_mock_bazel_bep, generate_mock_codeowners, generate_mock_git_repo,
16+
generate_mock_valid_junit_xmls,
17+
generate_mock_invalid_junit_xmls,
18+
};
1319
use codeowners::CodeOwners;
1420
use constants::EXIT_FAILURE;
1521
use context::{
@@ -18,6 +24,7 @@ use context::{
1824
repo::{BundleRepo, RepoUrlParts as Repo},
1925
};
2026
use lazy_static::lazy_static;
27+
use more_asserts::assert_lt;
2128
use predicates::prelude::*;
2229
use pretty_assertions::assert_eq;
2330
use prost::Message;
@@ -30,12 +37,6 @@ use test_utils::{
3037
};
3138
use trunk_analytics_cli::upload_command::DRY_RUN_OUTPUT_DIR;
3239

33-
use crate::command_builder::CommandBuilder;
34-
use crate::utils::{
35-
generate_mock_bazel_bep, generate_mock_codeowners, generate_mock_git_repo,
36-
generate_mock_invalid_junit_xmls, generate_mock_valid_junit_xmls,
37-
};
38-
3940
// NOTE: must be multi threaded to start a mock server
4041
#[tokio::test(flavor = "multi_thread")]
4142
async fn upload_bundle() {
@@ -120,7 +121,10 @@ async fn upload_bundle() {
120121
assert!(!base_props.repo.repo_head_sha.is_empty());
121122
let repo_head_sha_short = base_props.repo.repo_head_sha_short.unwrap();
122123
assert!(!repo_head_sha_short.is_empty());
123-
assert!(&repo_head_sha_short.len() < &base_props.repo.repo_head_sha.len());
124+
assert_lt!(
125+
&repo_head_sha_short.len(),
126+
&base_props.repo.repo_head_sha.len()
127+
);
124128
assert!(base_props
125129
.repo
126130
.repo_head_sha
@@ -143,7 +147,7 @@ async fn upload_bundle() {
143147
);
144148
let time_since_upload = chrono::Utc::now()
145149
- chrono::DateTime::from_timestamp(base_props.upload_time_epoch as i64, 0).unwrap();
146-
more_asserts::assert_lt!(time_since_upload.num_minutes(), 5);
150+
assert_lt!(time_since_upload.num_minutes(), 5);
147151
assert_eq!(base_props.test_command, None);
148152
assert!(base_props.os_info.is_some());
149153
assert!(base_props.quarantined_tests.is_empty());

cli-tests/src/validate.rs renamed to cli-tests/tests/validate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use superconsole::{
55
};
66
use tempfile::tempdir;
77

8-
use crate::{
8+
use cli_tests::{
99
command_builder::CommandBuilder,
1010
utils::{
1111
generate_mock_codeowners, generate_mock_invalid_junit_xmls,

context-py/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn branch_class_to_string(branch_class: env::parser::BranchClass) -> String {
6565
#[gen_stub_pyfunction]
6666
#[pyfunction]
6767
fn ci_platform_to_string(ci_platform: env::parser::CIPlatform) -> String {
68-
ci_platform.to_string()
68+
String::from(Into::<&str>::into(ci_platform))
6969
}
7070

7171
#[gen_stub_pyfunction]

0 commit comments

Comments
 (0)