github.com/iter8-tools/iter8@v1.1.2/driver/common.go (about)

     1  package driver
     2  
     3  import (
     4  	"github.com/iter8-tools/iter8/base"
     5  	"github.com/iter8-tools/iter8/base/log"
     6  	"sigs.k8s.io/yaml"
     7  )
     8  
     9  const (
    10  	// DefaultTestName is the default name of the performance test
    11  	DefaultTestName = "default"
    12  )
    13  
    14  // ExperimentFromBytes reads experiment from bytes
    15  func ExperimentFromBytes(b []byte) (*base.Experiment, error) {
    16  	e := base.Experiment{}
    17  	err := yaml.Unmarshal(b, &e)
    18  	if err != nil {
    19  		log.Logger.WithStackTrace(err.Error()).Error("unable to unmarshal experiment: ", string(b))
    20  		return nil, err
    21  	}
    22  	return &e, err
    23  }