github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/framework/provisioning/targets.go (about)

     1  package provisioning
     2  
     3  import "testing"
     4  
     5  // ProvisioningTargets is a set of hosts that will get a Nomad and/or Consul
     6  // deployment.
     7  type ProvisioningTargets struct {
     8  	Servers []*ProvisioningTarget `json:"servers"`
     9  	Clients []*ProvisioningTarget `json:"clients"`
    10  }
    11  
    12  // ProvisioningTarget is a specific host that will get a Nomad and/or Consul
    13  // deployment.
    14  type ProvisioningTarget struct {
    15  	Deployment Deployment             `json:"deployment"`
    16  	Runner     map[string]interface{} `json:"runner"`
    17  	runner     ProvisioningRunner
    18  }
    19  
    20  type Deployment struct {
    21  	// Note: these override each other. NomadLocalBinary > NomadSha > NomadVersion
    22  	NomadLocalBinary string `json:"nomad_local_binary"`
    23  	NomadSha         string `json:"nomad_sha"`
    24  	NomadVersion     string `json:"nomad_version"`
    25  
    26  	RemoteBinaryPath string   `json:"remote_binary_path"`
    27  	Platform         string   `json:"platform"`
    28  	Bundles          []Bundle `json:"bundles"`
    29  	Steps            []string `json:"steps"`
    30  }
    31  
    32  // Bundle is an arbitrary collection of files to support Nomad, Consul,
    33  // etc. that will be placed as part of provisioning.
    34  type Bundle struct {
    35  	Source      string `json:"source"`
    36  	Destination string `json:"destination"`
    37  }
    38  
    39  // ProvisioningRunner is the interface for how a Provisioner will connect
    40  // with a target and execute steps. Each target has its own runner.
    41  type ProvisioningRunner interface {
    42  	Open(t *testing.T) error   // start the runner, caching connection info
    43  	Run(string) error          // run one step
    44  	Copy(string, string) error // copy a file
    45  	Close()                    // clean up the runner, call in a defer
    46  }