Skip to content
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

Run tests in workspace failed #4324

Closed
leaf-potato opened this issue Jul 9, 2024 · 5 comments · Fixed by #4325
Closed

Run tests in workspace failed #4324

leaf-potato opened this issue Jul 9, 2024 · 5 comments · Fixed by #4325
Labels
C-bug Category Bugs

Comments

@leaf-potato
Copy link
Contributor

What type of bug is this?

Incorrect result

What subsystems are affected?

Other

Minimal reproduce step

cargo test --workspace

What did you expect to see?

All tests run successfully.

What did you see instead?

Some tests in common-time crate run failed:

failures:

---- time::tests::test_serialize_to_json_value stdout ----
thread 'time::tests::test_serialize_to_json_value' panicked at src/common/time/src/time.rs:338:9:
assertion `left == right` failed
  left: "10:00:01+1000"
 right: "08:00:01+0800"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- time::tests::test_to_timezone_aware_string stdout ----
thread 'time::tests::test_to_timezone_aware_string' panicked at src/common/time/src/time.rs:375:9:
assertion `left == right` failed
  left: "10:00:00.001"
 right: "08:00:00.001"

---- time::tests::test_to_iso8601_string stdout ----
thread 'time::tests::test_to_iso8601_string' panicked at src/common/time/src/time.rs:316:9:
assertion `left == right` failed
  left: "10:16:40.001+1000"
 right: "08:16:40.001+0800"

---- timestamp::tests::test_as_formatted_string stdout ----
thread 'timestamp::tests::test_as_formatted_string' panicked at src/common/time/src/timestamp.rs:1240:9:
assertion `left == right` failed
  left: "1970-01-01 00:00:00"
 right: "1970-01-01 08:00:00"

---- timezone::tests::test_from_tz_string stdout ----
thread 'timezone::tests::test_from_tz_string' panicked at src/common/time/src/timezone.rs:176:9:
assertion `left == right` failed
  left: Named(UTC)
 right: Named(Asia/Shanghai)


failures:
    time::tests::test_serialize_to_json_value
    time::tests::test_to_iso8601_string
    time::tests::test_to_timezone_aware_string
    timestamp::tests::test_as_formatted_string
    timezone::tests::test_from_tz_string

test result: FAILED. 90 passed; 5 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s

error: test failed, to rerun pass `-p common-time --lib`

What operating system did you use?

Max OS Ventura 13.4 ARM

What version of GreptimeDB did you use?

0.8.2

Relevant log output and stack trace

No response

@leaf-potato leaf-potato added the C-bug Category Bugs label Jul 9, 2024
@leaf-potato
Copy link
Contributor Author

Even if function set_default_timezone in src/common/time/src/timezone.rs is called multiple times, variable DEFAULT_TIMEZONE will only be initialized once.

Therefore, calling function set_default_timezone in different tests to set different default values and the final accessed value does not match the expected value.

@waynexia
Copy link
Member

waynexia commented Jul 9, 2024

Please use make test or cargo nextest run instead. The vanilla test harness is no longer supported.

@waynexia
Copy link
Member

waynexia commented Jul 9, 2024

Unlike the vanilla harness, nextest will run each case in a separate environment, thus avoiding the shared global variable problem.

@leaf-potato
Copy link
Contributor Author

@waynexia Update the docs on the official website simultaneously?
image

@waynexia
Copy link
Member

waynexia commented Jul 9, 2024

Thank you for reminding me! It's updated at GreptimeTeam/docs#1048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category Bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants