mirror of
https://github.com/kopia/kopia.git
synced 2026-09-22 10:15:08 -04:00
- use struct field initialization idiom - clarify error message - directly use s.rootctx in server request processing - refactor: use require in e2e ACL test - inline constant definition - modernize with `strings.Cut` - modernize with slices.Backward - simplify timeFormat initialization - refactor testing: check `Scanner.Err()` in testenv - remove spurious parenthesis - trueStr and falseStr consts - use inheritPolicyString - use const in cache info - "bytes" const in ui task counters - use common consts in gettool
33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
package cli_test
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/kopia/kopia/tests/testenv"
|
|
)
|
|
|
|
func (s *formatSpecificTestSuite) TestIndexInspect(t *testing.T) {
|
|
env := testenv.NewCLITest(t, s.formatFlags, testenv.NewInProcRunner(t))
|
|
|
|
env.RunAndExpectSuccess(t, "repo", "create", "filesystem", "--path", env.RepoDir)
|
|
|
|
someIndex, _, _ := strings.Cut(env.RunAndExpectSuccess(t, "index", "list")[0], " ")
|
|
someContentID := env.RunAndExpectSuccess(t, "content", "list")[0]
|
|
env.RunAndExpectSuccess(t, "index", "inspect", someIndex)
|
|
env.RunAndExpectSuccess(t, "index", "inspect", "--active")
|
|
env.RunAndExpectSuccess(t, "index", "inspect", "--all")
|
|
|
|
require.Len(t, env.RunAndExpectSuccess(t, "index", "inspect", "--active", "--content-id", someContentID), 1)
|
|
require.Empty(t, env.RunAndExpectSuccess(t, "index", "inspect", "--active", "--content-id", "nosuchcontent"))
|
|
|
|
// now rewrite one content, making it appear in second index
|
|
env.RunAndExpectSuccess(t, "content", "rewrite", someContentID, "--safety=none")
|
|
require.Len(t, env.RunAndExpectSuccess(t, "index", "inspect", "--all", "--content-id", someContentID), 2)
|
|
|
|
// no targets specified
|
|
env.RunAndExpectFailure(t, "index", "inspect")
|
|
}
|