Documentation ¶
Index ¶
- Constants
- func FindBaseProfileFromQiniu(qc Client, prowJobName, covProfileName string) ([]byte, error)
- func MockPrivateDomainUrl(router *httprouter.Router, count int)
- func MockRouterAPI(router *httprouter.Router, profile string, count int)
- func MockRouterListAllAPI(router *httprouter.Router, count int)
- type Artifacts
- type Client
- type Config
- type LogHistoryTemplate
- type ObjectHandle
- type ProfileArtifacts
- type QnClient
- func (q *QnClient) GetAccessURL(key string, timeout time.Duration) string
- func (q *QnClient) GetArtifactDetails(key string) (*LogHistoryTemplate, error)
- func (q *QnClient) ListAll(ctx context.Context, prefix string, delimiter string) ([]string, error)
- func (q *QnClient) ListSubDirs(prefix string) ([]string, error)
- func (q *QnClient) QiniuObjectHandle(key string) ObjectHandle
- func (q *QnClient) ReadObject(key string) ([]byte, error)
- type QnObjectHandle
Constants ¶
const ( // ArtifactsDirName is the name of directory defined in prow to store test artifacts ArtifactsDirName = "artifacts" //PostSubmitCoverProfile represents the default output coverage file generated in prow environment PostSubmitCoverProfile = "filtered.cov" //ChangedProfileName represents the default changed coverage profile based on files changed in Pull Request ChangedProfileName = "changed-file-profile.cov" )
Variables ¶
This section is empty.
Functions ¶
func FindBaseProfileFromQiniu ¶
FindBaseProfileFromQiniu finds the coverage profile file from the latest healthy build stored in given gcs directory
func MockPrivateDomainUrl ¶
func MockPrivateDomainUrl(router *httprouter.Router, count int)
MockPrivateDomainUrl mocks bucket domain /key, /timeout, /retry API. count controls the mocks qiniu server to error before 'count' times request.
func MockRouterAPI ¶
func MockRouterAPI(router *httprouter.Router, profile string, count int)
MockRouterAPI mocks qiniu /v2/list API. You need to provide a expected profile content. count controls the mocks qiniu server to error before 'count' times request.
func MockRouterListAllAPI ¶
func MockRouterListAllAPI(router *httprouter.Router, count int)
MockRouterListAllAPI mocks qiniu /list API. count controls the mocks qiniu server to error before 'count' times request.
Types ¶
type Artifacts ¶
type Artifacts interface { ProfilePath() string CreateChangedProfile() *os.File GetChangedProfileName() string }
Artifacts is the interface of the rule to store test artifacts in prow
type Client ¶
type Client interface { QiniuObjectHandle(key string) ObjectHandle ReadObject(key string) ([]byte, error) ListAll(ctx context.Context, prefix string, delimiter string) ([]string, error) GetAccessURL(key string, timeout time.Duration) string GetArtifactDetails(key string) (*LogHistoryTemplate, error) ListSubDirs(prefix string) ([]string, error) }
Client is the interface contains the operation with qiniu cloud
type Config ¶
type Config struct { Bucket string `json:"bucket"` AccessKey string `json:"accessKey"` SecretKey string `json:"secretKey"` // domain used to download files from qiniu cloud Domain string `json:"domain"` }
Config store the credentials to connect with qiniu cloud
type LogHistoryTemplate ¶
LogHistoryTemplate is the template of the log history
type ObjectHandle ¶
type ObjectHandle interface { NewReader(ctx context.Context) (io.ReadCloser, error) NewRangeReader(ctx context.Context, offset, length int64) (io.ReadCloser, error) }
ObjectHandle is the interface contains the operations on an object in a qiniu cloud bucket
type ProfileArtifacts ¶
type ProfileArtifacts struct { Directory string ProfileName string ChangedProfileName string // create temporary to save changed file related coverage profile }
ProfileArtifacts presents the rule to store test artifacts in prow
func (*ProfileArtifacts) CreateChangedProfile ¶
func (a *ProfileArtifacts) CreateChangedProfile() *os.File
CreateChangedProfile creates a profile in order to store the most related files based on Github Pull Request
func (*ProfileArtifacts) GetChangedProfileName ¶
func (a *ProfileArtifacts) GetChangedProfileName() string
GetChangedProfileName get ChangedProfileName of the ProfileArtifacts
func (*ProfileArtifacts) ProfilePath ¶
func (a *ProfileArtifacts) ProfilePath() string
ProfilePath returns a full path for profile
type QnClient ¶
type QnClient struct { BucketManager *storage.BucketManager // contains filtered or unexported fields }
QnClient for the operation with qiniu cloud
func MockQiniuServer ¶
func MockQiniuServer(config *Config) (client *QnClient, router *httprouter.Router, serverURL string, teardown func())
MockQiniuServer simulate qiniu cloud for testing
func (*QnClient) GetAccessURL ¶
GetAccessURL return a url which can access artifact directly in qiniu
func (*QnClient) GetArtifactDetails ¶
func (q *QnClient) GetArtifactDetails(key string) (*LogHistoryTemplate, error)
GetArtifactDetails lists all artifacts available for the given job source
func (*QnClient) ListSubDirs ¶
ListSubDirs list all the sub directions of the prefix string in qiniu client
func (*QnClient) QiniuObjectHandle ¶
func (q *QnClient) QiniuObjectHandle(key string) ObjectHandle
QiniuObjectHandle construct a object hanle to access file in qiniu
type QnObjectHandle ¶
type QnObjectHandle struct {
// contains filtered or unexported fields
}
QnObjectHandle provides operations on an object in a qiniu cloud bucket
func (*QnObjectHandle) NewRangeReader ¶
func (o *QnObjectHandle) NewRangeReader(ctx context.Context, offset, length int64) (io.ReadCloser, error)
NewRangeReader reads parts of an object, reading at most length bytes starting from the given offset. If length is negative, the object is read until the end.
func (*QnObjectHandle) NewReader ¶
func (o *QnObjectHandle) NewReader(ctx context.Context) (io.ReadCloser, error)
NewReader creates a reader to read the contents of the object. ErrObjectNotExist will be returned if the object is not found. The caller must call Close on the returned Reader when done reading.