CloudMigrations: Add unit tests for snapshot management (#89521)
* add regex support for api tests * revert dumb thing * add api tests * add unit test for core async workflow * add xorm store unit tests * fix typo * remove unnecessary assignment
This commit is contained in:
@@ -233,17 +233,23 @@ func (ss *sqlStore) GetSnapshotByUID(ctx context.Context, uid string) (*cloudmig
|
||||
}
|
||||
|
||||
func (ss *sqlStore) GetSnapshotList(ctx context.Context, query cloudmigration.ListSnapshotsQuery) ([]cloudmigration.CloudMigrationSnapshot, error) {
|
||||
var runs = make([]cloudmigration.CloudMigrationSnapshot, 0)
|
||||
var snapshots = make([]cloudmigration.CloudMigrationSnapshot, 0)
|
||||
err := ss.db.WithDbSession(ctx, func(sess *db.Session) error {
|
||||
sess.Limit(query.Limit, query.Offset)
|
||||
return sess.Find(&runs, &cloudmigration.CloudMigrationSnapshot{
|
||||
return sess.Find(&snapshots, &cloudmigration.CloudMigrationSnapshot{
|
||||
SessionUID: query.SessionUID,
|
||||
})
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return runs, nil
|
||||
for i, snapshot := range snapshots {
|
||||
if err := ss.decryptKey(ctx, &snapshot); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
snapshots[i] = snapshot
|
||||
}
|
||||
return snapshots, nil
|
||||
}
|
||||
|
||||
func (ss *sqlStore) encryptToken(ctx context.Context, cm *cloudmigration.CloudMigrationSession) error {
|
||||
|
||||
Reference in New Issue
Block a user