Documentation ¶
Index ¶
- func NewDefaultFileResolver() *fr.DefaultFileResolver
- func ParseMandosScenario(parser mjparse.Parser, scenFilePath string) (*mj.Scenario, error)
- func ParseMandosScenarioDefaultParser(scenFilePath string) (*mj.Scenario, error)
- func WriteMandosScenario(scenario *mj.Scenario, toPath string) error
- type RunScenarioOptions
- type ScenarioExecutor
- type ScenarioRunner
- type TestExecutor
- type TestRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultFileResolver ¶
func NewDefaultFileResolver() *fr.DefaultFileResolver
NewDefaultFileResolver yields a new DefaultFileResolver instance. Reexported here to avoid having all external packages importing the parser. DefaultFileResolver is in parse for local tests only.
func ParseMandosScenario ¶ added in v1.4.73
ParseMandosScenario reads and parses a Mandos scenario from a JSON file.
func ParseMandosScenarioDefaultParser ¶ added in v1.4.73
ParseMandosScenarioDefaultParser reads and parses a Mandos scenario from a JSON file.
Types ¶
type RunScenarioOptions ¶
type RunScenarioOptions struct {
ForceTraceGas bool
}
func DefaultRunScenarioOptions ¶
func DefaultRunScenarioOptions() *RunScenarioOptions
type ScenarioExecutor ¶
type ScenarioExecutor interface { // Reset clears state/world. Reset() // ExecuteScenario executes the scenario and checks if it passed. Failure is signaled by returning an error. // The FileResolver helps with resolving external steps. // TODO: group into a "execution context" param. ExecuteScenario(*mj.Scenario, fr.FileResolver) error }
ScenarioExecutor describes a component that can run a VM scenario.
type ScenarioRunner ¶
type ScenarioRunner struct { Executor ScenarioExecutor RunsNewTest bool Parser mjparse.Parser }
ScenarioRunner is a component that can run json scenarios, using a provided executor.
func NewScenarioRunner ¶
func NewScenarioRunner(executor ScenarioExecutor, fileResolver fr.FileResolver) *ScenarioRunner
NewScenarioRunner creates new ScenarioRunner instance.
func (*ScenarioRunner) RunAllJSONScenariosInDirectory ¶
func (r *ScenarioRunner) RunAllJSONScenariosInDirectory( generalTestPath string, specificTestPath string, allowedSuffix string, excludedFilePatterns []string, options *RunScenarioOptions) error
RunAllJSONScenariosInDirectory walks directory, parses and prepares all json scenarios, then calls scenarioExecutor for each of them.
func (*ScenarioRunner) RunSingleJSONScenario ¶
func (r *ScenarioRunner) RunSingleJSONScenario(contextPath string, options *RunScenarioOptions) error
RunSingleJSONScenario parses and prepares test, then calls testCallback.
type TestExecutor ¶
type TestExecutor interface { // ExecuteTest executes the test and checks if it passed. Failure is signaled by returning an error. ExecuteTest(*mj.Test) error }
TestExecutor describes a component that can run a VM test.
type TestRunner ¶
type TestRunner struct { Executor TestExecutor Parser mjparse.Parser }
TestRunner is a component that can run tests, using a provided executor.
func NewTestRunner ¶
func NewTestRunner(executor TestExecutor, fileResolver fr.FileResolver) *TestRunner
NewTestRunner creates new TestRunner instance.
func (*TestRunner) RunAllJSONTestsInDirectory ¶
func (r *TestRunner) RunAllJSONTestsInDirectory( generalTestPath string, specificTestPath string, allowedSuffix string, excludedFilePatterns []string) error
RunAllJSONTestsInDirectory walks directory, parses and prepares all json tests, then calls testExecutor for each of them.
func (*TestRunner) RunSingleJSONTest ¶
func (r *TestRunner) RunSingleJSONTest(contextPath string) error
RunSingleJSONTest parses and prepares test, then calls testCallback.