Documentation ¶
Overview ¶
Package fixture provides testing fixtures for aurorabridge.
A fixture is a function which returns a type populated with randomized testing data. They are an answer to global test constants and copy-and-pasting arbitrarily populated structs around test files. Fixtures are useful for high-level tests which just need some valid data to plumb through mocks.
The philosophy of fixtures is that tests should only declare data relevant to the test. Tests should be easy to write, easier to read, and focus only on details that affect the passage or failure of the test. Anything else is a distraction.
When to use a fixture:
- Your test doesn't care what the data is, it just needs something to mock against.
- Your test needs a lot of unique data.
When to NOT use a fixture:
- Your test depends on some carefully constructed data, e.g. events ordered in a special way or integers with an exact value. In these cases, construct the data directly in the test.
When to maybe use a fixture:
- Your test doesn't care what *most* of the data is, but is very interested in a specific field. In this case, it can be appropriate to call a fixture but overwrite the desired field.
What fixtures should look like:
- Prefers building on other fixtures instead of taking parameters. Note, in some situations parameters can still be useful as long as they are simple.
- Random values still make sense semantically, e.g. instance count is between 1-10000 and service name looks like "service-ahgb73".
Index ¶
- func AuroraInstanceSet(n, max int) map[int32]struct{}
- func AuroraJobKey() *api.JobKey
- func AuroraJobUpdateKey() *api.JobUpdateKey
- func AuroraJobUpdateRequest() *api.JobUpdateRequest
- func AuroraMetadata() []*api.Metadata
- func AuroraTaskConfig() *api.TaskConfig
- func AuroraTaskQuery() *api.TaskQuery
- func DefaultPelotonJobLabels(jobKey *api.JobKey) []*peloton.Label
- func PelotonEntityVersion(vs ...int) *peloton.EntityVersion
- func PelotonJobID() *peloton.JobID
- func PelotonOpaqueData() *peloton.OpaqueData
- func PelotonResourcePoolID() *peloton.ResourcePoolID
- func PelotonUpdateSpec() *stateless.UpdateSpec
- func PelotonWorkflowInfo(eventTimestamp string) *stateless.WorkflowInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuroraInstanceSet ¶
AuroraInstanceSet returns n random instances whose values are less than max with no duplicates. Panics if n > max.
func AuroraJobUpdateKey ¶
func AuroraJobUpdateKey() *api.JobUpdateKey
AuroraJobUpdateKey returns a random JobUpdateKey.
func AuroraJobUpdateRequest ¶
func AuroraJobUpdateRequest() *api.JobUpdateRequest
AuroraJobUpdateRequest returns a random JobUpdateRequest.
func AuroraMetadata ¶
AuroraMetadata returns a list of random Metadata.
func AuroraTaskConfig ¶
func AuroraTaskConfig() *api.TaskConfig
AuroraTaskConfig returns a random TaskConfig.
func AuroraTaskQuery ¶
AuroraTaskQuery returns a random TaskQuery containing a random job_key.
func DefaultPelotonJobLabels ¶
DefaultPelotonJobLabels returns a list of default labels for peloton jobs
func PelotonEntityVersion ¶
func PelotonEntityVersion(vs ...int) *peloton.EntityVersion
PelotonEntityVersion returns a random EntityVersion.
func PelotonOpaqueData ¶
func PelotonOpaqueData() *peloton.OpaqueData
PelotonOpaqueData returns opaque data with a random update id.
func PelotonResourcePoolID ¶
func PelotonResourcePoolID() *peloton.ResourcePoolID
PelotonResourcePoolID returns a random ResourcePoolID.
func PelotonUpdateSpec ¶
func PelotonUpdateSpec() *stateless.UpdateSpec
PelotonUpdateSpec returns a random UpdateSpec.
func PelotonWorkflowInfo ¶
func PelotonWorkflowInfo(eventTimestamp string) *stateless.WorkflowInfo
PelotonWorkflowInfo returns a random WorkflowInfo.
Types ¶
This section is empty.