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

Framework for testing interactions with CloudClient #127

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ vergen = { version = "^8.2.1", default-features = false, features = [
"cargo",
] }

[dev-dependencies]
mockall = "0.11"
cloud = { path = "crates/cloud", features = ["mocks"] }

[patch.crates-io]
# Using fork to bump nested dep sqlite3-parser to 0.9.0 for Windows build fix
# Pending related upstream PR https://github.com/libsql/libsql-client-rs/pull/32
Expand Down
5 changes: 5 additions & 0 deletions crates/cloud/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ edition = { workspace = true }

[dependencies]
anyhow = "1.0"
async-trait = "0.1.73"
cloud-openapi = { workspace = true }
mime_guess = { version = "2.0" }
mockall = "0.11.4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other reference to this is a dev dependency. Does the cloud crate need it at runtime?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does because it is in a separate crate. I put it behind a feature flag now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... you should be able to put this behind a dev-dependency instead of a feature. Are you running into issues with that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I cannot seem to figure out how to put it behind a dev dependency and then use it in a testing scope from another crate that imports the crate. Can you import types that are behind a dev dependency from another crate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems i am running into rust-lang/cargo#8379

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rylev I am merging this but happy to do a follow up pr if you have ideas about how to put it behind a dev dep

reqwest = { version = "0.11", features = ["stream"] }
semver = "1.0"
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -16,3 +18,6 @@ tokio = { version = "1.17", features = ["full"] }
tokio-util = { version = "0.7.3", features = ["codec"] }
tracing = { workspace = true }
uuid = "1"

[features]
mocks = []
Loading