LeonHartley/Coerce-rs

[Test] Test error

lshoo opened this issue · 10 comments

lshoo commented

I got errors when I run cargo test:

running 3 tests
test test_redis_journal_actor_integration ... ok
test test_redis_journal_read_write_snapshot ... FAILED
test test_redis_journal_read_write_messages ... FAILED

or cargo nextest run --workspace:

        PASS [   0.027s] coerce::test_remote_sharding test_shard_coordinator_shard_allocation
        PASS [   0.035s] coerce::test_remote_actor_creation test_remote_actor_deploy_remotely
        PASS [   0.056s] coerce::test_actor_supervision test_actor_child_spawn_and_stop
        PASS [   0.530s] coerce::test_remote_sharding_rebalancing test_shard_rebalancing_upon_node_termination
        PASS [   2.011s] coerce::test_remote_system_health test_heartbeat_actor_monitoring
------------
     Summary [   2.035s] 38/47 tests run: 31 passed, 7 failed, 0 skipped
        FAIL [   0.016s] coerce::test_remote_actor_err test_remote_actor_err
        FAIL [   0.019s] coerce::test_remote_actor_locate test_remote_actor_locate_remotely
        FAIL [   0.018s] coerce::test_remote_api test_remote_api_routes
        FAIL [   0.027s] coerce::test_remote_cluster_formation test_remote_cluster_workers
        FAIL [   0.025s] coerce::test_remote_cluster_heartbeat test_remote_cluster_heartbeat
        FAIL [   0.019s] coerce::test_remote_pubsub test_pubsub_distributed
        FAIL [   0.014s] coerce::test_remote_sharding test_shard_host_actor_request

How to fix or config for these errors?
I clone the main branch, the os is wsl2 + ubuntu 22.04, rust version is 1.68.2.

Thanks

lshoo commented

I want to run the cluster example, but I got errors when i cargo run -p coerce-cluster-example:

error[E0432]: unresolved import `crate::remote::net::security::jwt`
  --> coerce/src/remote/system/builder.rs:27:35
   |
27 | use crate::remote::net::security::jwt::Jwt;
   |                                   ^^^ could not find `jwt` in `security`

error[E0432]: unresolved import `crate::remote::net::security::jwt`
 --> coerce/src/remote/net/security/auth/mod.rs:1:35
  |
1 | use crate::remote::net::security::jwt::Jwt;
  |                                   ^^^ could not find `jwt` in `security`
lshoo commented

I only added Coerce-rs to an exists dependencies of Cargo.toml , and execute cargo check, but I got compiled errors.
So I create a new project to test coerce-actor, and got the same errors:

    Checking coerce v0.8.5
error[E0277]: the trait bound `valuable::Value<'_>: tracing::Value` is not satisfied
  --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/actor/lifecycle.rs:88:28
   |
88 |                   let span = tracing::info_span!(
   |  ____________________________^
89 | |                     "actor.recv",
90 | |                     ctx = log.as_value(),
91 | |                     message_type = msg.name(),
92 | |                 );
   | |_________________^ the trait `tracing::Value` is not implemented for `valuable::Value<'_>`
   |
   = help: the following other types implement trait `tracing::Value`:
             &'a T
             &'a mut T
             (dyn StdError + 'static)
             (dyn StdError + Sync + 'static)
             (dyn StdError + std::marker::Send + 'static)
             (dyn StdError + std::marker::Send + Sync + 'static)
             Arguments<'a>
             Box<T>
           and 34 others
   = note: required for the cast from `valuable::Value<'_>` to the object type `dyn tracing::Value`
   = note: this error originates in the macro `$crate::valueset` which comes from the expansion of the macro `tracing::info_span` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `valuable::Value<'_>: tracing::Value` is not satisfied
  --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/remote/net/client/connect.rs:42:13
   |
42 | /             error!(
43 | |                 ctx = log_ctx.as_value(),
44 | |                 "connection to {} failed, error: {}", &self.addr, error
45 | |             );
   | |_____________^ the trait `tracing::Value` is not implemented for `valuable::Value<'_>`
   |
   = help: the following other types implement trait `tracing::Value`:
             &'a T
             &'a mut T
             (dyn StdError + 'static)
             (dyn StdError + Sync + 'static)
             (dyn StdError + std::marker::Send + 'static)
             (dyn StdError + std::marker::Send + Sync + 'static)
             Arguments<'a>
             Box<T>
           and 34 others
   = note: required for the cast from `valuable::Value<'_>` to the object type `dyn tracing::Value`
   = note: this error originates in the macro `$crate::valueset` which comes from the expansion of the macro `error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `valuable::Value<'_>: tracing::Value` is not satisfied
  --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/remote/net/client/connect.rs:73:17
   |
73 | /                 error!(
74 | |                     ctx = log_ctx.as_value(),
75 | |                     "failed to write identify message to begin authentication, error={}", e
76 | |                 );
   | |_________________^ the trait `tracing::Value` is not implemented for `valuable::Value<'_>`
   |
   = help: the following other types implement trait `tracing::Value`:
             &'a T
             &'a mut T
             (dyn StdError + 'static)
             (dyn StdError + Sync + 'static)
             (dyn StdError + std::marker::Send + 'static)
             (dyn StdError + std::marker::Send + Sync + 'static)
             Arguments<'a>
             Box<T>
           and 34 others
   = note: required for the cast from `valuable::Value<'_>` to the object type `dyn tracing::Value`
   = note: this error originates in the macro `$crate::valueset` which comes from the expansion of the macro `error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `valuable::Value<'_>: tracing::Value` is not satisfied
   --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/remote/net/client/connect.rs:98:17
    |
98  | /                 warn!(
99  | |                     ctx = log_ctx.as_value(),
100 | |                     "no identity received (addr={})", &self.addr
101 | |                 );
    | |_________________^ the trait `tracing::Value` is not implemented for `valuable::Value<'_>`
    |
    = help: the following other types implement trait `tracing::Value`:
              &'a T
              &'a mut T
              (dyn StdError + 'static)
              (dyn StdError + Sync + 'static)
              (dyn StdError + std::marker::Send + 'static)
              (dyn StdError + std::marker::Send + Sync + 'static)
              Arguments<'a>
              Box<T>
            and 34 others
    = note: required for the cast from `valuable::Value<'_>` to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` which comes from the expansion of the macro `warn` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `valuable::Value<'_>: tracing::Value` is not satisfied
   --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/remote/net/server/session/mod.rs:165:21
    |
165 | /                     error!(
166 | |                         ctx = log.as_value(),
167 | |                         "invalid token received, disconnecting session({}) - token=\"{}\"",
168 | |                         ctx.id(),
169 | |                         token
170 | |                     );
    | |_____________________^ the trait `tracing::Value` is not implemented for `valuable::Value<'_>`
    |
    = help: the following other types implement trait `tracing::Value`:
              &'a T
              &'a mut T
              (dyn StdError + 'static)
              (dyn StdError + Sync + 'static)
              (dyn StdError + std::marker::Send + 'static)
              (dyn StdError + std::marker::Send + Sync + 'static)
              Arguments<'a>
              Box<T>
            and 34 others
    = note: required for the cast from `valuable::Value<'_>` to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` which comes from the expansion of the macro `error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `valuable::Value<'_>: tracing::Value` is not satisfied
   --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/remote/net/server/session/mod.rs:172:21
    |
172 | /                     info!(
173 | |                         ctx = log.as_value(),
174 | |                         "token ({}) validated - connection accepted", &token,
175 | |                     );
    | |_____________________^ the trait `tracing::Value` is not implemented for `valuable::Value<'_>`
    |
    = help: the following other types implement trait `tracing::Value`:
              &'a T
              &'a mut T
              (dyn StdError + 'static)
              (dyn StdError + Sync + 'static)
              (dyn StdError + std::marker::Send + 'static)
              (dyn StdError + std::marker::Send + Sync + 'static)
              Arguments<'a>
              Box<T>
            and 34 others
    = note: required for the cast from `valuable::Value<'_>` to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` which comes from the expansion of the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `valuable::Value<'_>: tracing::Value` is not satisfied
   --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/remote/net/server/session/mod.rs:182:17
    |
182 | /                 error!(
183 | |                     ctx = log.as_value(),
184 | |                     "initial payload invalid, expected SessionEvent::Identify, disconnecting session({}), value={:?}",
185 | |                     ctx.id(), value
186 | |                 );
    | |_________________^ the trait `tracing::Value` is not implemented for `valuable::Value<'_>`
    |
    = help: the following other types implement trait `tracing::Value`:
              &'a T
              &'a mut T
              (dyn StdError + 'static)
              (dyn StdError + Sync + 'static)
              (dyn StdError + std::marker::Send + 'static)
              (dyn StdError + std::marker::Send + Sync + 'static)
              Arguments<'a>
              Box<T>
            and 34 others
    = note: required for the cast from `valuable::Value<'_>` to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` which comes from the expansion of the macro `error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `valuable::Value<'_>: tracing::Value` is not satisfied
   --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/remote/net/server/session/mod.rs:190:9
    |
190 | /         error!(
191 | |             ctx = log.as_value(),
192 | |             "unable to read initial authentication payload"
193 | |         );
    | |_________^ the trait `tracing::Value` is not implemented for `valuable::Value<'_>`
    |
    = help: the following other types implement trait `tracing::Value`:
              &'a T
              &'a mut T
              (dyn StdError + 'static)
              (dyn StdError + Sync + 'static)
              (dyn StdError + std::marker::Send + 'static)
              (dyn StdError + std::marker::Send + Sync + 'static)
              Arguments<'a>
              Box<T>
            and 34 others
    = note: required for the cast from `valuable::Value<'_>` to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` which comes from the expansion of the macro `error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `valuable::Value<'_>: tracing::Value` is not satisfied
  --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/remote/net/server/session/mod.rs:77:9
   |
77 | /         debug!(
78 | |             ctx = log.as_value(),
79 | |             "session started (addr={}, session_id={}), validating token", &self.addr, &self.id
80 | |         );
   | |_________^ the trait `tracing::Value` is not implemented for `valuable::Value<'_>`
   |
   = help: the following other types implement trait `tracing::Value`:
             &'a T
             &'a mut T
             (dyn StdError + 'static)
             (dyn StdError + Sync + 'static)
             (dyn StdError + std::marker::Send + 'static)
             (dyn StdError + std::marker::Send + Sync + 'static)
             Arguments<'a>
             Box<T>
           and 34 others
   = note: required for the cast from `valuable::Value<'_>` to the object type `dyn tracing::Value`
   = note: this error originates in the macro `$crate::valueset` which comes from the expansion of the macro `debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `AdditionalProperties<Schema>: From<AllOfBuilder>` is not satisfied
   --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/coerce-0.8.5/src/remote/api/system/mod.rs:58:41
    |
58  | #[derive(Serialize, Deserialize, Debug, ToSchema)]
    |                                         ^^^^^^^^ the trait `From<AllOfBuilder>` is not implemented for `AdditionalProperties<Schema>`
    |
    = help: the following other types implement trait `From<T>`:
              <AdditionalProperties<Schema> as From<ObjectBuilder>>
              <AdditionalProperties<Schema> as From<utoipa::openapi::Ref>>
    = note: required for `AllOfBuilder` to implement `Into<AdditionalProperties<Schema>>`
note: required by a bound in `ObjectBuilder::additional_properties`
   --> /home/lshoo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/utoipa-3.2.1/src/openapi/schema.rs:738:37
    |
738 |     pub fn additional_properties<I: Into<AdditionalProperties<Schema>>>(
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ObjectBuilder::additional_properties`
    = note: this error originates in the derive macro `ToSchema` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `coerce` due to 19 previous errors

I only add coerce-rs to the denpendencies, but don't import it.
Do I miss something or do somthing wrong ?

Thanks!

lshoo commented

When I remove coerce-rs features full or remote of dependencies from Cargo.toml like this:

coerce = { version = "0", features = [] }

It works,but how to enable remote feature?

Hi @lshoo!

The redis tests require a redis server to be running, using the default address (127.0.0.1:6379).

I've updated the main readme with some documentation about the issue you're seeing with errors related to value::Valuable.

https://github.com/LeonHartley/Coerce-rs#using-coerce-in-your-own-project

The errors related to utoipa look to have been caused by their recent updates, I've updated the crate versions which has resolved the issue. I'll be pushing a crate update (0.8.7) momentarily.

When running the tests within the coerce repository, I'd recommend enabling all features as part of the unit test run, which can be done by using the --all-features argument:

cargo test --all-features

I hope that helps, thanks for giving Coerce a try!

Leon

lshoo commented

@LeonHartley
Thanks for your answer!

I'm an Akka user before,e.g. Akka-Cluster, Akka-persistence, I like these features.
I want to use Coerce these features too.

But i don't find cluster docs now.

lshoo

Hey @lshoo,

Thank you!

I'm sorry but the docs around remote and clustering is still somewhat lacking. I'm hoping to spend some more time on documentation very soon.

Check out the sharded chat example, which utilizes most of the features offered by Coerce, including persistence and clustering.
Also please check out the remote section on docs.rs/coerce, while it still needs a lot of work, there are some important points mentioned.

Leon

lshoo commented

Hi @LeonHartley
Thanks!

I can run coerce-cluster-example after updated 0.8.7 in Coerce source code。
but In my project,When I run cargo check , I also got some errors like valuable::Value<'_>: tracing::Value after updatet 0.8.7 and add:

coerce = { version = "0.8", features = ["full"]}

[build]
rustflags = ["--cfg", "tracing_unstable"]

the code repo: coerce-actor

Do I miss something?

by lshoo

Hey @lshoo,

The [build] section needs to go in .cargo/config.toml .

Cheers,
Leon

lshoo commented

Thanks! @LeonHartley

It works

Cheers,
lshoo

Excellent news!