mirror of
https://github.com/kopia/kopia.git
synced 2026-05-11 00:04:46 -04:00
Cleanup robustness tests and `local_fs_test.go` "Mechanical" changes: - Use `require` helpers - Use `testing.T` helpers Note change in functionality: The use of `require` helpers stops tests once a check fails. Before, various checks were using `t.Error`, which fails the test but allows the test to continue its execution. * refactor(general): cleanup robustness/snapmeta/kopia_persister_light_test.go Use `require` helpers Use `testing.T` helpers * refactor(general): cleanup local_fs_test.go * fix import order
31 lines
577 B
Go
31 lines
577 B
Go
//go:build darwin || (linux && amd64)
|
|
// +build darwin linux,amd64
|
|
|
|
package snapmeta
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestIndex(t *testing.T) {
|
|
idx := Index{}
|
|
|
|
const (
|
|
snapshotIndexName = "snapshotIndex"
|
|
snapIDKey = "snapID1"
|
|
)
|
|
|
|
idx.AddToIndex(snapIDKey, snapshotIndexName)
|
|
|
|
keys := idx.GetKeys(snapshotIndexName)
|
|
require.Len(t, keys, 1, "unexpected number of keys")
|
|
require.Equal(t, snapIDKey, keys[0])
|
|
|
|
idx.RemoveFromIndex(snapIDKey, snapshotIndexName)
|
|
|
|
keys = idx.GetKeys(snapshotIndexName)
|
|
require.Empty(t, keys)
|
|
}
|