mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-16 10:09:28 +02:00
Fixed tracking import errors
This commit is contained in:
parent
0045a5096e
commit
3ccbb20a9e
2 changed files with 4 additions and 0 deletions
|
@ -181,6 +181,7 @@ func (i *ImportResult) Update(from ImportResult) {
|
|||
i.TotalCount = from.TotalCount
|
||||
i.ImportCount = from.ImportCount
|
||||
i.UpdateTimestamp(from.LastTimestamp)
|
||||
i.ImportErrors = append(i.ImportErrors, from.ImportErrors...)
|
||||
}
|
||||
|
||||
type Progress struct {
|
||||
|
|
|
@ -121,16 +121,19 @@ func TestImportResultUpdate(t *testing.T) {
|
|||
TotalCount: 100,
|
||||
ImportCount: 20,
|
||||
LastTimestamp: time.Now(),
|
||||
ImportErrors: []string{"foo"},
|
||||
}
|
||||
newResult := models.ImportResult{
|
||||
TotalCount: 120,
|
||||
ImportCount: 50,
|
||||
LastTimestamp: time.Now().Add(1 * time.Hour),
|
||||
ImportErrors: []string{"bar"},
|
||||
}
|
||||
result.Update(newResult)
|
||||
assert.Equal(t, 120, result.TotalCount)
|
||||
assert.Equal(t, 50, result.ImportCount)
|
||||
assert.Equal(t, newResult.LastTimestamp, result.LastTimestamp)
|
||||
assert.Equal(t, []string{"foo", "bar"}, result.ImportErrors)
|
||||
}
|
||||
|
||||
func TestImportResultUpdateTimestamp(t *testing.T) {
|
||||
|
|
Loading…
Add table
Reference in a new issue