MCPcopy Create free account
hub / github.com/cosdata/cosdata / test_vector_update

Function test_vector_update

src/grpc/vectors/tests.rs:120–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118
119#[tokio::test]
120async fn test_vector_update() {
121 let result = setup_with_timeout().await;
122 assert!(result.is_ok(), "Setup timed out");
123 let (service, _context, collection_id) = result.unwrap();
124
125 timeout(Duration::from_secs(5), async {
126 let create_req = CreateVectorRequest {
127 collection_id: collection_id.clone(),
128 vector: Some(Vector {
129 id: 1,
130 values: vec![0.1, 0.2, 0.3, 0.4],
131 }),
132 };
133 service
134 .create_vector(Request::new(create_req))
135 .await
136 .unwrap();
137 })
138 .await
139 .unwrap();
140
141 let update_result = timeout(Duration::from_secs(5), async {
142 let update_req = UpdateVectorRequest {
143 collection_id: collection_id.clone(),
144 vector_id: 1,
145 values: vec![0.5, 0.6, 0.7, 0.8],
146 };
147 service.update_vector(Request::new(update_req)).await
148 })
149 .await;
150
151 assert!(update_result.is_ok(), "Update operation timed out");
152 let update_response = update_result.unwrap().unwrap();
153 assert_eq!(update_response.get_ref().values, vec![0.5, 0.6, 0.7, 0.8]);
154
155 cleanup();
156}
157
158#[tokio::test]
159async fn test_find_similar_vectors() {

Callers

nothing calls this directly

Calls 3

setup_with_timeoutFunction · 0.85
cleanupFunction · 0.85
cloneMethod · 0.80

Tested by

no test coverage detected