Documentation
¶
Index ¶
- Constants
- Variables
- func Cleanup() error
- func CreateProject(project *api.Project, response *api.Project, errResp *api.ErrorResponse) (int, error)
- func DeleteProject(name string, response *api.Project, errResp *api.ErrorResponse) (int, error)
- func DialLogServer() (ws *gwebsocket.Conn, err error)
- func GetProject(name string, response *api.Project, errResp *api.ErrorResponse) (int, error)
- func GetToken(username string, request TokenRequest, response *TokenResponse) error
- func IsRunning() bool
- func ListProjects(response *ListResponse, errResp *api.ErrorResponse) (int, error)
- func ReadMsgFromLogServer(ws *gwebsocket.Conn, timeout int) ([]byte, error)
- func SendMsgToLogServer(ws *gwebsocket.Conn, msg []byte) error
- func SetProject(project *api.Project, response *api.Project, errResp *api.ErrorResponse) (int, error)
- func SetupTokenUID(username, password string) (string, string)
- func WaitComponents()
- type ListResponse
- type Metadata
- type Profile
- type TokenRequest
- type TokenResponse
Constants ¶
const ( // APICreateVersion is the API for version creation. APICreateVersion = "create-version" // LogServerOrigin is the host of log server. LogServerOrigin = "http://localhost/" // LogServerURL is the URL of log server. LogServerURL = "ws://localhost:8000/ws" // StartOperation is the operation name for starting. StartOperation = "start" // StopOperation is the operation name for stoping. StopOperation = "stop" // TimeOutPushLog is the timeout for log pusing. TimeOutPushLog = 5 // TimeOutResponse is the timeout for response. TimeOutResponse = 10 // ReadMsgBufferSize is the default size of buffer for reading messages. ReadMsgBufferSize = 32768 )
const ( // AdminUser is used to run normal test cases, it has all access rights // to docker repositories. AdminUser = "admin" // AdminUID is the UID of AdminUser. AdminUID = "adminUID" // AdminPassword is the password of AdminUser. AdminPassword = "admin_password" // ListUser is used solely for listing services. ListUser = "list" // ListUID is the UID of ListUser. ListUID = "listUID" // ListPassword is the password of ListUser. ListPassword = "list_password" // AliceUser is a normal user, we use it to test different cases, e.g. build // from user1 should fail to push to user2. AliceUser = "alice" // AliceUID is the UID of AliceUser. AliceUID = "aliceUID" // AlicePassword is the password of AliceUser. AlicePassword = "alice_password" // BobUser is a normal user, we use it to test different cases, e.g. build // from user1 should fail to push to user2. BobUser = "bobo" // BobUID is the UID of BobUser. BobUID = "boboUID" // BobPassword is the password of BobUser. BobPassword = "bobo_password" // DefaultRegistryAddress is the default docker registry, it would start a local registry. DefaultRegistryAddress = "cargo.caicloud.io" // DefaultDockerHost is the default docker host used in e2e test. DefaultDockerHost = "unix:///var/run/docker.sock" // DefaultAuthAddress is the default address to access caicloud auth. Right now, we've disabled // caicloud auth in e2e test. DefaultAuthAddress = "https://auth-canary.caicloud.io" )
Variables ¶
var ( // BaseURL defines the url to cyclone. BaseURL = fmt.Sprintf("http://localhost:%s/api/%s", cyclonePort, apiVersion) )
var ( // ErrUnfoundLog is the error type for "log not found." ErrUnfoundLog = fmt.Errorf("log not found") )
Functions ¶
func CreateProject ¶
func CreateProject(project *api.Project, response *api.Project, errResp *api.ErrorResponse) (int, error)
CreateProject creates a project with given configurations.
func DeleteProject ¶
DeleteProject delete a project from user ID and project ID.
func DialLogServer ¶
func DialLogServer() (ws *gwebsocket.Conn, err error)
DialLogServer dials LogServerURL for connection.
func GetProject ¶
GetProject retrieves a project from user ID and project ID.
func GetToken ¶
func GetToken(username string, request TokenRequest, response *TokenResponse) error
GetToken returns the token from ${DefaultAuthAddress}/api/v0.1/users/{username}/authenticate
func ListProjects ¶
func ListProjects(response *ListResponse, errResp *api.ErrorResponse) (int, error)
// ListProjects list projects by user ID.
func ReadMsgFromLogServer ¶
func ReadMsgFromLogServer(ws *gwebsocket.Conn, timeout int) ([]byte, error)
ReadMsgFromLogServer reads messages from log server.
func SendMsgToLogServer ¶
func SendMsgToLogServer(ws *gwebsocket.Conn, msg []byte) error
SendMsgToLogServer sends messages to log server directly.
func SetProject ¶
func SetProject(project *api.Project, response *api.Project, errResp *api.ErrorResponse) (int, error)
SetProject set a project with given configurations.
func SetupTokenUID ¶
SetupTokenUID will get the token and uid from auth server. This won't be called if authserver is disabled.
Types ¶
type ListResponse ¶ added in v0.7.1
type Metadata ¶ added in v0.7.1
type Metadata struct {
Total int `bson:"total,omitempty" json:"total,omitempty"`
}
type Profile ¶
type Profile struct {
Email string `json:"email,omitempty"`
Cellphone int `json:"cellphone,omitempty"`
}
Profile is the profile object of a user.
type TokenRequest ¶
type TokenRequest struct {
Password string `json:"password,omitempty"`
}
TokenRequest is the request to get the token.
type TokenResponse ¶
type TokenResponse struct {
StatusMessage string `json:"statusMessage,omitempty"`
Token string `json:"token,omitempty"`
UID string `json:"uid,omitempty"`
Error string `json:"error,omitempty"`
Profile Profile `json:"profile,omitempty"`
}
TokenResponse is the response to get the token.