Expand readonly mode test slightly (#4304)
Must have forgotten to submit the suggestion for this in #4302 Maintenance is a quick way to check if readonly mode is working. It doesn't require pulling any data from graph but will still allow us to check for a sentinel error. --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [x] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Test Plan - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
1389b53eaf
commit
83815eee0e
@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/kopia/kopia/repo/blob/readonly"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
@ -414,8 +415,13 @@ func (suite *RepositoryIntegrationSuite) TestConnect_ReadOnly() {
|
||||
r, err := Connect(ctx, account.Account{}, st, repo.GetID(), control.Options{Repo: ctrlRepo.Options{ReadOnly: true}})
|
||||
assert.NoError(t, err)
|
||||
|
||||
// now we have repoID beforehand
|
||||
assert.Equal(t, r.GetID(), r.GetID())
|
||||
// Maintenance attempts to write some blobs just to say it was running. Since
|
||||
// we're in readonly mode it should fail with a sentinel error.
|
||||
op, err := r.NewMaintenance(ctx, ctrlRepo.Maintenance{})
|
||||
require.NoError(t, err, clues.ToCore(err))
|
||||
|
||||
err = op.Run(ctx)
|
||||
assert.ErrorIs(t, err, readonly.ErrReadonly)
|
||||
}
|
||||
|
||||
// Test_Options tests that the options are passed through to the repository
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user