test

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2021 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

View Source
var BadDataFormatFile = qfs.NewMemfileBytes("abc.csv", []byte(`
"colA","colB","colC","colD"
1,2,3,4
1,2,3`))

BadDataFormatFile has weird line lengths

View Source
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

func NewEmptyTestRepo(bus event.Bus) (mr *repo.MemRepo, err error)

NewEmptyTestRepo initializes a test repo with no contents

func NewMemRepoFromDir added in v0.3.0

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 NewTestCrypto added in v0.9.5

func NewTestCrypto() key.CryptoGenerator

NewTestCrypto returns a mocked cryptographic generator for tests

func NewTestRepo

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

NewTestRepo generates a repository usable for testing purposes

func NewTestRepoFromProfileID added in v0.3.2

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

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

func TestdataPath(path string) string

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 key.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 key.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

func NewTempRepoFixedProfileID(peername, prefix string) (r TempRepo, err error)

NewTempRepoFixedProfileID creates a temp repo that always uses the same PKI credentials

func NewTempRepoUsingPeerInfo added in v0.9.12

func NewTempRepoUsingPeerInfo(peerInfoNum int, peername, prefix string) (r TempRepo, err error)

NewTempRepoUsingPeerInfo creates a temp repo using the given peerInfo

func (*TempRepo) DatasetMarshalJSON added in v0.9.5

func (r *TempRepo) DatasetMarshalJSON(ref string) (string, error)

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) GetConfig added in v0.9.5

func (r *TempRepo) GetConfig() *config.Config

GetConfig returns the configuration for the test repo.

func (*TempRepo) GetPathForDataset added in v0.9.5

func (r *TempRepo) GetPathForDataset(index int) (string, error)

GetPathForDataset returns the path to where the index'th dataset is stored on CAFS.

func (*TempRepo) LoadDataset added in v0.9.9

func (r *TempRepo) LoadDataset(ref string) (*dataset.Dataset, error)

LoadDataset from the temp repository

func (*TempRepo) ReadBodyFromIPFS added in v0.9.5

func (r *TempRepo) ReadBodyFromIPFS(keyPath string) (string, error)

ReadBodyFromIPFS reads the body of the dataset at the given keyPath stored in CAFS

func (*TempRepo) Repo added in v0.9.5

func (r *TempRepo) Repo(ctx context.Context) (repo.Repo, error)

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

func (r *TempRepo) WriteConfigFile() error

WriteConfigFile serializes the config file and writes it to the qri repository

func (*TempRepo) WriteRootFile added in v0.9.9

func (r *TempRepo) WriteRootFile(filename, data string) (path string, err error)

WriteRootFile writes a file string to the root directory of the temp repo

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL