apache / dubbo-rust

Apache Dubbo Rust implementation
https://dubbo.apache.org/
Apache License 2.0
279 stars 63 forks source link

[error] 我在运行单元测试的时候出错了 #202

Open ooggss opened 3 months ago

ooggss commented 3 months ago

我通过cargo test来运行项目的单元测试,然后遇到了以下的错误:

running 10 tests
test triple::codec::buffer::tests::decode_buf ... ok
test config::protocol::tests::test_get_invalid_protocol - should panic ... ok
test triple::codec::buffer::tests::encode_buf ... ok
test config::config::tests::test_config ... ok
test utils::yaml_utils::tests::test_yaml_file_parser ... FAILED
test utils::yaml_utils::tests::test_yaml_key_reader ... FAILED
test triple::compression::test_compress ... ok
2024-08-10T08:55:13.745591Z DEBUG dubbo::logger::tracing_configurer:37: Tracing configured.
2024-08-10T08:55:13.745687Z  WARN dubbo::config::config:83: error loading config_path: NotPresent, use default path: "application.yaml"
2024-08-10T08:55:13.746387Z DEBUG dubbo::config::config:98: origin config: {"logging": RootConfig { protocols: {}, provider: ProviderConfig { registry_ids: [], protocol_ids: [], services: {} }, registries: {}, routers: RouterConfig { consumer: None, nacos: None, conditions: None, tags: None }, data: {} }, "dubbo": RootConfig { protocols: {"triple": Protocol { ip: "0.0.0.0", port: "8888", name: "tri", params: {} }}, provider: ProviderConfig { registry_ids: [], protocol_ids: [], services: {"GreeterProvider": ServiceConfig { version: "1.0.0", group: "test", protocol: "triple", interface: "org.apache.dubbo.sample.tri.Greeter", tag: "red" }} }, registries: {"demoZK": RegistryConfig { protocol: "zookeeper", address: "0.0.0.0:2181" }}, routers: RouterConfig { consumer: Some([ConsumerConfig { service: "org.apache.dubbo.sample.tri.Greeter", url: "tri://127.0.0.1:20000", protocol: "triple" }]), nacos: None, conditions: None, tags: None }, data: {} }}
test config::config::tests::test_load ... ok
test logger::tests::test_print_info_log ... FAILED
2024-08-10T08:55:13.747987Z DEBUG dubbo::context:50: ThreadId(34) - None
2024-08-10T08:55:13.747990Z DEBUG dubbo::context:50: ThreadId(39) - None
2024-08-10T08:55:13.747993Z DEBUG dubbo::context:50: ThreadId(37) - None
2024-08-10T08:55:13.747990Z DEBUG dubbo::context:50: ThreadId(38) - None
2024-08-10T08:55:13.748063Z DEBUG dubbo::context:50: ThreadId(33) - None
2024-08-10T08:55:13.748042Z DEBUG dubbo::context:50: ThreadId(35) - None
2024-08-10T08:55:13.748015Z DEBUG dubbo::context:50: ThreadId(36) - None
2024-08-10T08:55:13.748141Z DEBUG dubbo::context:50: ThreadId(34) - Some(Mutex { data: <locked>, poisoned: false, .. })
2024-08-10T08:55:13.748116Z DEBUG dubbo::context:50: ThreadId(32) - Some(Mutex { data: {"key1": String("data-1")}, poisoned: false, .. })
2024-08-10T08:55:13.748151Z DEBUG dubbo::context:50: ThreadId(39) - Some(Mutex { data: {"key1": String("data-1")}, poisoned: false, .. })
2024-08-10T08:55:13.748155Z DEBUG dubbo::context:50: ThreadId(30) - Some(Mutex { data: <locked>, poisoned: false, .. })
2024-08-10T08:55:14.749891Z DEBUG dubbo::context:50: ThreadId(12) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.749984Z DEBUG dubbo::context:50: ThreadId(30) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.750041Z DEBUG dubbo::context:50: ThreadId(12) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.750037Z DEBUG dubbo::context:50: ThreadId(39) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.750093Z DEBUG dubbo::context:50: ThreadId(30) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.750099Z DEBUG dubbo::context:50: ThreadId(12) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.750093Z DEBUG dubbo::context:50: ThreadId(34) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.750146Z DEBUG dubbo::context:50: ThreadId(39) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.750155Z DEBUG dubbo::context:50: ThreadId(12) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.750153Z DEBUG dubbo::context:50: ThreadId(36) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
2024-08-10T08:55:14.750242Z DEBUG dubbo::context:50: ThreadId(35) - Some(Mutex { data: {"key1": String("data-9")}, poisoned: false, .. })
test context::tests::context_with_thread_local ... ok

failures:

---- utils::yaml_utils::tests::test_yaml_file_parser stdout ----
thread 'utils::yaml_utils::tests::test_yaml_file_parser' panicked at dubbo/src/utils/yaml_utils.rs:79:71:
called `Result::unwrap()` on an `Err` value: path is not a file: "/home/k/ogs_PHD/LLM4SE/2Rust_projects/auto_get_functionPair/projects/dubbo/rust/common/utils/tests/application.yaml"

---- utils::yaml_utils::tests::test_yaml_key_reader stdout ----
thread 'utils::yaml_utils::tests::test_yaml_key_reader' panicked at dubbo/src/utils/yaml_utils.rs:90:69:
called `Result::unwrap()` on an `Err` value: path is not a file: "/home/k/ogs_PHD/LLM4SE/2Rust_projects/auto_get_functionPair/projects/dubbo/rust/common/utils/tests/application.yaml"

---- logger::tests::test_print_info_log stdout ----
thread 'logger::tests::test_print_info_log' panicked at dubbo/src/logger/tracing_configurer.rs:36:10:
init err.: SetGlobalDefaultError("a global default trace dispatcher has already been set")

failures:
    logger::tests::test_print_info_log
    utils::yaml_utils::tests::test_yaml_file_parser
    utils::yaml_utils::tests::test_yaml_key_reader

test result: FAILED. 7 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.01s

因为我没有在readme中看到相关的运行测试的命令,所以是按照常规的命令运行的。如果是我运行单元测试的方式出错了,希望可以麻烦告诉我正确的运行方式的