test

package
v0.9.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

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

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() (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 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 []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

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

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

Types

type RepoMakerFunc added in v0.3.0

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

Jump to

Keyboard shortcuts

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