Skip to content

Add: Legacy procedural macro integration tests #123

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

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
72f78ba
Doc: Describe pipeline and test execution
taqtiqa-mark Mar 20, 2022
999c9b1
Add: Cargo configuration for UI test suite
taqtiqa-mark Mar 20, 2022
6155c9b
Add: Legacy UI test parameter inputs - case 1
taqtiqa-mark Mar 20, 2022
9426936
Add: Legacy UI test parameter inputs - case 2
taqtiqa-mark Mar 20, 2022
ace23b2
Add: Legacy UI test parameter inputs - case 3
taqtiqa-mark Mar 20, 2022
1f80f27
Add: Legacy UI test parameter inputs - case 4
taqtiqa-mark Mar 20, 2022
f12d82d
Evolve: Legacy UI test parameter inputs
taqtiqa-mark Mar 20, 2022
56020e6
Fix: Legacy UI test parameter input result
taqtiqa-mark Mar 20, 2022
d04cfd0
Add: Legacy UI test parameter inputs - case 5
taqtiqa-mark Mar 20, 2022
11c0b78
Add: Legacy UI test parameter inputs - case 6
taqtiqa-mark Mar 20, 2022
1b2b844
Add: Legacy UI test parameter inputs - case 7
taqtiqa-mark Mar 20, 2022
e195264
Add: Legacy UI test parameter inputs - case 8
taqtiqa-mark Mar 20, 2022
bb48292
Add: Trace macro tests
taqtiqa-mark Mar 21, 2022
a6d28a9
Add: Legacy UI test parameter inputs - case 9
taqtiqa-mark Mar 21, 2022
b484d29
Add: Legacy UI test parameter inputs - case 10
taqtiqa-mark Mar 21, 2022
847eba5
Add: Legacy UI test parameter inputs - case 11
taqtiqa-mark Mar 21, 2022
8cb00ce
Add: Legacy UI test parameter inputs - case 12
taqtiqa-mark Mar 21, 2022
b130ba9
Add: Legacy procedural macro integration tests
taqtiqa-mark Mar 21, 2022
626355b
Evolve: black-box false tests
taqtiqa-mark Mar 21, 2022
c069d87
Evolve: Remove Cargo patch stanza
taqtiqa-mark Mar 21, 2022
48117d1
Add: Documentation test as integration test (sync)
taqtiqa-mark Mar 21, 2022
dfe2a36
Evolve: Documentation as integration test (sync)
taqtiqa-mark Mar 21, 2022
fb6714e
Add: Documentation as integration test (async)
taqtiqa-mark Mar 21, 2022
69d06a3
Evolve: Documentation as integration test (sync)
taqtiqa-mark Mar 21, 2022
432865a
Evolve: Documentation as integration test (async)
taqtiqa-mark Mar 21, 2022
14a5f49
Evolve: Black-box false integration test (sync)
taqtiqa-mark Mar 21, 2022
97ce3d6
Evolve: Black-box false integration test (async)
taqtiqa-mark Mar 21, 2022
f9d914b
Add: License detail
taqtiqa-mark Mar 21, 2022
c67f0c7
Add: Example as integration test (sync)
taqtiqa-mark Mar 21, 2022
9c94359
Add: Example as integration test (async)
taqtiqa-mark Mar 21, 2022
e42e1d1
Add: BE integration tests - scope & order
taqtiqa-mark Mar 22, 2022
ffa1d93
Add: Black-box false integration tests - scope & order
taqtiqa-mark Mar 22, 2022
7d47a0d
Add: Default name integration tests - scope & order
taqtiqa-mark Mar 22, 2022
5374eba
Add: Legacy UI test parameter inputs - case 1
taqtiqa-mark Mar 20, 2022
1f81832
Evolve: Legacy UI test parameter inputs
taqtiqa-mark Mar 20, 2022
6357e4b
Evolve: Rebase on upstream master
taqtiqa-mark Mar 23, 2022
dbeb576
Merge branch 'master' into issue-122
taqtiqa-mark Mar 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
run: |
cargo test --workspace --all-features --no-fail-fast
cargo run --example synchronous
cargo run --example asynchronous
cargo run --example get_started
- id: coverage
uses: actions-rs/[email protected]
Expand Down
10 changes: 5 additions & 5 deletions minitrace-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ proc-macro2 = "1"
proc-macro-error = "1"

[dev-dependencies]
trybuild = "1"
minitrace = "0.4.0"
futures = "0.3.21"
futures-timer = "3.0.2"
minitrace = { path = "../minitrace" }
test-utilities = { path = "../test-utilities" }
tokio = { version = "1", features = ["full"] }

[patch.crates-io]
minitrace = { path = "../" }
trybuild = "1"
5 changes: 5 additions & 0 deletions minitrace-macro/tests/spans.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#[test]
fn spans() {
let t = trybuild::TestCases::new();
t.pass("tests/spans/*.rs");
}
41 changes: 41 additions & 0 deletions minitrace-macro/tests/spans/black-box-false-local-async.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use minitrace::trace;
use test_utilities::*;

// Reference:
// - https://github.com/tikv/minitrace-rust/issues/122
#[trace("a-span")]
async fn f(a: u32) -> u32 {
a
}

#[tokio::main]
async fn main() {
let (root, collector) = minitrace::Span::root("root");
{
let _child_span = root.set_local_parent();
f(1).await;
}
drop(root);
let records: Vec<minitrace::collector::SpanRecord> = futures::executor::block_on(collector.collect());

let expected = r#"[
SpanRecord {
id: 1,
parent_id: 0,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "root",
properties: [],
},
SpanRecord {
id: 2,
parent_id: 1,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "a-span",
properties: [],
},
]"#;
let actual = normalize_spans(records);
assert_eq_text!(expected, &actual);
}
40 changes: 40 additions & 0 deletions minitrace-macro/tests/spans/black-box-false-local-sync.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use minitrace::trace;
use test_utilities::*;

// Reference:
// - https://github.com/tikv/minitrace-rust/issues/122
#[trace("a-span")]
fn f(a: u32) -> u32 {
a
}

fn main() {
let (root, collector) = minitrace::Span::root("root");
{
let _sg1 = root.set_local_parent();
f(1);
}
drop(root);
let records: Vec<minitrace::collector::SpanRecord> =
futures::executor::block_on(collector.collect());
let expected = r#"[
SpanRecord {
id: 1,
parent_id: 0,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "root",
properties: [],
},
SpanRecord {
id: 2,
parent_id: 1,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "a-span",
properties: [],
},
]"#;
let actual = normalize_spans(records);
assert_eq_text!(expected, &actual);
}
42 changes: 42 additions & 0 deletions minitrace-macro/tests/spans/black-box-false-threads-async.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
use minitrace::trace;
use test_utilities::*;

// Span names passed via `enter_with_parent` override default names.
// Reference:
// - https://github.com/tikv/minitrace-rust/issues/122
#[trace("a-span")]
async fn f(a: u32) -> u32 {
a
}

#[tokio::main]
async fn main() {
let (root, collector) = minitrace::Span::root("root");
{
let _child_span = minitrace::Span::enter_with_parent("test-span", &root);
f(1).await;
}
drop(root);
let records: Vec<minitrace::collector::SpanRecord> = futures::executor::block_on(collector.collect());

let expected = r#"[
SpanRecord {
id: 1,
parent_id: 0,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "root",
properties: [],
},
SpanRecord {
id: 2,
parent_id: 1,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "test-span",
properties: [],
},
]"#;
let actual = normalize_spans(records);
assert_eq_text!(expected, &actual);
}
41 changes: 41 additions & 0 deletions minitrace-macro/tests/spans/black-box-false-threads-sync.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use minitrace::trace;
use test_utilities::*;

// Span names passed via `enter_with_parent` override default names.
// Reference:
// - https://github.com/tikv/minitrace-rust/issues/122
#[trace("a-span")]
fn f(a: u32) -> u32 {
a
}

fn main() {
let (root, collector) = minitrace::Span::root("root");
{
let _sg1 = minitrace::Span::enter_with_parent("test-span", &root);
f(1);
}
drop(root);
let records: Vec<minitrace::collector::SpanRecord> =
futures::executor::block_on(collector.collect());
let expected = r#"[
SpanRecord {
id: 1,
parent_id: 0,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "root",
properties: [],
},
SpanRecord {
id: 2,
parent_id: 1,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "test-span",
properties: [],
},
]"#;
let actual = normalize_spans(records);
assert_eq_text!(expected, &actual);
}
39 changes: 39 additions & 0 deletions minitrace-macro/tests/spans/default-name-local-async.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use minitrace::trace;
use test_utilities::*;

#[trace]
async fn fa(a: u32) -> u32 {
a
}

#[tokio::main]
async fn main() {
let (root, collector) = minitrace::Span::root("root");
{
let _g = root.set_local_parent();
fa(1).await;
}
drop(root);
let records: Vec<minitrace::collector::SpanRecord> = futures::executor::block_on(collector.collect());

let expected = r#"[
SpanRecord {
id: 1,
parent_id: 0,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "root",
properties: [],
},
SpanRecord {
id: 2,
parent_id: 1,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "fa",
properties: [],
},
]"#;
let actual = normalize_spans(records);
assert_eq_text!(expected, &actual);
}
38 changes: 38 additions & 0 deletions minitrace-macro/tests/spans/default-name-local-sync.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use minitrace::trace;
use test_utilities::*;

#[trace]
fn f(a: u64) {
std::thread::sleep(std::time::Duration::from_nanos(a));
}

fn main() {
let (root, collector) = minitrace::Span::root("root");
{
let _g = root.set_local_parent();
f(1);
}
drop(root);
let records: Vec<minitrace::collector::SpanRecord> =
futures::executor::block_on(collector.collect());
let expected = r#"[
SpanRecord {
id: 1,
parent_id: 0,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "root",
properties: [],
},
SpanRecord {
id: 2,
parent_id: 1,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "f",
properties: [],
},
]"#;
let actual = normalize_spans(records);
assert_eq_text!(expected, &actual);
}
40 changes: 40 additions & 0 deletions minitrace-macro/tests/spans/default-name-threads-async.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use minitrace::trace;
use test_utilities::*;

// Span names passed via `enter_with_parent` override default names.
#[trace]
async fn fa(a: u32) -> u32 {
a
}

#[tokio::main]
async fn main() {
let (root, collector) = minitrace::Span::root("root");
{
let _child_span = minitrace::Span::enter_with_parent("test-span", &root);
fa(1).await;
}
drop(root);
let records: Vec<minitrace::collector::SpanRecord> = futures::executor::block_on(collector.collect());

let expected = r#"[
SpanRecord {
id: 1,
parent_id: 0,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "root",
properties: [],
},
SpanRecord {
id: 2,
parent_id: 1,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "test-span",
properties: [],
},
]"#;
let actual = normalize_spans(records);
assert_eq_text!(expected, &actual);
}
39 changes: 39 additions & 0 deletions minitrace-macro/tests/spans/default-name-threads-sync.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use minitrace::trace;
use test_utilities::*;

// Span names passed via `enter_with_parent` override default names.
#[trace]
fn f(a: u64) {
std::thread::sleep(std::time::Duration::from_nanos(a));
}

fn main() {
let (root, collector) = minitrace::Span::root("root");
{
let _g = minitrace::Span::enter_with_parent("test-span", &root);
f(1);
}
drop(root);
let records: Vec<minitrace::collector::SpanRecord> =
futures::executor::block_on(collector.collect());
let expected = r#"[
SpanRecord {
id: 1,
parent_id: 0,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "root",
properties: [],
},
SpanRecord {
id: 2,
parent_id: 1,
begin_unix_time_ns: \d+,
duration_ns: \d+,
event: "test-span",
properties: [],
},
]"#;
let actual = normalize_spans(records);
assert_eq_text!(expected, &actual);
}
Loading