github.com/billybanfield/evergreen@v0.0.0-20170525200750-eeee692790f7/plugin/builtin/gotest/gotest_plugin.go (about)

     1  package gotest
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/evergreen-ci/evergreen/plugin"
     7  	"github.com/pkg/errors"
     8  )
     9  
    10  func init() {
    11  	plugin.Publish(&GotestPlugin{})
    12  }
    13  
    14  const (
    15  	GotestPluginName      = "gotest"
    16  	ParseFilesCommandName = "parse_files"
    17  	ResultsAPIEndpoint    = "gotest_results"
    18  	TestLogsAPIEndpoint   = "gotest_logs"
    19  	ResultsPostRetries    = 5
    20  	ResultsRetrySleepSec  = 10 * time.Second
    21  )
    22  
    23  type GotestPlugin struct{}
    24  
    25  func (self *GotestPlugin) Name() string {
    26  	return GotestPluginName
    27  }
    28  
    29  func (self *GotestPlugin) NewCommand(cmdName string) (plugin.Command, error) {
    30  	switch cmdName {
    31  	case ParseFilesCommandName:
    32  		return &ParseFilesCommand{}, nil
    33  	default:
    34  		return nil, errors.Errorf("No such %v command: %v", GotestPluginName, cmdName)
    35  	}
    36  }