qri: github.com/qri-io/qri/repo/test Index | Files

package test

import "github.com/qri-io/qri/repo/test"

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

Package Files

test.go test_profilestore.go test_refstore.go test_repo.go

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

func NewEmptyTestRepo Uses

func NewEmptyTestRepo(rc *regclient.Client) (mr *repo.MemRepo, err error)

NewEmptyTestRepo initializes a test repo with no contents

func NewMemRepoFromDir Uses

func NewMemRepoFromDir(path string) (repo.Repo, crypto.PrivKey, error)

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 Uses

func NewTestRepo(rc *regclient.Client) (mr *repo.MemRepo, err error)

NewTestRepo generates a repository usable for testing purposes

func NewTestRepoFromProfileID Uses

func NewTestRepoFromProfileID(id profile.ID, peerNum int, dataIndex int) (repo.Repo, error)

NewTestRepoFromProfileID constructs a repo from a profileID, usable for tests

func NewTestRepoWithHistory Uses

func NewTestRepoWithHistory(rc *regclient.Client) (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 Uses

func ProfileConfig() *config.ProfilePod

ProfileConfig returns the test profile as a config.Profile

func ReadRepoConfig Uses

func ReadRepoConfig(path string) (pro *profile.Profile, pk crypto.PrivKey, err error)

ReadRepoConfig loads configuration data from a .yaml file

func RunRepoTests Uses

func RunRepoTests(t *testing.T, rmf RepoMakerFunc)

RunRepoTests tests that this repo conforms to expected behaviors

type RepoMakerFunc Uses

type RepoMakerFunc func(t *testing.T) (r repo.Repo, cleanup func())

RepoMakerFunc produces a new instance of a repository when called the returned cleanup function will be called at the end of each test, and can be used to do things like remove temp files

Package test imports 22 packages (graph) and is imported by 1 packages. Updated 2019-07-08. Refresh now. Tools for package owners.