ctrl

package
v0.0.0-...-4bbce29 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseExecInfo

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

type Config

type Config struct {
	Overrides  []Override  `hcl:"override,block"`
	Executions []Execution `hcl:"execution,block"`
}

type Ctrl

type Ctrl struct {
	ExecSpec      Config
	ContinueOnErr bool
	MockServer    mockserver.Server

	ExecFrom string
	ExecTo   string
	// contains filtered or unexported fields
}

func NewCtrl

func NewCtrl(opt Option) (*Ctrl, error)

func (*Ctrl) Run

func (ctrl *Ctrl) Run(ctx context.Context) error

func (*Ctrl) WriteResult

func (ctrl *Ctrl) WriteResult(ctx context.Context, results map[string]ModelMap) error

type DuplicateElement

type DuplicateElement struct {
	Count *int   `hcl:"count,optional"`
	Addr  string `hcl:"addr,attr"`
}

type Execution

type Execution struct {
	Name string `hcl:"name,label"`
	Type string `hcl:"type,label"`

	Skip       bool              `hcl:"skip,optional"`
	SkipReason string            `hcl:"skip_reason,optional"`
	Overrides  []Override        `hcl:"override,block"`
	Vibrate    []Vibration       `hcl:"vibrate,block"`
	Env        map[string]string `hcl:"env,optional"`
	Dir        string            `hcl:"dir,optional"`
	Path       string            `hcl:"path,attr"`
	Args       []string          `hcl:"args,optional"`
}

func (Execution) String

func (exec Execution) String() string

type ExecutionState

type ExecutionState int
const (
	ExecutionStateBeforeRun ExecutionState = iota
	ExecutionStateRunning
	ExecutionStateAfterRun
)

type ExpanderOption

type ExpanderOption struct {
	EmptyObjAsStr bool `hcl:"empty_obj_as_str,optional"`
	DisableCache  bool `hcl:"disable_cache,optional"`
}

type ModelMap

type ModelMap map[string][]*swagger.JSONValuePos

ModelMap is same as SingleModelMap, but might maps one app model property to multiple API model properties. This is resulted from merging multiple SingleModelMap(s).

func (ModelMap) Add

func (mm ModelMap) Add(omm ModelMap) ModelMap
func (m ModelMap) AddLink(commit, specdir string) error

AddLink adds the LinkLocal and LinkGithuhub for each value (*swagger.JSONValuePos) of the ModelMap.

func (m ModelMap) RelativeLocalLink(specdir string) error

type Option

type Option struct {
	ConfigFile    string
	ContinueOnErr bool
	ServerOption  mockserver.Option
	ExecFrom      string
	ExecTo        string
}

type Override

type Override struct {
	PathPattern           string             `hcl:"path_pattern,attr"`
	RequestModify         *RequestDescriptor `hcl:"request_modify,block"`
	ResponseSelectorMerge string             `hcl:"response_selector_merge,optional"`
	ResponseSelectorJSON  string             `hcl:"response_selector_json,optional"`
	ResponseBody          string             `hcl:"response_body,optional"`
	ResponsePatchMerge    string             `hcl:"response_patch_merge,optional"`
	ResponsePatchJSON     string             `hcl:"response_patch_json,optional"`
	ResponseHeader        map[string]string  `hcl:"response_header,optional"`
	ResponseStatusCode    int                `hcl:"response_status_code,optional"`
	ExpanderOption        *ExpanderOption    `hcl:"expander,block"`
	SynthOption           *SynthOption       `hcl:"synthesizer,block"`
}

type RequestDescriptor

type RequestDescriptor struct {
	Method  string `hcl:"method,optional"`
	Path    string `hcl:"path,optional"`
	Version string `hcl:"version,optional"`
}

type SingleModelMap

type SingleModelMap map[string]*swagger.JSONValuePos

SingleModelMap maps a jsonpointer of a property in the application model to a property *definition* in the API model spec In case there is no such property defintion (e.g. some undefined properties appear in an object), or the property definition encountered a circular reference during its expansion, the value of the map is nil.

func MapSingleAppModel

func MapSingleAppModel(appModel map[string]interface{}, apiModels ...swagger.JSONValue) (SingleModelMap, error)

func (SingleModelMap) ToModelMap

func (smm SingleModelMap) ToModelMap() ModelMap

type SynthOption

type SynthOption struct {
	UseEnumValue     bool               `hcl:"use_enum_value,optional"`
	DuplicateElement []DuplicateElement `hcl:"duplicate_element,block"`
}

type Vibration

type Vibration struct {
	PathPattern string    `hcl:"path_pattern,attr"`
	Path        string    `hcl:"path,attr"`
	Value       cty.Value `hcl:"value,attr"`
}

Jump to

Keyboard shortcuts

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