Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONSchema ¶
func JSONSchema() string
Returns json schema for the payload part of the task definition. Please note we use a go string and do not load an external file, since we want this to be *part of the compiled executable*. If this sat in another file that was loaded at runtime, it would not be burned into the build, which would be bad for the following two reasons:
- we could no longer distribute a single binary file that didn't require installation/extraction
- the payload schema is specific to the version of the code, therefore should be versioned directly with the code and *frozen on build*.
Run `generic-worker show-payload-schema` to output this schema to standard out.
Types ¶
type D2GTestCases ¶
type D2GTestCases struct { // A suite of tests for a particular d2g feature or set of features TestSuite TestSuite `json:"testSuite"` }
Static d2g input/output test cases. Contains pairs of Docker Worker task def/payload (inputs) and Generic Worker expected task def/payload (outputs).
type TaskDefinitionTestCase ¶
type TaskDefinitionTestCase struct { // Detailed information about what the test case tests Description string `json:"description"` // Additional properties allowed DockerWorkerTaskDefinition json.RawMessage `json:"dockerWorkerTaskDefinition"` // Additional properties allowed GenericWorkerTaskDefinition json.RawMessage `json:"genericWorkerTaskDefinition"` // Name for the test case Name string `json:"name"` }
A test case contains a static input Docker Worker task definition, and an expected Generic Worker task definition output. The Docker Worker task definition is converted by d2g to a Generic Worker task definition. The test is successful if the generated Generic Worker task definition exactly matches the Generic Worker task definition in the test case.
type TaskPayloadTestCase ¶
type TaskPayloadTestCase struct { // Detailed information about what the test case tests Description string `json:"description"` // Additional properties allowed DockerWorkerTaskPayload json.RawMessage `json:"dockerWorkerTaskPayload"` // Additional properties allowed GenericWorkerTaskPayload json.RawMessage `json:"genericWorkerTaskPayload"` // Name for the test case Name string `json:"name"` }
A test case contains a static input Docker Worker task payload, and an expected Generic Worker task payload output. The Docker Worker task payload is converted by d2g to a Generic Worker task payload. The test is successful if the generated Generic Worker task payload exactly matches the Generic Worker task payload in the test case.
type TestSuite ¶
type TestSuite struct { // Detailed information about what the test cases do and do not test Description string `json:"description"` // Name for the test suite Name string `json:"name"` // The test cases which this test suite contains PayloadTests []TaskPayloadTestCase `json:"payloadTests,omitempty"` // The test cases which this test suite contains TaskDefTests []TaskDefinitionTestCase `json:"taskDefTests,omitempty"` }
A suite of tests for a particular d2g feature or set of features