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

Add integration testing #4

Merged
merged 21 commits into from
Jun 11, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ jobs:
- name: Build
run: cargo build
- name: Run tests
run: cargo test --verbose
env:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
run: cargo test --verbose
2 changes: 1 addition & 1 deletion pinecone_sdk/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ impl Config {
source_tag,
}
}
}
}
2 changes: 1 addition & 1 deletion pinecone_sdk/src/control/list_indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#[cfg(test)]
mod tests {
use super::*;
use crate::config::Config;

Check warning on line 18 in pinecone_sdk/src/control/list_indexes.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `crate::config::Config`

Check warning on line 18 in pinecone_sdk/src/control/list_indexes.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `crate::config::Config`
use crate::control::list_indexes::models::index_model::Metric;
use mockito::mock;
use openapi::apis::configuration::ApiKey;

Check warning on line 21 in pinecone_sdk/src/control/list_indexes.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `openapi::apis::configuration::ApiKey`

Check warning on line 21 in pinecone_sdk/src/control/list_indexes.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `openapi::apis::configuration::ApiKey`
use openapi::apis::configuration::Configuration;

Check warning on line 22 in pinecone_sdk/src/control/list_indexes.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `openapi::apis::configuration::Configuration`

Check warning on line 22 in pinecone_sdk/src/control/list_indexes.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `openapi::apis::configuration::Configuration`
use openapi::models::IndexList;
use openapi::models::IndexModel;
use tokio;
Expand Down Expand Up @@ -98,4 +98,4 @@
Err(err) => panic!("Expected Ok, got Err: {:?}", err),
}
}
}
}
2 changes: 1 addition & 1 deletion pinecone_sdk/src/control/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mod list_indexes;

pub use list_indexes::*;
pub use list_indexes::*;

Check warning on line 3 in pinecone_sdk/src/control/mod.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `list_indexes::*`

Check warning on line 3 in pinecone_sdk/src/control/mod.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `list_indexes::*`

Check warning on line 3 in pinecone_sdk/src/control/mod.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `list_indexes::*`

Check warning on line 3 in pinecone_sdk/src/control/mod.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `list_indexes::*`

Check warning on line 3 in pinecone_sdk/src/control/mod.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `list_indexes::*`

Check warning on line 3 in pinecone_sdk/src/control/mod.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused import: `list_indexes::*`
2 changes: 1 addition & 1 deletion pinecone_sdk/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod config;
pub mod control;
pub mod pinecone;
pub mod utils;
pub mod utils;
2 changes: 1 addition & 1 deletion pinecone_sdk/src/pinecone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#[derive(Debug, Clone)]
pub struct Pinecone {
config: Config,

Check warning on line 11 in pinecone_sdk/src/pinecone.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `config` is never read

Check warning on line 11 in pinecone_sdk/src/pinecone.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `config` is never read

Check warning on line 11 in pinecone_sdk/src/pinecone.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `config` is never read

Check warning on line 11 in pinecone_sdk/src/pinecone.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

field `config` is never read
openapi_config: Configuration,
}

Expand Down Expand Up @@ -344,4 +344,4 @@
mock_arg_headers.clone()
);
}
}
}
2 changes: 1 addition & 1 deletion pinecone_sdk/src/utils/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ pub enum PineconeError {

#[snafu(display("Failed to parse headers: {}", json_error))]
InvalidHeadersError { json_error: serde_json::Error },
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could agree on a set of style rules or use the same formatter so we don't have these diffs in all our PRs

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's a good idea. I'm not sure of what the standard is here, do we look at using std::fmt? https://doc.rust-lang.org/std/fmt/

2 changes: 1 addition & 1 deletion pinecone_sdk/src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pub mod errors;
pub mod user_agent;
pub mod user_agent;
9 changes: 9 additions & 0 deletions pinecone_sdk/tests/integration_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use pinecone_sdk::pinecone::Pinecone;

#[tokio::test]
async fn test_list_serverless_index_env() {
let pinecone = Pinecone::new(None, None, None, None).unwrap();
let list_response = pinecone.list_indexes().await;

assert!(list_response.is_ok());
}