fix tests, missing producer
This commit is contained in:
parent
3da8bf86a4
commit
945e4ecbd0
@ -224,7 +224,7 @@ func (gc *GraphConnector) UnionSiteIDsAndWebURLs(
|
||||
}
|
||||
|
||||
// AwaitStatus waits for all gc tasks to complete and then returns status
|
||||
func (gc *GraphConnector) Wait() data.CollectionStats {
|
||||
func (gc *GraphConnector) Wait() *data.CollectionStats {
|
||||
defer func() {
|
||||
if gc.region != nil {
|
||||
gc.region.End()
|
||||
@ -245,7 +245,7 @@ func (gc *GraphConnector) Wait() data.CollectionStats {
|
||||
gc.wg = &sync.WaitGroup{}
|
||||
gc.status = support.ConnectorOperationStatus{}
|
||||
|
||||
return dcs
|
||||
return &dcs
|
||||
}
|
||||
|
||||
// UpdateStatus is used by gc initiated tasks to indicate completion
|
||||
|
||||
@ -37,8 +37,8 @@ func (gc GraphConnector) ProduceBackupCollections(
|
||||
return gc.Collections, gc.Exclude, gc.Err
|
||||
}
|
||||
|
||||
func (gc GraphConnector) Wait() data.CollectionStats {
|
||||
return gc.Stats
|
||||
func (gc GraphConnector) Wait() *data.CollectionStats {
|
||||
return &gc.Stats
|
||||
}
|
||||
|
||||
func (gc GraphConnector) ConsumeRestoreCollections(
|
||||
|
||||
@ -73,6 +73,7 @@ func NewBackupOperation(
|
||||
Version: "v0",
|
||||
account: acct,
|
||||
incremental: useIncrementalBackup(selector, opts),
|
||||
bp: bp,
|
||||
}
|
||||
|
||||
if len(ownerName) == 0 {
|
||||
@ -104,7 +105,7 @@ func (op BackupOperation) validate() error {
|
||||
// get populated asynchronously.
|
||||
type backupStats struct {
|
||||
k *kopia.BackupStats
|
||||
gc data.CollectionStats
|
||||
gc *data.CollectionStats
|
||||
resourceCount int
|
||||
}
|
||||
|
||||
@ -331,7 +332,7 @@ type BackupProducer interface {
|
||||
) ([]data.BackupCollection, map[string]map[string]struct{}, error)
|
||||
// TODO: ConnectorOperationStatus should be replaced with something
|
||||
// more generic.
|
||||
Wait() data.CollectionStats
|
||||
Wait() *data.CollectionStats
|
||||
}
|
||||
|
||||
// calls the producer to generate collections of data to backup
|
||||
@ -684,12 +685,12 @@ func (op *BackupOperation) persistResults(
|
||||
op.Results.ItemsWritten = opStats.k.TotalFileCount
|
||||
op.Results.ResourceOwners = opStats.resourceCount
|
||||
|
||||
if opStats.gc.IsZero() {
|
||||
if opStats.gc == nil {
|
||||
op.Status = Failed
|
||||
return clues.New("backup population never completed")
|
||||
}
|
||||
|
||||
if op.Status != Failed && opStats.gc.Successes == 0 {
|
||||
if op.Status != Failed && opStats.gc.IsZero() {
|
||||
op.Status = NoData
|
||||
}
|
||||
|
||||
|
||||
@ -380,7 +380,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_PersistResults() {
|
||||
TotalHashedBytes: 1,
|
||||
TotalUploadedBytes: 1,
|
||||
},
|
||||
gc: data.CollectionStats{Successes: 1},
|
||||
gc: &data.CollectionStats{Successes: 1},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -389,7 +389,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_PersistResults() {
|
||||
fail: assert.AnError,
|
||||
stats: backupStats{
|
||||
k: &kopia.BackupStats{},
|
||||
gc: data.CollectionStats{},
|
||||
gc: &data.CollectionStats{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -397,7 +397,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_PersistResults() {
|
||||
expectErr: assert.NoError,
|
||||
stats: backupStats{
|
||||
k: &kopia.BackupStats{},
|
||||
gc: data.CollectionStats{},
|
||||
gc: &data.CollectionStats{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ func (op RestoreOperation) validate() error {
|
||||
// get populated asynchronously.
|
||||
type restoreStats struct {
|
||||
cs []data.RestoreCollection
|
||||
gc data.CollectionStats
|
||||
gc *data.CollectionStats
|
||||
bytesRead *stats.ByteCounter
|
||||
resourceCount int
|
||||
|
||||
@ -280,12 +280,12 @@ func (op *RestoreOperation) persistResults(
|
||||
op.Results.ItemsRead = len(opStats.cs) // TODO: file count, not collection count
|
||||
op.Results.ResourceOwners = opStats.resourceCount
|
||||
|
||||
if opStats.gc.IsZero() {
|
||||
if opStats.gc == nil {
|
||||
op.Status = Failed
|
||||
return clues.New("restoration never completed")
|
||||
}
|
||||
|
||||
if op.Status != Failed && opStats.gc.Successes == 0 {
|
||||
if op.Status != Failed && opStats.gc.IsZero() {
|
||||
op.Status = NoData
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ type RestoreConsumer interface {
|
||||
) (*details.Details, error)
|
||||
// TODO: ConnectorOperationStatus should be replaced with something
|
||||
// more generic.
|
||||
Wait() data.CollectionStats
|
||||
Wait() *data.CollectionStats
|
||||
}
|
||||
|
||||
func consumeRestoreCollections(
|
||||
|
||||
@ -74,7 +74,7 @@ func (suite *RestoreOpSuite) TestRestoreOperation_PersistResults() {
|
||||
Collection: &mockconnector.MockExchangeDataCollection{},
|
||||
},
|
||||
},
|
||||
gc: data.CollectionStats{
|
||||
gc: &data.CollectionStats{
|
||||
Objects: 1,
|
||||
Successes: 1,
|
||||
},
|
||||
@ -86,7 +86,7 @@ func (suite *RestoreOpSuite) TestRestoreOperation_PersistResults() {
|
||||
fail: assert.AnError,
|
||||
stats: restoreStats{
|
||||
bytesRead: &stats.ByteCounter{},
|
||||
gc: data.CollectionStats{},
|
||||
gc: &data.CollectionStats{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -95,7 +95,7 @@ func (suite *RestoreOpSuite) TestRestoreOperation_PersistResults() {
|
||||
stats: restoreStats{
|
||||
bytesRead: &stats.ByteCounter{},
|
||||
cs: []data.RestoreCollection{},
|
||||
gc: data.CollectionStats{},
|
||||
gc: &data.CollectionStats{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user