Skip to content

Commit

Permalink
refactor to workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
thor314 committed Nov 12, 2024
1 parent c4b8b95 commit b03ef9e
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 24 deletions.
29 changes: 5 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
[package]
authors = ["Pluto developers <pluto.xyz>"]
description = """web proofs by TEE"""
edition = "2021"
license = "Apache2.0 OR MIT"
name = "web-proof-tee"
repository = "https://github.com/pluto/web-proof-tee"
version = "0.1.0"

[dependencies]
anyhow = "1.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
tokio = { version = "1", features = ["full"] }
futures = "0.3"

[dev-dependencies]
rstest = "0.18"
env_logger = "0.11"
criterion = "0.5"

# [[bench]]
# name = "bench"
# harness = false
[workspace]
members = [
"client",
"proxy"
]
16 changes: 16 additions & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
authors = ["Pluto developers <pluto.xyz>"]
description = """TEE client"""
edition = "2021"
license = "Apache2.0 OR MIT"
name = "web-proof-tee-client"
repository = "https://github.com/pluto/web-proof-tee"
version = "0.1.0"

[dependencies]
anyhow = "1.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
tokio = { version = "1", features = ["full"] }
reqwest = "0.12.9"

File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions proxy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
authors = ["Pluto developers <pluto.xyz>"]
description = """web proofs by TEE"""
edition = "2021"
license = "Apache2.0 OR MIT"
name = "web-proof-tee-proxy"
repository = "https://github.com/pluto/web-proof-tee"
version = "0.1.0"

[dependencies]
anyhow = "1.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
tokio = { version = "1", features = ["full"] }
# futures = "0.3"

[dev-dependencies]
rstest = "0.18"
env_logger = "0.11"
criterion = "0.5"

# [[bench]]
# name = "bench"
# harness = false
8 changes: 8 additions & 0 deletions proxy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(dead_code)]
#![allow(unreachable_code)]
#![allow(non_snake_case)]
#![allow(clippy::clone_on_copy)]
#![allow(unused_mut)]
#[cfg(test)] mod tests;
39 changes: 39 additions & 0 deletions proxy/src/tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use tracing::Level;
use tracing_subscriber::FmtSubscriber;

static INIT: std::sync::Once = std::sync::Once::new();
fn setup_test_tracing() {
use tracing::Level;
use tracing_subscriber::FmtSubscriber;

INIT.call_once(|| {
let subscriber =
FmtSubscriber::builder().with_max_level(Level::INFO).with_test_writer().finish();
tracing::subscriber::set_global_default(subscriber)
.expect("setting default subscriber failed");
});
}
use rstest::{fixture, rstest};

// rstest provides features to take common context into tests, and set up small cases testing
#[derive(Clone, Debug, Eq, PartialEq)]
struct Wb {
count: usize,
}

// context setup function to be implicitly called by `wb`
#[fixture]
fn count() -> usize { return 0usize; }

// context setup function to be implicitly called by `test_wb`
#[fixture]
fn wb(count: usize) -> Wb {
setup_test_tracing();
Wb { count }
}

#[rstest]
fn test_wb(wb: Wb) {
tracing::info!("wb: {wb:?}");
let Wb { count } = wb;
}

0 comments on commit b03ef9e

Please sign in to comment.