Use MockExchangeData in kopia backup tests (#303)
This implements the DataStreamInfo interface needed by BackupCollections
This commit is contained in:
parent
5605a204d1
commit
9d21d65bc7
@ -54,14 +54,14 @@ func (medc *MockExchangeDataCollection) Items() <-chan connector.DataStream {
|
|||||||
|
|
||||||
// ExchangeData represents a single item retrieved from exchange
|
// ExchangeData represents a single item retrieved from exchange
|
||||||
type MockExchangeData struct {
|
type MockExchangeData struct {
|
||||||
id string
|
ID string
|
||||||
reader io.ReadCloser
|
Reader io.ReadCloser
|
||||||
}
|
}
|
||||||
|
|
||||||
func (med *MockExchangeData) UUID() string {
|
func (med *MockExchangeData) UUID() string {
|
||||||
return med.id
|
return med.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (med *MockExchangeData) ToReader() io.ReadCloser {
|
func (med *MockExchangeData) ToReader() io.ReadCloser {
|
||||||
return med.reader
|
return med.Reader
|
||||||
}
|
}
|
||||||
|
|||||||
@ -304,9 +304,9 @@ func (suite *KopiaSimpleRepoIntegrationSuite) SetupTest() {
|
|||||||
&kopiaDataCollection{
|
&kopiaDataCollection{
|
||||||
path: testPath,
|
path: testPath,
|
||||||
streams: []connector.DataStream{
|
streams: []connector.DataStream{
|
||||||
&kopiaDataStream{
|
&mockconnector.MockExchangeData{
|
||||||
uuid: testFileUUID,
|
ID: testFileUUID,
|
||||||
reader: io.NopCloser(bytes.NewReader(testFileData)),
|
Reader: io.NopCloser(bytes.NewReader(testFileData)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -314,10 +314,10 @@ func (suite *KopiaSimpleRepoIntegrationSuite) SetupTest() {
|
|||||||
|
|
||||||
stats, err := suite.w.BackupCollections(suite.ctx, collections)
|
stats, err := suite.w.BackupCollections(suite.ctx, collections)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, stats.ErrorCount, 0)
|
||||||
require.Equal(t, stats.TotalFileCount, 1)
|
require.Equal(t, stats.TotalFileCount, 1)
|
||||||
require.Equal(t, stats.TotalDirectoryCount, 3)
|
require.Equal(t, stats.TotalDirectoryCount, 3)
|
||||||
require.Equal(t, stats.IgnoredErrorCount, 0)
|
require.Equal(t, stats.IgnoredErrorCount, 0)
|
||||||
require.Equal(t, stats.ErrorCount, 0)
|
|
||||||
require.False(t, stats.Incomplete)
|
require.False(t, stats.Incomplete)
|
||||||
|
|
||||||
suite.snapshotID = manifest.ID(stats.SnapshotID)
|
suite.snapshotID = manifest.ID(stats.SnapshotID)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user