Documentation ¶
Index ¶
- Variables
- func ClearScreen() tea.Cmd
- func CompareCommandOutputs(actualOutput string, expectedOutput string, expectedSimilarity float64, ...) (float64, error)
- func ExecuteCodeBlockAsync(codeBlock parsers.CodeBlock, env map[string]string) tea.Cmd
- func ExecuteCodeBlockSync(codeBlock parsers.CodeBlock, env map[string]string) tea.Msg
- func Exit(encounteredFailure bool) tea.Cmd
- func UpdateAzureStatus(azureStatus environments.AzureDeploymentStatus, environment string) tea.Cmd
- type AzureStatusUpdatedMessage
- type ExitMessage
- type FailedCommandMessage
- type Report
- func (report *Report) WithCodeBlocks(codeBlocks []StatefulCodeBlock) *Report
- func (report *Report) WithEnvironmentVariables(envVars map[string]string) *Report
- func (report *Report) WithError(err error) *Report
- func (report *Report) WithProperties(properties map[string]interface{}) *Report
- func (report *Report) WriteToJSONFile(outputPath string) error
- type Scenario
- type StatefulCodeBlock
- type Step
- type SuccessfulCommandMessage
Constants ¶
This section is empty.
Variables ¶
var Program *tea.Program = nil
TODO: Ideally we won't need a global program variable. We should refactor this in the future such that each tea program is localized to the function that creates it and ExecuteCodeBlockSync doesn't mutate the global program variable.
Functions ¶
func ClearScreen ¶
clearScreen returns a command that clears the terminal screen and positions the cursor at the top-left corner
func CompareCommandOutputs ¶
func CompareCommandOutputs( actualOutput string, expectedOutput string, expectedSimilarity float64, expectedRegex *regexp.Regexp, expectedOutputLanguage string, ) (float64, error)
Compares the actual output of a command to the expected output of a command.
func ExecuteCodeBlockAsync ¶
Executes a bash command and returns a tea message with the output. This function will be executed asycnhronously.
func ExecuteCodeBlockSync ¶
Executes a bash command syncrhonously. This function will block until the command finishes executing.
func UpdateAzureStatus ¶
func UpdateAzureStatus(azureStatus environments.AzureDeploymentStatus, environment string) tea.Cmd
Updates the azure status with the current state of the interactive mode model.
Types ¶
type AzureStatusUpdatedMessage ¶
type AzureStatusUpdatedMessage struct{}
Empty struct used to indicate that the azure status has been updated so that we can respond to it within the Update() function.
type ExitMessage ¶
type ExitMessage struct {
EncounteredFailure bool
}
type FailedCommandMessage ¶
type FailedCommandMessage struct { StdOut string StdErr string Error error SimilarityScore float64 }
Emitted when a command has failed to execute.
type Report ¶
type Report struct { Name string `json:"name"` Properties map[string]interface{} `json:"properties"` EnvironmentVariables map[string]string `json:"environmentVariables"` Success bool `json:"success"` Error string `json:"error"` FailedAtStep int `json:"failedAtStep"` CodeBlocks []StatefulCodeBlock `json:"steps"` }
func BuildReport ¶
func (*Report) WithCodeBlocks ¶
func (report *Report) WithCodeBlocks(codeBlocks []StatefulCodeBlock) *Report
func (*Report) WithEnvironmentVariables ¶
func (*Report) WithProperties ¶
func (*Report) WriteToJSONFile ¶
TODO(vmarcella): Implement this to write the report to JSON.
type Scenario ¶
type Scenario struct { Name string MarkdownAst ast.Node Steps []Step Properties map[string]interface{} Environment map[string]string Source []byte }
Scenarios are the top-level object that represents a scenario to be executed.
func CreateScenarioFromMarkdown ¶
func CreateScenarioFromMarkdown( path string, languagesToExecute []string, environmentVariableOverrides map[string]string, ) (*Scenario, error)
Creates a scenario object from a given markdown file. languagesToExecute is used to filter out code blocks that should not be parsed out of the markdown file.
func (*Scenario) GetSourceAsString ¶ added in v0.2.3
Get the markdown source for the scenario as a string.
func (*Scenario) ToShellScript ¶
Convert a scenario into a shell script
type StatefulCodeBlock ¶
type StatefulCodeBlock struct { CodeBlock parsers.CodeBlock `json:"codeBlock"` CodeBlockNumber int `json:"codeBlockNumber"` Error error `json:"error"` StdErr string `json:"stdErr"` StdOut string `json:"stdOut"` StepName string `json:"stepName"` StepNumber int `json:"stepNumber"` Success bool `json:"success"` SimilarityScore float64 `json:"similarityScore"` }
State for the codeblock in interactive mode. Used to keep track of the state of each codeblock.
func (StatefulCodeBlock) WasExecuted ¶
func (s StatefulCodeBlock) WasExecuted() bool
Checks if a codeblock was executed by looking at the output, errors, and if success is true.
type SuccessfulCommandMessage ¶
Emitted when a command has been executed successfully.