Skip kopia upload when no collections given (#846)
## Description <!-- Insert PR description--> Currently does not throw an error. Open to other suggestions on return values. ## Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * closes #844 * #1000 ## Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
7fa86824e9
commit
56287c42fa
@ -390,6 +390,10 @@ func (w Wrapper) BackupCollections(
|
|||||||
|
|
||||||
defer trace.StartRegion(ctx, "kopia:backupCollections").End()
|
defer trace.StartRegion(ctx, "kopia:backupCollections").End()
|
||||||
|
|
||||||
|
if len(collections) == 0 {
|
||||||
|
return &BackupStats{}, &details.Details{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
progress := &corsoProgress{
|
progress := &corsoProgress{
|
||||||
pending: map[string]*itemDetails{},
|
pending: map[string]*itemDetails{},
|
||||||
deets: &details.Details{},
|
deets: &details.Details{},
|
||||||
|
|||||||
@ -780,6 +780,34 @@ type backedupFile struct {
|
|||||||
data []byte
|
data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *KopiaIntegrationSuite) TestBackupCollectionsHandlesNoCollections() {
|
||||||
|
table := []struct {
|
||||||
|
name string
|
||||||
|
collections []data.Collection
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "NilCollections",
|
||||||
|
collections: nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "EmptyCollections",
|
||||||
|
collections: []data.Collection{},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range table {
|
||||||
|
suite.T().Run(test.name, func(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
s, d, err := suite.w.BackupCollections(ctx, test.collections)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
assert.Equal(t, BackupStats{}, *s)
|
||||||
|
assert.Empty(t, d.Entries)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type KopiaSimpleRepoIntegrationSuite struct {
|
type KopiaSimpleRepoIntegrationSuite struct {
|
||||||
suite.Suite
|
suite.Suite
|
||||||
w *Wrapper
|
w *Wrapper
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user