Skip to content

Commit 65c7032

Browse files
committed
fix(redis-enterprise): remove non-existent database action methods
Remove three database action methods that call non-existent API endpoints: - BdbHandler::start() - /v1/bdbs/{uid}/actions/start (404) - BdbHandler::stop() - /v1/bdbs/{uid}/actions/stop (404) - BdbHandler::restart() - /v1/bdbs/{uid}/actions/restart (404) Testing against Docker cluster and comprehensive documentation search of redis.io REST API docs confirms these endpoints do not exist. The complete list of documented database action endpoints is: - stop_traffic / resume_traffic (NOT the same as stop/start) - export / import / recover - optimize_shards_placement / rebalance - backup_reset_status / import_reset_status / export_reset_status Also removed associated tests and updated documentation to use correct endpoints (stop_traffic/resume_traffic instead of restart). Closes #421
1 parent f6990d6 commit 65c7032

File tree

5 files changed

+13
-141
lines changed

5 files changed

+13
-141
lines changed

crates/redis-enterprise/src/bdb.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -522,36 +522,6 @@ impl DatabaseHandler {
522522
self.client.get(&format!("/v1/bdbs/{}/metrics", uid)).await
523523
}
524524

525-
/// Start database (BDB.START)
526-
pub async fn start(&self, uid: u32) -> Result<Value> {
527-
self.client
528-
.post(
529-
&format!("/v1/bdbs/{}/actions/start", uid),
530-
&serde_json::json!({}),
531-
)
532-
.await
533-
}
534-
535-
/// Stop database (BDB.STOP)
536-
pub async fn stop(&self, uid: u32) -> Result<Value> {
537-
self.client
538-
.post(
539-
&format!("/v1/bdbs/{}/actions/stop", uid),
540-
&serde_json::json!({}),
541-
)
542-
.await
543-
}
544-
545-
/// Restart database (BDB.RESTART)
546-
pub async fn restart(&self, uid: u32) -> Result<DatabaseActionResponse> {
547-
self.client
548-
.post(
549-
&format!("/v1/bdbs/{}/actions/restart", uid),
550-
&serde_json::json!({}),
551-
)
552-
.await
553-
}
554-
555525
/// Export database (BDB.EXPORT)
556526
pub async fn export(&self, uid: u32, export_location: &str) -> Result<ExportResponse> {
557527
let body = serde_json::json!({

crates/redis-enterprise/src/lib_tests.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -190,60 +190,6 @@ mod tests {
190190
assert!(result.is_ok());
191191
}
192192

193-
#[tokio::test]
194-
async fn test_database_action_start() {
195-
let mock_server = MockServer::start().await;
196-
197-
Mock::given(method("POST"))
198-
.and(path("/v1/bdbs/1/actions/start"))
199-
.and(basic_auth("admin", "password"))
200-
.respond_with(
201-
ResponseTemplate::new(200).set_body_json(serde_json::json!({"status": "started"})),
202-
)
203-
.mount(&mock_server)
204-
.await;
205-
206-
let client = EnterpriseClient::builder()
207-
.base_url(mock_server.uri())
208-
.username("admin")
209-
.password("password")
210-
.build()
211-
.unwrap();
212-
213-
let handler = crate::bdb::DatabaseHandler::new(client);
214-
let result = handler.start(1).await;
215-
216-
assert!(result.is_ok());
217-
assert_eq!(result.unwrap()["status"], "started");
218-
}
219-
220-
#[tokio::test]
221-
async fn test_database_action_stop() {
222-
let mock_server = MockServer::start().await;
223-
224-
Mock::given(method("POST"))
225-
.and(path("/v1/bdbs/1/actions/stop"))
226-
.and(basic_auth("admin", "password"))
227-
.respond_with(
228-
ResponseTemplate::new(200).set_body_json(serde_json::json!({"status": "stopped"})),
229-
)
230-
.mount(&mock_server)
231-
.await;
232-
233-
let client = EnterpriseClient::builder()
234-
.base_url(mock_server.uri())
235-
.username("admin")
236-
.password("password")
237-
.build()
238-
.unwrap();
239-
240-
let handler = crate::bdb::DatabaseHandler::new(client);
241-
let result = handler.stop(1).await;
242-
243-
assert!(result.is_ok());
244-
assert_eq!(result.unwrap()["status"], "stopped");
245-
}
246-
247193
#[tokio::test]
248194
async fn test_database_action_export() {
249195
let mock_server = MockServer::start().await;

crates/redis-enterprise/tests/database_tests.rs

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -157,56 +157,6 @@ async fn test_database_delete() {
157157

158158
// Database Action Tests
159159

160-
#[tokio::test]
161-
async fn test_database_start() {
162-
let mock_server = MockServer::start().await;
163-
164-
Mock::given(method("POST"))
165-
.and(path("/v1/bdbs/1/actions/start"))
166-
.and(basic_auth("admin", "password"))
167-
.respond_with(success_response(json!({"status": "started"})))
168-
.mount(&mock_server)
169-
.await;
170-
171-
let client = EnterpriseClient::builder()
172-
.base_url(mock_server.uri())
173-
.username("admin")
174-
.password("password")
175-
.build()
176-
.unwrap();
177-
178-
let handler = BdbHandler::new(client);
179-
let result = handler.start(1).await;
180-
181-
assert!(result.is_ok());
182-
assert_eq!(result.unwrap()["status"], "started");
183-
}
184-
185-
#[tokio::test]
186-
async fn test_database_stop() {
187-
let mock_server = MockServer::start().await;
188-
189-
Mock::given(method("POST"))
190-
.and(path("/v1/bdbs/1/actions/stop"))
191-
.and(basic_auth("admin", "password"))
192-
.respond_with(success_response(json!({"status": "stopped"})))
193-
.mount(&mock_server)
194-
.await;
195-
196-
let client = EnterpriseClient::builder()
197-
.base_url(mock_server.uri())
198-
.username("admin")
199-
.password("password")
200-
.build()
201-
.unwrap();
202-
203-
let handler = BdbHandler::new(client);
204-
let result = handler.stop(1).await;
205-
206-
assert!(result.is_ok());
207-
assert_eq!(result.unwrap()["status"], "stopped");
208-
}
209-
210160
#[tokio::test]
211161
async fn test_database_export() {
212162
let mock_server = MockServer::start().await;

docs/src/enterprise/api-access.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ redisctl api enterprise delete /v1/nodes/3
9898
### Database Operations (BDB)
9999
- `/v1/bdbs` - Database list and creation
100100
- `/v1/bdbs/{id}` - Database details and management
101-
- `/v1/bdbs/{id}/actions` - Database actions (flush, restart)
101+
- `/v1/bdbs/{id}/actions` - Database actions (stop_traffic, resume_traffic, export, import, etc.)
102102
- `/v1/bdbs/{id}/stats` - Database statistics
103103

104104
### Node Management

docs/src/enterprise/examples.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,24 +305,30 @@ redisctl api enterprise post /v1/crdbs \
305305

306306
## Maintenance Operations
307307

308-
### Rolling Restart
308+
### Rolling Traffic Management
309309

310310
```bash
311311
#!/bin/bash
312-
# Perform rolling restart of all databases
312+
# Stop and resume traffic for all databases (for maintenance)
313313

314314
redisctl enterprise database list -q "[].uid" | while read db_id; do
315-
echo "Restarting database $db_id..."
315+
echo "Stopping traffic for database $db_id..."
316316

317-
# Restart database
318-
redisctl api enterprise post /v1/bdbs/$db_id/actions/restart
317+
# Stop database traffic
318+
redisctl api enterprise post /v1/bdbs/$db_id/actions/stop_traffic
319+
320+
# Perform maintenance operations here
321+
sleep 5
322+
323+
# Resume database traffic
324+
redisctl api enterprise post /v1/bdbs/$db_id/actions/resume_traffic
319325

320326
# Wait for database to be active
321327
while [ "$(redisctl enterprise database get $db_id -q status)" != "active" ]; do
322328
sleep 5
323329
done
324330

325-
echo "Database $db_id restarted successfully"
331+
echo "Database $db_id traffic resumed successfully"
326332
done
327333
```
328334

0 commit comments

Comments
 (0)