d2gtest

package
v54.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MPL-2.0 Imports: 1 Imported by: 0

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:

  1. we could no longer distribute a single binary file that didn't require installation/extraction
  2. 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 payload (inputs) and Generic Worker expected payload (outputs).

type TestCase

type TestCase 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
	Tests []TestCase `json:"tests"`
}

A suite of tests for a particular d2g feature or set of features

Jump to

Keyboard shortcuts

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