Use MockExchangeData in kopia backup tests (#303)

This implements the DataStreamInfo interface needed by BackupCollections
This commit is contained in:
Vaibhav Kamra 2022-07-07 17:23:34 -07:00 committed by GitHub
parent 5605a204d1
commit 9d21d65bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -54,14 +54,14 @@ func (medc *MockExchangeDataCollection) Items() <-chan connector.DataStream {
// ExchangeData represents a single item retrieved from exchange
type MockExchangeData struct {
id string
reader io.ReadCloser
ID string
Reader io.ReadCloser
}
func (med *MockExchangeData) UUID() string {
return med.id
return med.ID
}
func (med *MockExchangeData) ToReader() io.ReadCloser {
return med.reader
return med.Reader
}

View File

@ -304,9 +304,9 @@ func (suite *KopiaSimpleRepoIntegrationSuite) SetupTest() {
&kopiaDataCollection{
path: testPath,
streams: []connector.DataStream{
&kopiaDataStream{
uuid: testFileUUID,
reader: io.NopCloser(bytes.NewReader(testFileData)),
&mockconnector.MockExchangeData{
ID: testFileUUID,
Reader: io.NopCloser(bytes.NewReader(testFileData)),
},
},
},
@ -314,10 +314,10 @@ func (suite *KopiaSimpleRepoIntegrationSuite) SetupTest() {
stats, err := suite.w.BackupCollections(suite.ctx, collections)
require.NoError(t, err)
require.Equal(t, stats.ErrorCount, 0)
require.Equal(t, stats.TotalFileCount, 1)
require.Equal(t, stats.TotalDirectoryCount, 3)
require.Equal(t, stats.IgnoredErrorCount, 0)
require.Equal(t, stats.ErrorCount, 0)
require.False(t, stats.Incomplete)
suite.snapshotID = manifest.ID(stats.SnapshotID)