Documentation

Index

Constants

View Source
const ENDPOINT = "/v1/apps/:environment/:org/:space/:appName"

    ENDPOINT is used by the handler to define the deployment endpoint.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type BlueGreener

    type BlueGreener struct {
    	PushCall struct {
    		Received struct {
    			Environment    config.Environment
    			AppPath        string
    			DeploymentInfo S.DeploymentInfo
    			Out            io.Writer
    		}
    		Returns struct {
    			Error error
    		}
    	}
    }

      BlueGreener handmade mock for tests.

      func (*BlueGreener) Push

      func (b *BlueGreener) Push(environment config.Environment, appPath string, deploymentInfo S.DeploymentInfo, out io.ReadWriter) error

        Push mock method.

        type Client

        type Client struct {
        	GetCall struct {
        		Received struct {
        			URL string
        		}
        		Returns struct {
        			Response http.Response
        			Error    error
        		}
        	}
        }

          Client handmade mock for tests.

          func (*Client) Get

          func (c *Client) Get(url string) (*http.Response, error)

            Get mock method.

            type Courier

            type Courier struct {
            	LoginCall struct {
            		Received struct {
            			FoundationURL string
            			Username      string
            			Password      string
            			Org           string
            			Space         string
            			SkipSSL       bool
            		}
            		Returns struct {
            			Output []byte
            			Error  error
            		}
            	}
            
            	DeleteCall struct {
            		Received struct {
            			AppName string
            		}
            		Returns struct {
            			Output []byte
            			Error  error
            		}
            	}
            
            	PushCall struct {
            		Received struct {
            			AppName   string
            			AppPath   string
            			Hostname  string
            			Instances uint16
            		}
            		Returns struct {
            			Output []byte
            			Error  error
            		}
            	}
            
            	RenameCall struct {
            		Received struct {
            			AppName          string
            			AppNameVenerable string
            		}
            		Returns struct {
            			Output []byte
            			Error  error
            		}
            	}
            
            	LogsCall struct {
            		Received struct {
            			AppName string
            		}
            		Returns struct {
            			Output []byte
            			Error  error
            		}
            	}
            
            	MapRouteCall struct {
            		TimesCalled int
            		Received    struct {
            			AppName  []string
            			Domain   []string
            			Hostname []string
            		}
            		Returns struct {
            			Output [][]byte
            			Error  []error
            		}
            	}
            
            	UnmapRouteCall struct {
            		Received struct {
            			AppName  string
            			Domain   string
            			Hostname string
            		}
            		Returns struct {
            			Output []byte
            			Error  error
            		}
            	}
            
            	ExistsCall struct {
            		Received struct {
            			AppName string
            		}
            		Returns struct {
            			Bool bool
            		}
            	}
            
            	CupsCall struct {
            		Received struct {
            			AppName string
            			Body    string
            		}
            		Returns struct {
            			Output []byte
            			Error  error
            		}
            	}
            
            	UupsCall struct {
            		Received struct {
            			AppName string
            			Body    string
            		}
            		Returns struct {
            			Output []byte
            			Error  error
            		}
            	}
            
            	DomainsCall struct {
            		TimesCalled int
            		Returns     struct {
            			Domains []string
            			Error   error
            		}
            	}
            
            	CleanUpCall struct {
            		Returns struct {
            			Error error
            		}
            	}
            }

              Courier handmade mock for tests.

              func (*Courier) CleanUp

              func (c *Courier) CleanUp() error

                CleanUp mock method.

                func (*Courier) Cups

                func (c *Courier) Cups(appName string, body string) ([]byte, error)

                  Cups mock method

                  func (*Courier) Delete

                  func (c *Courier) Delete(appName string) ([]byte, error)

                    Delete mock method.

                    func (*Courier) Domains

                    func (c *Courier) Domains() ([]string, error)

                      Domains mock method.

                      func (*Courier) Exists

                      func (c *Courier) Exists(appName string) bool

                        Exists mock method.

                        func (*Courier) Login

                        func (c *Courier) Login(foundationURL, username, password, org, space string, skipSSL bool) ([]byte, error)

                          Login mock method.

                          func (*Courier) Logs

                          func (c *Courier) Logs(appName string) ([]byte, error)

                            Logs mock method.

                            func (*Courier) MapRoute

                            func (c *Courier) MapRoute(appName, domain, hostname string) ([]byte, error)

                              MapRoute mock method.

                              func (*Courier) Push

                              func (c *Courier) Push(appName, appLocation, hostname string, instances uint16) ([]byte, error)

                                Push mock method.

                                func (*Courier) Rename

                                func (c *Courier) Rename(appName, newAppName string) ([]byte, error)

                                  Rename mock method.

                                  func (*Courier) UnmapRoute

                                  func (c *Courier) UnmapRoute(appName, domain, hostname string) ([]byte, error)

                                    UnmapRoute mock method.

                                    func (*Courier) Uups

                                    func (c *Courier) Uups(appName string, body string) ([]byte, error)

                                      Uups mock method

                                      type Creator

                                      type Creator struct {
                                      	// contains filtered or unexported fields
                                      }

                                        Handmade Creator mock. Uses a mock prechecker to skip verifying the foundations are up and running. Uses a mock Courier and Executor to mock pushing an application. Uses a mock FileSystem to mock writing to the operating system.

                                        func NewCreator

                                        func NewCreator(level string, configFilename string) (Creator, error)

                                        func (Creator) CreateBlueGreener

                                        func (c Creator) CreateBlueGreener() I.BlueGreener

                                        func (Creator) CreateConfig

                                        func (c Creator) CreateConfig() config.Config

                                        func (Creator) CreateController

                                        func (c Creator) CreateController() controller.Controller

                                        func (Creator) CreateControllerHandler

                                        func (c Creator) CreateControllerHandler() *gin.Engine

                                        func (Creator) CreateDeployer

                                        func (c Creator) CreateDeployer() I.Deployer

                                        func (Creator) CreateEventManager

                                        func (c Creator) CreateEventManager() I.EventManager

                                        func (Creator) CreateFileSystem

                                        func (c Creator) CreateFileSystem() *afero.Afero

                                        func (Creator) CreateLogger

                                        func (c Creator) CreateLogger() I.Logger

                                        func (Creator) CreatePrechecker

                                        func (c Creator) CreatePrechecker() I.Prechecker

                                        func (Creator) CreatePusher

                                        func (c Creator) CreatePusher(deploymentInfo S.DeploymentInfo, response io.ReadWriter) (I.Pusher, error)

                                        func (Creator) CreateRandomizer

                                        func (c Creator) CreateRandomizer() I.Randomizer

                                        func (Creator) CreateWriter

                                        func (c Creator) CreateWriter() io.Writer

                                        type Deployer

                                        type Deployer struct {
                                        	DeployCall struct {
                                        		Received struct {
                                        			Request     *http.Request
                                        			Environment string
                                        			Org         string
                                        			Space       string
                                        			AppName     string
                                        			ContentType string
                                        			Response    io.ReadWriter
                                        		}
                                        		Write struct {
                                        			Output string
                                        		}
                                        		Returns struct {
                                        			Error      error
                                        			StatusCode int
                                        		}
                                        	}
                                        }

                                          Deployer handmade mock for tests.

                                          func (*Deployer) Deploy

                                          func (d *Deployer) Deploy(req *http.Request, environment, org, space, appName, contentType string, out io.ReadWriter) (int, error)

                                            Deploy mock method.

                                            type Env

                                            type Env struct {
                                            	GetCall struct {
                                            		Received struct {
                                            			Keys []string
                                            		}
                                            		Returns struct {
                                            			Values map[string]string
                                            		}
                                            	}
                                            }

                                              Env handmade mock for tests.

                                              func (*Env) Get

                                              func (e *Env) Get(key string) string

                                                Get mock method.

                                                type EventManager

                                                type EventManager struct {
                                                	AddHandlerCall struct {
                                                		Received struct {
                                                			Handler   I.Handler
                                                			EventType string
                                                		}
                                                		Returns struct {
                                                			Error error
                                                		}
                                                	}
                                                	EmitCall struct {
                                                		TimesCalled int
                                                		Received    struct {
                                                			Events []S.Event
                                                		}
                                                		Returns struct {
                                                			Error []error
                                                		}
                                                	}
                                                }

                                                  EventManager handmade mock for tests.

                                                  func (*EventManager) AddHandler

                                                  func (e *EventManager) AddHandler(handler I.Handler, eventType string) error

                                                    AddHandler mock method.

                                                    func (*EventManager) Emit

                                                    func (e *EventManager) Emit(event S.Event) error

                                                      Emit mock method.

                                                      type Executor

                                                      type Executor struct {
                                                      	ExecuteCall struct {
                                                      		Received struct {
                                                      			Args []string
                                                      		}
                                                      		Returns struct {
                                                      			Output []byte
                                                      			Error  error
                                                      		}
                                                      	}
                                                      
                                                      	ExecuteInDirectoryCall struct {
                                                      		Received struct {
                                                      			AppLocation string
                                                      			Args        []string
                                                      		}
                                                      		Returns struct {
                                                      			Output []byte
                                                      			Error  error
                                                      		}
                                                      	}
                                                      
                                                      	CleanUpCall struct {
                                                      		Returns struct {
                                                      			Error error
                                                      		}
                                                      	}
                                                      }

                                                        Executor handmade mock for tests.

                                                        func (*Executor) CleanUp

                                                        func (e *Executor) CleanUp() error

                                                          CleanUp mock method.

                                                          func (*Executor) Execute

                                                          func (e *Executor) Execute(args ...string) ([]byte, error)

                                                            Execute mock method.

                                                            func (*Executor) ExecuteInDirectory

                                                            func (e *Executor) ExecuteInDirectory(appLocation string, args ...string) ([]byte, error)

                                                              ExecuteInDirectory mock method.

                                                              type Extractor

                                                              type Extractor struct {
                                                              	UnzipCall struct {
                                                              		Received struct {
                                                              			Source      string
                                                              			Destination string
                                                              			Manifest    string
                                                              		}
                                                              		Returns struct {
                                                              			Error error
                                                              		}
                                                              	}
                                                              }

                                                                Extractor handmade mock for tests.

                                                                func (*Extractor) Unzip

                                                                func (e *Extractor) Unzip(source, destination, manifest string) error

                                                                  Unzip mock method.

                                                                  type Fetcher

                                                                  type Fetcher struct {
                                                                  	FetchCall struct {
                                                                  		Received struct {
                                                                  			ArtifactURL string
                                                                  			Manifest    string
                                                                  		}
                                                                  		Returns struct {
                                                                  			AppPath string
                                                                  			Error   error
                                                                  		}
                                                                  	}
                                                                  
                                                                  	FetchFromZipCall struct {
                                                                  		Received struct {
                                                                  			Request *http.Request
                                                                  		}
                                                                  		Returns struct {
                                                                  			AppPath string
                                                                  			Error   error
                                                                  		}
                                                                  	}
                                                                  }

                                                                    Fetcher handmade mock for tests.

                                                                    func (*Fetcher) Fetch

                                                                    func (f *Fetcher) Fetch(url, manifest string) (string, error)

                                                                      Fetch mock method.

                                                                      func (*Fetcher) FetchZipFromRequest

                                                                      func (f *Fetcher) FetchZipFromRequest(req *http.Request) (string, error)

                                                                        FetchZipFromRequest mock method.

                                                                        type Handler

                                                                        type Handler struct {
                                                                        	OnEventCall struct {
                                                                        		Received struct {
                                                                        			Event S.Event
                                                                        		}
                                                                        		Returns struct {
                                                                        			Error error
                                                                        		}
                                                                        	}
                                                                        }

                                                                          Handler handmade mock for tests.

                                                                          func (*Handler) OnEvent

                                                                          func (h *Handler) OnEvent(event S.Event) error

                                                                            OnEvent mock method.

                                                                            type HealthChecker

                                                                            type HealthChecker struct {
                                                                            	CheckCall struct {
                                                                            		Received struct {
                                                                            			Endpoint string
                                                                            			URL      string
                                                                            		}
                                                                            		Returns struct {
                                                                            			Error error
                                                                            		}
                                                                            	}
                                                                            }

                                                                              HealthChecker handmade mock for tests.

                                                                              func (*HealthChecker) Check

                                                                              func (h *HealthChecker) Check(endpoint, serverURL string) error

                                                                              type Prechecker

                                                                              type Prechecker struct {
                                                                              	AssertAllFoundationsUpCall struct {
                                                                              		Received struct {
                                                                              			Environment config.Environment
                                                                              		}
                                                                              		Returns struct {
                                                                              			Error error
                                                                              		}
                                                                              	}
                                                                              }

                                                                                Prechecker handmade mock for tests.

                                                                                func (*Prechecker) AssertAllFoundationsUp

                                                                                func (p *Prechecker) AssertAllFoundationsUp(environment config.Environment) error

                                                                                  AssertAllFoundationsUp mock method.

                                                                                  type Pusher

                                                                                  type Pusher struct {
                                                                                  	Response io.ReadWriter
                                                                                  
                                                                                  	LoginCall struct {
                                                                                  		Received struct {
                                                                                  			FoundationURL string
                                                                                  		}
                                                                                  		Write struct {
                                                                                  			Output string
                                                                                  		}
                                                                                  		Returns struct {
                                                                                  			Error error
                                                                                  		}
                                                                                  	}
                                                                                  
                                                                                  	PushCall struct {
                                                                                  		Received struct {
                                                                                  			AppPath       string
                                                                                  			FoundationURL string
                                                                                  			AppExists     bool
                                                                                  			Out           io.ReadWriter
                                                                                  		}
                                                                                  		Write struct {
                                                                                  			Output string
                                                                                  		}
                                                                                  		Returns struct {
                                                                                  			Error error
                                                                                  		}
                                                                                  	}
                                                                                  
                                                                                  	UndoPushCall struct {
                                                                                  		Received struct {
                                                                                  			AppExists bool
                                                                                  		}
                                                                                  		Returns struct {
                                                                                  			Error error
                                                                                  		}
                                                                                  	}
                                                                                  
                                                                                  	FinishPushCall struct {
                                                                                  		Returns struct {
                                                                                  			Error error
                                                                                  		}
                                                                                  	}
                                                                                  
                                                                                  	CleanUpCall struct {
                                                                                  		Returns struct {
                                                                                  			Error error
                                                                                  		}
                                                                                  	}
                                                                                  
                                                                                  	ExistsCall struct {
                                                                                  		Received struct {
                                                                                  			AppName string
                                                                                  		}
                                                                                  	}
                                                                                  }

                                                                                    Pusher handmade mock for tests.

                                                                                    func (*Pusher) CleanUp

                                                                                    func (p *Pusher) CleanUp() error

                                                                                      CleanUp mock method.

                                                                                      func (*Pusher) Exists

                                                                                      func (p *Pusher) Exists(appName string)

                                                                                        Exists mock method.

                                                                                        func (*Pusher) FinishPush

                                                                                        func (p *Pusher) FinishPush() error

                                                                                          FinishPush mock method.

                                                                                          func (*Pusher) Login

                                                                                          func (p *Pusher) Login(foundationURL string) error

                                                                                            Login mock method.

                                                                                            func (*Pusher) Push

                                                                                            func (p *Pusher) Push(appPath, foundationURL string) error

                                                                                              Push mock method.

                                                                                              func (*Pusher) UndoPush

                                                                                              func (p *Pusher) UndoPush() error

                                                                                                UndoPush mock method.

                                                                                                type PusherCreator

                                                                                                type PusherCreator struct {
                                                                                                	CreatePusherCall struct {
                                                                                                		TimesCalled int
                                                                                                		Returns     struct {
                                                                                                			Pushers []interfaces.Pusher
                                                                                                			Error   []error
                                                                                                		}
                                                                                                	}
                                                                                                }

                                                                                                  PusherCreator handmade mock for tests.

                                                                                                  func (*PusherCreator) CreatePusher

                                                                                                  func (p *PusherCreator) CreatePusher(deploymentInfo S.DeploymentInfo, response io.ReadWriter) (interfaces.Pusher, error)

                                                                                                    CreatePusher mock method.

                                                                                                    type Randomizer

                                                                                                    type Randomizer struct {
                                                                                                    	RandomizeCall struct {
                                                                                                    		Received struct {
                                                                                                    			Length int
                                                                                                    		}
                                                                                                    		Returns struct {
                                                                                                    			Runes string
                                                                                                    		}
                                                                                                    	}
                                                                                                    }

                                                                                                      Randomizer handmade mock for tests.

                                                                                                      func (*Randomizer) StringRunes

                                                                                                      func (r *Randomizer) StringRunes(length int) string

                                                                                                        StringRunes mock method.