Documentation
¶
Index ¶
- type GitServer
- func (s *GitServer) Auth(username, password string) *GitServer
- func (s *GitServer) AutoCreate() *GitServer
- func (s *GitServer) HTTPAddress() string
- func (s *GitServer) HTTPAddressWithCredentials() string
- func (s *GitServer) KeyDir(dir string) *GitServer
- func (s *GitServer) ListenSSH() error
- func (s *GitServer) Root() string
- func (s *GitServer) SSHAddress() string
- func (s *GitServer) StartHTTP() error
- func (s *GitServer) StartHTTPS(cert, key, ca []byte, serverName string) error
- func (s *GitServer) StartSSH() error
- func (s *GitServer) StopHTTP()
- func (s *GitServer) StopSSH() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitServer ¶
type GitServer struct {
// contains filtered or unexported fields
}
GitServer is a git server for testing purposes. It can serve git repositories over HTTP and SSH.
func NewGitServer ¶
NewGitServer returns a GitServer with the given repository docroot set.
func NewTempGitServer ¶
NewTempGitServer returns a GitServer with a newly created temp dir as repository docroot.
func (*GitServer) Auth ¶ added in v0.2.1
Auth switches authentication on for both HTTP and SSH servers. It's not possible to switch authentication on for just one of them. The username and password provided are _only_ used for HTTP. SSH relies on key authentication, but won't work with libgit2 unless auth is enabled.
func (*GitServer) AutoCreate ¶
AutoCreate enables the automatic creation of a non-existing Git repository on push.
func (*GitServer) HTTPAddress ¶
HTTPAddress returns the address of the HTTP git server. This will not include credentials. Use if you have not enable authentication, or if you are specifically testing the use of credentials.
func (*GitServer) HTTPAddressWithCredentials ¶ added in v0.2.1
HTTPAddressWithCredentials returns the address of the HTTP git server, including credentials if authentication has been enabled. Use this if you need to be able to access the git server to set up fixtures etc..
func (*GitServer) KeyDir ¶ added in v0.2.0
KeyDir sets the SSH key directory in the config. Use before calling StartSSH.
func (*GitServer) ListenSSH ¶ added in v0.2.0
ListenSSH creates an SSH server and a listener if not already created, but does not handle connections. This returns immediately, unlike StartSSH(), and the server URL is available with SSHAddress() after calling this.
func (*GitServer) SSHAddress ¶
SSHAddress returns the address of the SSH git server as a URL.
func (*GitServer) StartHTTP ¶
StartHTTP starts a new HTTP git server with the current configuration.
func (*GitServer) StartHTTPS ¶ added in v0.1.0
StartHTTPS starts the TLS HTTPServer with the given TLS configuration.
func (*GitServer) StartSSH ¶
StartSSH creates a SSH git server and listener with the current configuration if necessary, and handles connections. Unless it returns an error immediately, this will block until the listener is stopped with `s.StopSSH()`. Usually you will want to use ListenSSH() first, so you can get the URL of the SSH git server before starting it.