()
| 3337 | } |
| 3338 | #[test_log::test(tokio::test)] |
| 3339 | async fn test_basic_cache_functionality() { |
| 3340 | // Create plugin file that uses the cache |
| 3341 | let plugin_code = r#" |
| 3342 | def process_scheduled_call(influxdb3_local, schedule_time, args=None): |
| 3343 | # Store a value in the cache |
| 3344 | influxdb3_local.cache.put("test_key", "test_value") |
| 3345 | |
| 3346 | # Retrieve the value |
| 3347 | value = influxdb3_local.cache.get("test_key") |
| 3348 | influxdb3_local.info(f"Retrieved value: {value}") |
| 3349 | |
| 3350 | # Verify the value matches what we stored |
| 3351 | assert value == "test_value", f"Expected 'test_value', got {value}" |
| 3352 | influxdb3_local.info("Cache test passed")"#; |
| 3353 | let (temp_dir, plugin_path) = create_plugin_in_temp_dir(plugin_code); |
| 3354 | |
| 3355 | let plugin_dir = temp_dir.path().to_str().unwrap(); |
| 3356 | let plugin_name = plugin_path.file_name().unwrap().to_str().unwrap(); |
| 3357 | |
| 3358 | let server = TestServer::configure() |
| 3359 | .with_plugin_dir(plugin_dir) |
| 3360 | .spawn() |
| 3361 | .await; |
| 3362 | |
| 3363 | let db_name = "foo"; |
| 3364 | |
| 3365 | // Setup: create database |
| 3366 | server.create_database(db_name).run().unwrap(); |
| 3367 | |
| 3368 | // Run the schedule plugin test |
| 3369 | let res = server |
| 3370 | .test_schedule_plugin(db_name, plugin_name, "* * * * * *") |
| 3371 | .with_cache_name("test_basic_cache") |
| 3372 | .run() |
| 3373 | .unwrap(); |
| 3374 | |
| 3375 | // Check that the cache operations were successful |
| 3376 | let expected_logs = [ |
| 3377 | "INFO: Retrieved value: test_value", |
| 3378 | "INFO: Cache test passed", |
| 3379 | ]; |
| 3380 | |
| 3381 | check_logs(&res, &expected_logs); |
| 3382 | } |
| 3383 | |
| 3384 | #[test_log::test(tokio::test)] |
| 3385 | async fn test_cache_ttl() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…