Documentation ¶
Overview ¶
Package test contains a set of tests to ensure a repo implementation conforms to expected behaviors, calling RunRepoTests on a given repo implementation should pass all checks in order to properly work with Qri. test also has a TestRepo, which uses an in-memory implementation of Repo suited for tests that require a repo
Index ¶
- Variables
- func NewEmptyTestRepo() (mr *repo.MemRepo, err error)
- func NewMemRepoFromDir(path string) (repo.Repo, crypto.PrivKey, error)
- func NewTestRepo() (mr *repo.MemRepo, err error)
- func NewTestRepoFromProfileID(id profile.ID, peerNum int, dataIndex int) (repo.Repo, error)
- func NewTestRepoWithHistory() (mr *repo.MemRepo, refs []repo.DatasetRef, err error)
- func ProfileConfig() *config.ProfilePod
- func ReadRepoConfig(path string) (pro *profile.Profile, pk crypto.PrivKey, err error)
- func RunRepoTests(t *testing.T, rmf RepoMakerFunc)
- type RepoMakerFunc
Constants ¶
This section is empty.
Variables ¶
var BadBodyFile = qfs.NewMemfileBytes("bad_csv_file.csv", []byte(`
asdlkfasd,,
fm as
f;lajsmf
a
's;f a'
sdlfj asdf`))
BadBodyFile is a bunch of bad CSV data
var BadDataFormatFile = qfs.NewMemfileBytes("abc.csv", []byte(`
"colA","colB","colC","colD"
1,2,3,4
1,2,3`))
BadDataFormatFile has weird line lengths
var BadStructureFile = qfs.NewMemfileBytes("badStructure.csv", []byte(`
colA, colB, colB, colC
1,2,3,4
1,2,3,4`))
BadStructureFile has double-named columns
Functions ¶
func NewEmptyTestRepo ¶ added in v0.6.0
NewEmptyTestRepo initializes a test repo with no contents
func NewMemRepoFromDir ¶ added in v0.3.0
NewMemRepoFromDir reads a director of testCases and calls createDataset on each case with the given privatekey, yeilding a repo where the peer with this pk has created each dataset in question
func NewTestRepo ¶
NewTestRepo generates a repository usable for testing purposes
func NewTestRepoFromProfileID ¶ added in v0.3.2
NewTestRepoFromProfileID constructs a repo from a profileID, usable for tests
func NewTestRepoWithHistory ¶ added in v0.8.0
func NewTestRepoWithHistory() (mr *repo.MemRepo, refs []repo.DatasetRef, err error)
NewTestRepoWithHistory generates a repository with a dataset that has a history, usable for testing purposes
func ProfileConfig ¶ added in v0.3.0
func ProfileConfig() *config.ProfilePod
ProfileConfig returns the test profile as a config.Profile
func ReadRepoConfig ¶ added in v0.3.0
ReadRepoConfig loads configuration data from a .yaml file
func RunRepoTests ¶
func RunRepoTests(t *testing.T, rmf RepoMakerFunc)
RunRepoTests tests that this repo conforms to expected behaviors