testblb

package
v0.0.0-...-fd5963e Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTest

func RunTest(name string, clusterCfg cluster.Config, testCfg TestConfig) error

RunTest runs a test with the given name. If the test succeeds no error should be returned.

Types

type TestCase

type TestCase struct {
	// contains filtered or unexported fields
}

TestCase includes everyting that is needed to run a test of testblb.

func (*TestCase) TestConcurrentRead

func (t *TestCase) TestConcurrentRead() error

TestConcurrentRead tests concurrently reading from disjoint intervals in the same blob.

func (*TestCase) TestCorruptAndUnblock

func (tc *TestCase) TestCorruptAndUnblock() error

TestCorruptAndUnblock trashes all replicas of a tract except one and expects to be able to write to it.

func (*TestCase) TestCorruptLoseTract

func (tc *TestCase) TestCorruptLoseTract() error

TestCorruptLoseTract tests that a tract can be successfully rereplicated in the case of mixed data corruption and server lost failure, as long as there is at least one replica available.

func (*TestCase) TestCorruptTract

func (tc *TestCase) TestCorruptTract() error

TestCorruptTract corrupts a tract on a tract server that owns it. The tract server should detect that and finally the curator should re-replicate that tract.

  1. Create a blob and write some data to it.
  2. Pick a tract server that owns the first tract and corrupt it.
  3. Wait until the tract server detects it and the tract gets re-replicated.

func (*TestCase) TestCuratorConsistency

func (tc *TestCase) TestCuratorConsistency() error

TestCuratorConsistency tests the consistency check functionality of the curator. First it checks that it can pass a check. Then it corrupts the state of one curator and checks that it causes a check failure.

func (*TestCase) TestCuratorPartition

func (tc *TestCase) TestCuratorPartition() error

TestCuratorPartition tests that during a network partition that a quorum of curators can't talk to each other we'll lose the availability of the curator because we opt for consistency instead of availability during network partitions. And when the partition gets healed(partially healed) that a quorum of curators of a curator group can talk the system will be available again eventually.

  1. Create a blob and it should succeed.
  2. Partition curator replicas of each curator gorup that no quorum can talk to each other.
  3. Eventually the leaders of each curator group will step down.
  4. Create will fail.
  5. Heal the partition that a quorum of each curator group can talk with each other, a new leader of each group will be elected.
  6. Create should succeed again.

func (*TestCase) TestDrain

func (tc *TestCase) TestDrain() error

TestDrain tests that we can set control flags on a disk on a tractserver and have it drain (curator replicates tracts off of it).

func (*TestCase) TestGCAfterInterruptedRerepl

func (tc *TestCase) TestGCAfterInterruptedRerepl() error

TestGCAfterInterruptedRerepl exercises gc-ing a up-to-date tract on a tractserver not in the repl group due to interrupted rerepl.

func (*TestCase) TestGCDeletedTract

func (tc *TestCase) TestGCDeletedTract() error

TestGCDeletedTract exercises gc-ing tracts in a deleted blob.

func (*TestCase) TestGCStaleTract

func (tc *TestCase) TestGCStaleTract() error

TestGCStaleTract exercises gc-ing a stale tract.

func (*TestCase) TestInterruptedRerepl

func (tc *TestCase) TestInterruptedRerepl() error

TestInterruptedRerepl exercises the situation that might result if a curator crashed in the middle of a re-replication, after it had bumped the version on some tractservers, but maybe not all, and its durable version number has not been updated.

func (*TestCase) TestInterruptedRereplFixversion

func (tc *TestCase) TestInterruptedRereplFixversion() error

TestInterruptedRereplFixversion is similar to TestInterruptedRerepl with the distinction that in a replication group of 3, we crash one host, bump the version on the second (simulating the curator crashed in the middle of re-replication), and only leave the third intact. Writting to the tract should eventually success after all background rereplication and version fixing.

func (*TestCase) TestInterruptedRereplRead

func (tc *TestCase) TestInterruptedRereplRead() error

TestInterruptedRereplRead exercises the situation that might result if a curator crashed in the middle of a re-replication, after it had bumped the version on all tractservers but not updated its durable state yet.

func (*TestCase) TestMasterConsistency

func (tc *TestCase) TestMasterConsistency() error

TestMasterConsistency tests the consistency check functionality of the master. First it checks that it can pass a check. Then it corrupts the state of one master and checks that it causes a check failure.

func (*TestCase) TestMasterPartition

func (tc *TestCase) TestMasterPartition() error

TestMasterPartition tests that during a network partition that a quorum of masters can't talk to each other we'll lose the availability of the master because we opt for consistency instead of availability during network partitions. And when the partition gets healed(partially healed) that a quorum of masters can talk the system will be available again eventually.

  1. Create a blob and it should succeed.
  2. Partition master replicas that no quorum can talk to each other.
  3. Eventually the leader of the master group will step down.
  4. Create will fail.
  5. Heal the partition that a quorum can talk with each other, a new leader will be elected.
  6. Create should succeed again.

func (*TestCase) TestMissingTract

func (tc *TestCase) TestMissingTract() error

TestMissingTract tests that a tract exists in curator's state but missing on one of tract servers. This should be detected by curator and the tract will be re-replicated.

func (*TestCase) TestOnlyOneHost

func (tc *TestCase) TestOnlyOneHost() error

TestOnlyOneHost tests that a tract can be written to (eventually) even if every replica except one is down.

func (*TestCase) TestPack

func (tc *TestCase) TestPack() error

TestPack tests that a tractserver can pack tracts.

func (*TestCase) TestPackFailure

func (tc *TestCase) TestPackFailure() error

TestPackFailure tests that PackTracts fails if sources are corrupted.

func (*TestCase) TestRSEncode

func (tc *TestCase) TestRSEncode() error

TestRSEncode tests that a tractserver can RSEncode from/to other tractservers.

func (*TestCase) TestRSRecovery

func (tc *TestCase) TestRSRecovery() error

TestRSRecovery tests that the curator can recover RS data from various types of failures. We test a bunch of things serially to amoritize the setup time.

func (*TestCase) TestReadEOF

func (tc *TestCase) TestReadEOF() error

TestReadEOF tests whether client can get EOF error after reading a whole blob.

func (*TestCase) TestReadOnly

func (tc *TestCase) TestReadOnly() error

TestReadOnly tests the read-only mode of the curator.

func (*TestCase) TestRerepl

func (tc *TestCase) TestRerepl() error

TestRerepl exercises a single rereplicate operation.

func (*TestCase) TestRereplReadOnly

func (tc *TestCase) TestRereplReadOnly() error

TestRereplReadOnly verifies read-only tract can be properly handled for writes. Writing to a read-only tract should fail and trigger rereplication. After that, further write should succeed.

  1. Create a blob and write some data to it.
  2. Pick a replica of the first tract and make it read-only.
  3. Wait until the tract gets rereplicated and verify with a write.

func (*TestCase) TestStorageHint

func (tc *TestCase) TestStorageHint() error

TestStorageHint tests functionality related to storage hints and classes.

func (*TestCase) TestStorageMigration

func (tc *TestCase) TestStorageMigration() error

TestStorageMigration tests that the curator can erasure-code data.

func (*TestCase) TestTimes

func (tc *TestCase) TestTimes() error

TestTimes tests mtime/atime/expires functionality.

func (*TestCase) TestWriteReadAcrossTracts

func (tc *TestCase) TestWriteReadAcrossTracts() error

TestWriteReadAcrossTracts tests writing to different parts of an existing blob and the write might span multiple tracts. After the write the blob should be in an expected state.

func (*TestCase) TestWriteReadLong

func (tc *TestCase) TestWriteReadLong() error

TestWriteReadLong writes data to blb, reads it out and verifies we get what we wrote.

func (*TestCase) TestWriteReadNoFailure

func (tc *TestCase) TestWriteReadNoFailure() error

TestWriteReadNoFailure tests that write and read operation should work as expected in case that there's no failures.

func (*TestCase) TestWriteReadRaftFailure

func (tc *TestCase) TestWriteReadRaftFailure() error

TestWriteReadRaftFailure tests that replicas of master and curator can fail arbitrarily but as long as a quorum of master or curator are up the whole Blb cluster should still function.

  1. Create blob and write some data to it.
  2. Kill all master and curator replicas and restart a quorum of instance.
  3. Read back the original blob so we know the blob metadata is still accessible.
  4. Create, write and verify a new Blob so we know masters & curators are still writable.

func (*TestCase) TestWriteReadWithFailureLong

func (tc *TestCase) TestWriteReadWithFailureLong() error

TestWriteReadWithFailureLong is similar to WriteAndRead, with the distinction that some master/curator/tractserver instances are killed and restarted randomly from time to time.

type TestConfig

type TestConfig struct {
	TestTime        time.Duration // How long we run the test.
	WriteInterval   time.Duration // How often we write.
	FailureInterval time.Duration // How often we kill a server.
	WriteSizeLowMB  int           // The smallest write size in mb.
	WriteSizeHighMB int           // The largest write size in mb.
	MaxReplFactor   int           // Maximum replication factor.
	NumWriters      int           // Number of concurrent writers.
	DisableCache    bool          // Whether client cache is disabled.
	TestPattern     string        // Regex matching tests to run.
	TestLong        bool          // Whether tests ended with "Long" should be run (they tend to last for an extended period of time and are disabled by default).
	NumWorkers      int           // Number of test workers to run in parallel.
}

TestConfig includes configuration parameters for testing.

type TestResult

type TestResult struct {
	Name    string
	Err     error
	LogPath string
	Elapsed time.Duration
}

func RunController

func RunController(testCfg TestConfig, binDir, workDir string, neededPorts int) (ret []TestResult)

RunController is called by the controller process to initialize resources and spawn worker processes to run tests that need to be run. The test results will be returned as a map which has test names as keys and results as values.

Jump to

Keyboard shortcuts

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