Explorar o código

Fix DeleteWorker behavior to match tests

jiegec %!s(int64=5) %!d(string=hai) anos
pai
achega
90b4e5debb
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      manager/db.go

+ 4 - 0
manager/db.go

@@ -121,6 +121,10 @@ func (b *kvDBAdapter) GetWorker(workerID string) (w WorkerStatus, err error) {
 }
 
 func (b *kvDBAdapter) DeleteWorker(workerID string) error {
+	v, _ := b.db.Get(_workerBucketKey, workerID)
+	if v == nil {
+		return fmt.Errorf("invalid workerID %s", workerID)
+	}
 	return b.db.Delete(_workerBucketKey, workerID)
 }