Skip to content

Commit cdcce01

Browse files
authored
Improve unit test coverage for concurrent core backend
1 parent 9c36aef commit cdcce01

File tree

2 files changed

+2945
-1810
lines changed

2 files changed

+2945
-1810
lines changed

core/concurrent_core.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ func (o *ConcurrentTridentOrchestrator) cleanupDeletingBackends(ctx context.Cont
611611
}
612612

613613
for _, backendUUID := range deletingBackends {
614-
results, unlocker, err = db.Lock(db.Query(db.DeleteBackend(backendUUID), db.ReadBackend("")))
614+
results, unlocker, err = db.Lock(db.Query(db.DeleteBackend(backendUUID)))
615615
if err != nil {
616616
Logc(ctx).WithField("backendUUID", backendUUID).WithError(err).Error("Failed to lock deleting backend.")
617617
unlocker()
@@ -1516,8 +1516,9 @@ func (o *ConcurrentTridentOrchestrator) updateBackendVolumes(ctx context.Context
15161516

15171517
lockQuery := make([][]db.Subquery, 0, len(volumes))
15181518

1519+
backendUUID := backend.BackendUUID()
15191520
// Acquire the write lock for the backend and write lock for all the volumes in the backend in a single lock call.
1520-
lockQuery = append(lockQuery, db.Query(db.UpsertBackend(backend.BackendUUID(), "", "")))
1521+
lockQuery = append(lockQuery, db.Query(db.UpsertBackend(backendUUID, "", "")))
15211522
for _, vol := range volumes {
15221523
lockQuery = append(lockQuery, db.Query(db.UpsertVolume(vol.Config.Name, vol.BackendUUID)))
15231524
}
@@ -1531,7 +1532,7 @@ func (o *ConcurrentTridentOrchestrator) updateBackendVolumes(ctx context.Context
15311532
backend = backendResult.Backend.Read
15321533
if backend == nil {
15331534
Logc(ctx).WithFields(LogFields{
1534-
"backend": backend.Name(),
1535+
"backend": backendUUID,
15351536
}).Warn("Backend not found.")
15361537

15371538
// this is best case effort. so return nil

0 commit comments

Comments
 (0)