basecli

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Copyright © 2021 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	Completed    = "completed"
	NoFailure    = "nofailure"
	SLOs         = "slos"
	SLOsByPrefix = "slosby"
)
View Source
const (
	// TextOutputFormat is the output format used to create text output
	TextOutputFormatKey = "text"

	// HTMLOutputFormat is the output format used to create html output
	HTMLOutputFormatKey = "html"
)
View Source
const (
	Iter8Hub = "github.com/iter8-tools/iter8.git//hub"
)

Variables

View Source
var AssertOptions = AssertOptionsType{}
View Source
var GenOptions = GenOptionsType{}
View Source
var ReportOptions = ReportOptionsType{
	OutputFormat: TextOutputFormatKey,
}
View Source
var RootCmd = &cobra.Command{
	Use:     "iter8",
	Short:   "Metrics driven experiments",
	Long:    globalUsage,
	Version: "v0.8",
}

RootCmd represents the base command when called without any subcommands

Functions

func ExecTemplate

func ExecTemplate(t executable, exp *Experiment) error

execute text or html template with experiment

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func Generate

func Generate(values []string) (result *bytes.Buffer, err error)

func NewAssertCmd

func NewAssertCmd() *cobra.Command

NewAssertCmd creates an assert command with the assert flagset

func NewReportCmd

func NewReportCmd() *cobra.Command

NewReportCmd creates a new report command

func NewRunCmd

func NewRunCmd() *cobra.Command

NewRunCmd creates a new run command

func ParseValues

func ParseValues(values []string, v chartutil.Values) error

func RegisterHTMLTemplate

func RegisterHTMLTemplate(name string, tpl *ht.Template)

RegisterHTMLTemplate registers an HTML template

func RegisterTextTemplate

func RegisterTextTemplate(name string, tpl *template.Template)

RegisterTextTemplate registers a text template

func RenderGoTpl

func RenderGoTpl(v chartutil.Values, filePath string) (*bytes.Buffer, error)

RenderGoTpl creates output from go.tpl

func RenderTpl

func RenderTpl(k8sExp k8sExperiment, filePath string) (*bytes.Buffer, error)

RenderTpl creates output from go.tpl

func ResultFromBytes

func ResultFromBytes(b []byte) (*base.ExperimentResult, error)

ResultFromBytes reads experiment result from bytes

func SpecFromBytes

func SpecFromBytes(b []byte) ([]base.TaskSpec, error)

SpecFromBytes reads experiment spec from bytes

Types

type AssertOptionsType

type AssertOptionsType struct {
	// assert conditions
	Conds []string
	// timeout for assert conditions to be satisfied
	Timeout time.Duration
}

type ExpIO

type ExpIO interface {
	ReadSpec() ([]base.TaskSpec, error)
	ReadResult() (*base.ExperimentResult, error)
	WriteResult(r *Experiment) error
}

type Experiment

type Experiment struct {
	*base.Experiment
	// contains filtered or unexported fields
}

func Build

func Build(withResult bool, expio ExpIO) (*Experiment, error)

Build an experiment

func (*Experiment) Assert

func (exp *Experiment) Assert(conditions []string, to time.Duration) (bool, error)

Assert if experiment satisfies conditions

func (*Experiment) Completed

func (exp *Experiment) Completed() bool

Completed returns true if the experiment is complete if the result stanza is missing, this function returns false

func (*Experiment) ContainsInsight

func (e *Experiment) ContainsInsight(in base.InsightType) bool

ContainsInsight checks if the experiment contains insight

func (*Experiment) HTMLHistCharts

func (e *Experiment) HTMLHistCharts() string

HTMLHistCharts returns histogram charts section in HTML report

func (*Experiment) HTMLHistData

func (e *Experiment) HTMLHistData() string

HTMLHistData returns histogram data section in HTML report

func (*Experiment) HTMLHistMetricsSection

func (e *Experiment) HTMLHistMetricsSection() string

HTMLHistMetricsSection prints histogram metrics in the HTML report

func (*Experiment) HTMLMetricsSection

func (e *Experiment) HTMLMetricsSection() string

HTMLMetricsSection prints metrics in the HTML report

func (*Experiment) HTMLSLOSection

func (e *Experiment) HTMLSLOSection() string

HTMLSLOSection prints the SLO section in HTML report

func (*Experiment) HTMLStatus

func (e *Experiment) HTMLStatus() string

HTMLStatus prints the current state of the experiment

func (*Experiment) HistData

func (e *Experiment) HistData() []histograms

HistData provides histogram data for all histogram metrics

func (*Experiment) NoFailure

func (exp *Experiment) NoFailure() bool

NoFailure returns true if no task int he experiment has failed if the result stanza is missing, this function returns false

func (*Experiment) Report

func (exp *Experiment) Report(outputFormat string) error

Report creates a report from experiment as per outputFormat

func (*Experiment) Run

func (e *Experiment) Run(expio ExpIO) error

Run an experiment

type FileExpIO

type FileExpIO struct{}

FileExpIO enables reading and writing through files

func (*FileExpIO) ReadResult

func (f *FileExpIO) ReadResult() (*base.ExperimentResult, error)

read experiment result from file

func (*FileExpIO) ReadSpec

func (f *FileExpIO) ReadSpec() ([]base.TaskSpec, error)

read experiment spec from file

func (*FileExpIO) WriteResult

func (f *FileExpIO) WriteResult(r *Experiment) error

write experiment result to file

type GenOptionsType

type GenOptionsType struct {
	// Values are user specified values used during gen
	Values []string
}

type ReportOptionsType

type ReportOptionsType struct {
	// Output format variable holds the output format to be used by gen
	OutputFormat string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳