Documentation ¶
Index ¶
- Variables
- func NewEmptyTestRepo(bus event.Bus) (mr *repo.MemRepo, err error)
- func NewMemRepoFromDir(path string) (repo.Repo, crypto.PrivKey, error)
- func NewTestCrypto() gen.CryptoGenerator
- 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 []reporef.DatasetRef, err error)
- func ProfileConfig() *config.ProfilePod
- func TestdataPath(path string) string
- type TempRepo
- func (r *TempRepo) DatasetMarshalJSON(ref string) (string, error)
- func (r *TempRepo) Delete()
- func (r *TempRepo) GetConfig() *config.Config
- func (r *TempRepo) GetPathForDataset(index int) (string, error)
- func (r *TempRepo) LoadDataset(ref string) (*dataset.Dataset, error)
- func (r *TempRepo) ReadBodyFromIPFS(keyPath string) (string, error)
- func (r *TempRepo) Repo(ctx context.Context) (repo.Repo, error)
- func (r *TempRepo) WriteConfigFile() error
- func (r *TempRepo) WriteRootFile(filename, data string) (path string, err error)
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 NewTestCrypto ¶ added in v0.9.5
func NewTestCrypto() gen.CryptoGenerator
NewTestCrypto returns a mocked cryptographic generator for tests
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 []reporef.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 TestdataPath ¶ added in v0.9.5
TestdataPath returns the absolute path to a file in the testdata diretory
Types ¶
type TempRepo ¶ added in v0.9.5
type TempRepo struct { RootPath string IPFSPath string QriPath string TestCrypto gen.CryptoGenerator UseMockRemoteClient bool // contains filtered or unexported fields }
TempRepo manages a temporary repository for testing purposes, adding extra methods for testing convenience
func NewTempRepo ¶ added in v0.9.5
func NewTempRepo(peername, prefix string, g gen.CryptoGenerator) (r TempRepo, err error)
NewTempRepo constructs the test repo and initializes everything as cheaply as possible. This function is non-deterministic. Each successive call to TempRepo will use different PKI credentials
func NewTempRepoFixedProfileID ¶ added in v0.9.5
NewTempRepoFixedProfileID creates a temp repo that always uses the same PKI credentials
func (*TempRepo) DatasetMarshalJSON ¶ added in v0.9.5
DatasetMarshalJSON reads the dataset head and marshals it as json.
func (*TempRepo) Delete ¶ added in v0.9.5
func (r *TempRepo) Delete()
Delete removes the test repo on disk.
func (*TempRepo) GetPathForDataset ¶ added in v0.9.5
GetPathForDataset returns the path to where the index'th dataset is stored on CAFS.
func (*TempRepo) LoadDataset ¶ added in v0.9.9
LoadDataset from the temp repository
func (*TempRepo) ReadBodyFromIPFS ¶ added in v0.9.5
ReadBodyFromIPFS reads the body of the dataset at the given keyPath stored in CAFS
func (*TempRepo) Repo ¶ added in v0.9.5
Repo constructs the repo for use in tests, the passed in context MUST be cancelled when finished. This repo creates it's own event bus
func (*TempRepo) WriteConfigFile ¶ added in v0.9.5
WriteConfigFile serializes the config file and writes it to the qri repository
Directories ¶
Path | Synopsis |
---|---|
Package spec 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.
|
Package spec 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. |