Documentation
¶
Overview ¶
Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- Variables
- type BucketConnector
- func (b *BucketConnector) GetBuilds(ctx context.Context, board string, milestone int32) ([]string, error)
- func (b *BucketConnector) GetMilestones(ctx context.Context, board string) ([]string, error)
- func (b *BucketConnector) GetTestPlan(ctx context.Context, name string) (*test_platform.Request_TestPlan, error)
- func (b *BucketConnector) IsBucketInAsia(ctx context.Context) (bool, error)
- func (b *BucketConnector) ListTestplans(ctx context.Context) ([]string, error)
- func (b *BucketConnector) UploadLog(ctx context.Context, gsFilename, localFilePath string) (string, error)
- type IBucketClient
- type IBucketServices
- type MockBucketServices
- func (m *MockBucketServices) GetBuilds(ctx context.Context, board string, milestone int32) ([]string, error)
- func (m *MockBucketServices) GetMilestones(ctx context.Context, board string) ([]string, error)
- func (m *MockBucketServices) GetTestPlan(ctx context.Context, name string) (*test_platform.Request_TestPlan, error)
- func (m *MockBucketServices) IsBucketInAsia(ctx context.Context) (bool, error)
- func (m *MockBucketServices) ListTestplans(ctx context.Context) ([]string, error)
- func (m *MockBucketServices) UploadLog(ctx context.Context, name, path string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var DefaultPageSize = 10
Functions ¶
This section is empty.
Types ¶
type BucketConnector ¶
type BucketConnector struct {
// contains filtered or unexported fields
}
BucketConnector is an object for connecting the GCS bucket storage.
func (*BucketConnector) GetBuilds ¶
func (b *BucketConnector) GetBuilds(ctx context.Context, board string, milestone int32) ([]string, error)
GetBuilds returns all build versions from the bucket by given board and milestone.
string board the board name we want to use as a filter. string milestone the milestone we want to use as a filter.
func (*BucketConnector) GetMilestones ¶
GetMilestones returns all milestones from the bucket by given board.
string board the board name we want to use as a filter.
func (*BucketConnector) GetTestPlan ¶
func (b *BucketConnector) GetTestPlan(ctx context.Context, name string) (*test_platform.Request_TestPlan, error)
GetTestPlan get the test plan's content from the given filename.
func (*BucketConnector) IsBucketInAsia ¶
func (b *BucketConnector) IsBucketInAsia(ctx context.Context) (bool, error)
IsBucketInAsia returns boolean. Check the given bucket is in asia.
func (*BucketConnector) ListTestplans ¶
func (b *BucketConnector) ListTestplans(ctx context.Context) ([]string, error)
ListTestplans list all testplan json in partner bucket under a `testplans` folder
type IBucketClient ¶
type IBucketClient interface { // GetAttrs get the bucket attributes GetAttrs(ctx context.Context) (*storage.BucketAttrs, error) // QueryObjects query objects from the bucket QueryObjects(ctx context.Context, q *storage.Query) iObjectIterator // ReadObject read the object content by the given name ReadObject(ctx context.Context, name string) (io.ReadCloser, error) // WriteObject writes a object to the bucket WriteObject(ctx context.Context, name string) io.WriteCloser // GetBucketName get the current bucket name GetBucketName() string // Close clean up Close() error }
type IBucketServices ¶
type IBucketServices interface { // IsBucketInAsia returns boolean. Check the given bucket is in asia. IsBucketInAsia(ctx context.Context) (bool, error) // GetMilestones returns all milestones from the bucket by given board. GetMilestones(ctx context.Context, board string) ([]string, error) // GetBuilds returns all build versions from the bucket by given board and milestone. GetBuilds(ctx context.Context, board string, milestone int32) ([]string, error) // ListTestplans list all testplan json in partner bucket under a `testplans` folder ListTestplans(ctx context.Context) ([]string, error) // GetTestPlan get the test plan's content from the given filename. GetTestPlan(context.Context, string) (*test_platform.Request_TestPlan, error) // UploadLog upload the log to bucket. UploadLog(context.Context, string, string) (string, error) }
IBucketServices is the interface that provide the services It should not contain any `Business Logic` here, because it is to mock the interface for testing.
type MockBucketServices ¶
MockBucketServices This object is only for testing
Object should provide the same functions that `IBucketServices` interfaces provide. TODO: I will write a generator for the interface later to generate this file
func (*MockBucketServices) GetBuilds ¶
func (m *MockBucketServices) GetBuilds(ctx context.Context, board string, milestone int32) ([]string, error)
GetBuilds Mock the function instead of calling an API.
func (*MockBucketServices) GetMilestones ¶
GetMilestones Mock the function instead of calling an API.
func (*MockBucketServices) GetTestPlan ¶
func (m *MockBucketServices) GetTestPlan(ctx context.Context, name string) (*test_platform.Request_TestPlan, error)
GetTestPlan get the test plan's content from the given filename.
func (*MockBucketServices) IsBucketInAsia ¶
func (m *MockBucketServices) IsBucketInAsia(ctx context.Context) (bool, error)
IsBucketInAsia Mock the function instead of calling an API.
func (*MockBucketServices) ListTestplans ¶
func (m *MockBucketServices) ListTestplans(ctx context.Context) ([]string, error)
ListTestplans list all testplan json in partner bucket under a `testplans` folder