Skip to content

Commit

Permalink
Add integration testing (#4)
Browse files Browse the repository at this point in the history
## Problem

Right now we don't have integration testing as a CI job.

## Solution

I added integration tests (in `pinecone_sdk/tests`) and added the job to
the GitHub workflow.

## Type of Change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Infrastructure change (CI configs, etc)
- [ ] Non-code change (docs, etc)
- [ ] None of the above: (explain here)

## Test Plan

The integration tests should run as a CI job and pass.

---------

Co-authored-by: Emily Yu <emily.y@pinecone.io>
  • Loading branch information
ericapywang and emily-emily authored Jun 11, 2024
1 parent 5aa32ed commit 519f2ef
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 8 deletions.
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 @@ -98,4 +98,4 @@ mod tests {
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::*`
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 @@ -344,4 +344,4 @@ mod tests {
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 },
}
}
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());
}

0 comments on commit 519f2ef

Please sign in to comment.