Closed BD103 closed 2 years ago
Well, Client
should be trivially clonable (#154). Do you have some minimal example that doesn't work for you?
Interesting. When I try testing, it gives the following error:
running 3 tests
test client::simple ... FAILED
test transactions::transaction_conflict ... FAILED
test transactions::transaction_conflict_with_complex_err ... FAILED
failures:
---- client::simple stdout ----
thread 'client::simple' panicked at 'Can run edgedb-server: Os { code: 2, kind: NotFound, message: "No such file or directory" }', edgedb-tokio/tests/func/server.rs:65:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- transactions::transaction_conflict stdout ----
thread 'transactions::transaction_conflict' panicked at 'Lazy instance has previously been poisoned', /Users/bdeep/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.13.0/src/lib.rs:1231:25
---- transactions::transaction_conflict_with_complex_err stdout ----
thread 'transactions::transaction_conflict_with_complex_err' panicked at 'Lazy instance has previously been poisoned', /Users/bdeep/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.13.0/src/lib.rs:1231:25
failures:
client::simple
transactions::transaction_conflict
transactions::transaction_conflict_with_complex_err
test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
error: test failed, to rerun pass '--test func'
After some further investigation, I believe this is probably an issue with the way I've set up the project. It seems that the test suite cannot find edgedb. Most likely I didn't initialize it correctly. (I'm on MacOS, so that may be an issue.)
As Github Actions didn't throw any errors, and I can use the library through crates.io, I'm not going to try to fix this. Most likely I didn't follow some instructions when installing EdgeDB.
Thank you for your time, and I look forward to the PR merging.
Ah, this means your edgedb-server is not available under edgedb-server
command-line (i.e. must be in path). We don't have any guide for running tests for now. If you have installed server with edgedb
CLI tool, you may run tests with something like this:
PATH=$HOME/Library/Application Support/edgedb/portable/1.4/bin:$PATH cargo test -p edgedb-tokio
(If you want to run tests against 1.4 stable, or try whatever is in your portable
dir, they aren't very version-sensitive for now I think)
Thank you, I didn't realize I need another tool. This makes a lot more sense. :)
Anyways, thanks for merging the change. This makes it a lot easier to use EdgeDB with actix_web.
The ability to clone a connection would be very useful. It would keep the options and remove all the unnecessary logic that multiple
create_client()
calls would run.I cloned the repository and did some initial testing of adding
#derive(Clone)
to the Client struct. My very basic example worked, but the tests failed with poised lazy instance. If you need more details, just ask. (I could also open a PR.)Thank you, ~BD103