Skip to content
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
11 changes: 2 additions & 9 deletions crates/terraphim_atomic_client/tests/class_crud_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,11 @@ fn extra_props(class_url: &str, slug: &str) -> HashMap<String, serde_json::Value
}

#[tokio::test]
#[ignore = "requires running Atomic Server with valid credentials (ATOMIC_SERVER_URL, ATOMIC_SERVER_SECRET)"]
async fn generic_classes_crud_search() {
dotenv().ok();

// This is an optional, environment/integration test.
// Skip when ATOMIC_* env vars are not present.
let config = match Config::from_env() {
Ok(c) => c,
Err(_) => {
eprintln!("Skipping: ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET not set");
return;
}
};
let config = Config::from_env().expect("ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET must be set");
assert!(config.agent.is_some(), "Need authenticated agent");
let store = Store::new(config).expect("Create store");

Expand Down
12 changes: 3 additions & 9 deletions crates/terraphim_atomic_client/tests/commit_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,12 @@ mod tests {

/// Tests the commit functionality for creating resources
#[tokio::test]
#[ignore = "requires running Atomic Server with valid credentials (ATOMIC_SERVER_URL, ATOMIC_SERVER_SECRET)"]
async fn test_commit_create() {
// Load .env file if present
dotenv().ok();

// Optional integration test: skip when ATOMIC_* env vars are not present
let config = match Config::from_env() {
Ok(c) => c,
Err(_) => {
eprintln!("Skipping: ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET not set");
return;
}
};
let config =
Config::from_env().expect("ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET must be set");
assert!(
config.agent.is_some(),
"ATOMIC_SERVER_SECRET must decode into a valid Agent"
Expand Down
52 changes: 11 additions & 41 deletions crates/terraphim_atomic_client/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,12 @@ mod tests {
use terraphim_atomic_client::{Config, Resource, Store};

#[tokio::test]
#[ignore = "requires running Atomic Server with valid credentials"]
async fn test_crud_operations() {
// Load .env file if present
dotenv().ok();

// Optional integration test: skip when ATOMIC_* env vars are not present
let config = match Config::from_env() {
Ok(c) => c,
Err(_) => {
eprintln!("Skipping: ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET not set");
return;
}
};
let config =
Config::from_env().expect("ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET must be set");
assert!(
config.agent.is_some(),
"ATOMIC_SERVER_SECRET must decode into a valid Agent"
Expand Down Expand Up @@ -153,17 +147,11 @@ mod tests {
}

#[tokio::test]
#[ignore = "requires running Atomic Server with valid credentials"]
async fn test_search() {
// Load .env file if present
dotenv().ok();

let config = match Config::from_env() {
Ok(c) => c,
Err(_) => {
eprintln!("Skipping: ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET not set");
return;
}
};
let config = Config::from_env().expect("ATOMIC_SERVER_URL must be set");
let store = Store::new(config).expect("Failed to create Store");

let _results = store.search("test").await.expect("Search request failed");
Expand All @@ -172,17 +160,11 @@ async fn test_search() {
}

#[tokio::test]
#[ignore = "requires running Atomic Server with valid credentials"]
async fn test_query() {
// Load .env file if present
dotenv().ok();

let config = match Config::from_env() {
Ok(c) => c,
Err(_) => {
eprintln!("Skipping: ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET not set");
return;
}
};
let config = Config::from_env().expect("ATOMIC_SERVER_URL must be set");
let store = Store::new(config).expect("Failed to create Store");

// Query the collections resource directly using GET with query params
Expand All @@ -205,17 +187,11 @@ async fn test_query() {
}

#[tokio::test]
#[ignore = "requires running Atomic Server with valid credentials"]
async fn test_create_and_search() {
// Load .env file if present
dotenv().ok();

let config = match Config::from_env() {
Ok(c) => c,
Err(_) => {
eprintln!("Skipping: ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET not set");
return;
}
};
let config = Config::from_env().expect("ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET must be set");
assert!(
config.agent.is_some(),
"ATOMIC_SERVER_SECRET must decode into Agent"
Expand Down Expand Up @@ -282,17 +258,11 @@ async fn test_create_and_search() {
}

#[tokio::test]
#[ignore = "requires running Atomic Server with valid credentials"]
async fn test_create_and_query() {
// Load .env file if present
dotenv().ok();

let config = match Config::from_env() {
Ok(c) => c,
Err(_) => {
eprintln!("Skipping: ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET not set");
return;
}
};
let config = Config::from_env().expect("ATOMIC_SERVER_URL / ATOMIC_SERVER_SECRET must be set");
assert!(
config.agent.is_some(),
"ATOMIC_SERVER_SECRET must decode into Agent"
Expand Down
6 changes: 4 additions & 2 deletions crates/terraphim_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! ## Creating a Search Query
//!
//! ```
//! use terraphim_types::{SearchQuery, NormalizedTermValue, LogicalOperator, RoleName};
//! use terraphim_types::{SearchQuery, NormalizedTermValue, Layer, LogicalOperator, RoleName};
//!
//! // Simple single-term query
//! let query = SearchQuery {
Expand All @@ -30,6 +30,7 @@
//! skip: None,
//! limit: Some(10),
//! role: Some(RoleName::new("engineer")),
//! layer: Layer::default(),
//! };
//!
//! // Multi-term AND query
Expand Down Expand Up @@ -944,7 +945,7 @@ pub fn extract_first_paragraph(body: &str) -> String {
/// ## Single-term query
///
/// ```
/// use terraphim_types::{SearchQuery, NormalizedTermValue, RoleName};
/// use terraphim_types::{SearchQuery, NormalizedTermValue, Layer, RoleName};
///
/// let query = SearchQuery {
/// search_term: NormalizedTermValue::from("machine learning"),
Expand All @@ -953,6 +954,7 @@ pub fn extract_first_paragraph(body: &str) -> String {
/// skip: None,
/// limit: Some(10),
/// role: Some(RoleName::new("data_scientist")),
/// layer: Layer::default(),
/// };
/// ```
///
Expand Down
Loading