Swoorup / dgraph-rs

A dgraph client driver written in rust ⛺
https://crates.io/crates/dgraph
MIT License
98 stars 10 forks source link

Functional tests #5

Closed ondrowan closed 5 years ago

ondrowan commented 5 years ago

I've written functional tests for this library, but I have no idea how to include them into Rust's testing pipeline. The problem is that I need two separate instances of Dgraph for testing (secure and insecure; on non-standard ports, so it doesn't interfere with user's data on local instance). Docker is an obvious choice for this, but I have no idea how to write a (multi-platform) script that can also run setup and teardown of these instances. Basically I need something that runs:

Is there any way to do this easily via Cargo scripts? Right now the most obvious way that comes into my mind is to run these commands via std::process::Command, but I don't know what pitfalls does this approach have.

Swoorup commented 5 years ago

The only problem I feel with directly using std::process::Command is the amount of plumbing work one has to do to make the errors including docker images failures are logged properly should they fail.

One thing that comes to my mind, is to probably use something like https://github.com/testcontainers/testcontainers-rs that handles the setup and teardown process but it looks like we would have to create a crate to setup dgraph server

ondrowan commented 5 years ago

There's one more option. I checked Diesel and it seems like they didn't set up anything clever and just mentioned that you should have Postgres, MySQL etc running locally in readme. It's not very sexy, but it works.