mock

package
v46.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

* Copyright (C) 2017-2019 Alibaba Group Holding Limited

* Copyright (C) 2017-2019 Alibaba Group Holding Limited

* Copyright (C) 2017-2019 Alibaba Group Holding Limited

* Copyright (C) 2017-2019 Alibaba Group Holding Limited

* Copyright (C) 2017-2019 Alibaba Group Holding Limited

* Copyright (C) 2017-2019 Alibaba Group Holding Limited

* Copyright (C) 2017-2019 Alibaba Group Holding Limited

* Copyright (C) 2017-2019 Alibaba Group Holding Limited

* Copyright (C) 2017-2019 Alibaba Group Holding Limited

Index

Constants

View Source
const (
	MaxDiskSizeGB = 32768
)

Variables

This section is empty.

Functions

func GetWrappedString

func GetWrappedString(s string, prefix string, suffix string) string

func NewDiskId

func NewDiskId() string

func NewDiskManagerMock

func NewDiskManagerMock(mc TestContext) alicloud.DiskManager

func NewInstanceId

func NewInstanceId() string

func NewInstanceManagerMock

func NewInstanceManagerMock(mc TestContext) alicloud.InstanceManager

func NewNetworkInterfaceId

func NewNetworkInterfaceId() string

func NewNetworkManagerMock

func NewNetworkManagerMock(context TestContext) alicloud.NetworkManager

func NewOssBucketName

func NewOssBucketName() string

func NewOssManagerMock

func NewOssManagerMock(mc TestContext) alicloud.OssManager

func NewOssObejctName

func NewOssObejctName() string

func NewRegistryMock

func NewRegistryMock() registry.Client

func NewSnapshotId

func NewSnapshotId() string

func NewStemcellId

func NewStemcellId() string

func NewStemcellManagerMock

func NewStemcellManagerMock(mc TestContext) alicloud.StemcellManager

func NewVswitchId

func NewVswitchId() string

func RandomString

func RandomString(length int) string

Types

type Builder

type Builder string

func NewBuilder

func NewBuilder(json string) Builder

func (Builder) ApplyEnvs

func (b Builder) ApplyEnvs() (Builder, error)

func (Builder) P

func (b Builder) P(p string, v string) Builder

func (Builder) ToBytes

func (b Builder) ToBytes() []byte

type DiskManagerMock

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

func (DiskManagerMock) AttachDisk

func (a DiskManagerMock) AttachDisk(instCid string, diskCid string) error

func (DiskManagerMock) ChangeDiskStatus

func (a DiskManagerMock) ChangeDiskStatus(cid string, toStatus alicloud.DiskStatus, checkFunc func(disk *ecs.Disk) (bool, error)) error

func (DiskManagerMock) CreateDisk

func (a DiskManagerMock) CreateDisk(region string, args *ecs.CreateDiskRequest) (string, error)

func (DiskManagerMock) CreateSnapshot

func (a DiskManagerMock) CreateSnapshot(diskCid string, snapshotName string) (string, error)

func (DiskManagerMock) DeleteDisk

func (a DiskManagerMock) DeleteDisk(diskCid string) error

func (DiskManagerMock) DeleteSnapshot

func (a DiskManagerMock) DeleteSnapshot(snapshotCid string) error

func (DiskManagerMock) DetachDisk

func (a DiskManagerMock) DetachDisk(instCid string, diskCid string) error

func (DiskManagerMock) GetDisk

func (a DiskManagerMock) GetDisk(diskCid string) (*ecs.Disk, error)

func (DiskManagerMock) GetDisks

func (a DiskManagerMock) GetDisks(instCid string) ([]ecs.Disk, error)

func (DiskManagerMock) ModifyDiskAttribute

func (a DiskManagerMock) ModifyDiskAttribute(diskCid string, name string, description string) error

func (DiskManagerMock) ResizeDisk

func (a DiskManagerMock) ResizeDisk(diskCid string, sizeGB int) error

func (DiskManagerMock) WaitForDiskStatus

func (a DiskManagerMock) WaitForDiskStatus(diskCid string, toStatus alicloud.DiskStatus) (string, error)

type InstanceManagerMock

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

func (InstanceManagerMock) AddTags

func (a InstanceManagerMock) AddTags(cid string, tags map[string]string) error

func (InstanceManagerMock) ChangeInstanceStatus

func (a InstanceManagerMock) ChangeInstanceStatus(cid string, toStatus alicloud.InstanceStatus, checkFunc func(status alicloud.InstanceStatus) (bool, error)) error

func (InstanceManagerMock) CleanupInstanceNetworkInterfaces

func (a InstanceManagerMock) CleanupInstanceNetworkInterfaces(cid string, eniIds []string) error

func (InstanceManagerMock) CreateInstance

func (a InstanceManagerMock) CreateInstance(region string, args *ecs.CreateInstanceRequest) (string, error)

func (InstanceManagerMock) DeleteInstance

func (a InstanceManagerMock) DeleteInstance(cid string) error

func (InstanceManagerMock) GetAttachedNetworkInterfaceIds

func (a InstanceManagerMock) GetAttachedNetworkInterfaceIds(cid string) []string

func (InstanceManagerMock) GetInstance

func (a InstanceManagerMock) GetInstance(cid string) (*ecs.Instance, error)

func (InstanceManagerMock) GetInstanceStatus

func (a InstanceManagerMock) GetInstanceStatus(cid string) (alicloud.InstanceStatus, error)

func (InstanceManagerMock) ModifyInstanceAttribute

func (a InstanceManagerMock) ModifyInstanceAttribute(cid string, name string, description string) error

func (InstanceManagerMock) RebootInstance

func (a InstanceManagerMock) RebootInstance(cid string) error

func (InstanceManagerMock) StartInstance

func (a InstanceManagerMock) StartInstance(cid string) error

func (InstanceManagerMock) StopInstance

func (a InstanceManagerMock) StopInstance(cid string) error

func (InstanceManagerMock) WaitForInstanceStatus

func (a InstanceManagerMock) WaitForInstanceStatus(cid string, toStatus alicloud.InstanceStatus) (alicloud.InstanceStatus, error)

type NetworkManagerMock

type NetworkManagerMock struct {
}

func (NetworkManagerMock) BindEip

func (a NetworkManagerMock) BindEip(region string, instanceId string, eip string) error

func (NetworkManagerMock) BindSLB

func (a NetworkManagerMock) BindSLB(region, instanceId, slbId string, weight int) error

func (NetworkManagerMock) BindSlbServerGroup

func (a NetworkManagerMock) BindSlbServerGroup(region, instanceId, slbId string, weight int, port int) error

func (NetworkManagerMock) DescribeEip

func (a NetworkManagerMock) DescribeEip(region, eip string) (ecs.EipAddressInDescribeEipAddresses, error)

func (NetworkManagerMock) DescribeSecurityGroupAttribute

func (a NetworkManagerMock) DescribeSecurityGroupAttribute(region, groupId string) (ecs.DescribeSecurityGroupAttributeResponse, error)

func (NetworkManagerMock) JoinSecurityGroup

func (a NetworkManagerMock) JoinSecurityGroup(region, instanceId string, groupId string) error

func (NetworkManagerMock) WaitForEipStatus

func (a NetworkManagerMock) WaitForEipStatus(region, eip string, toStatus alicloud.EipStatus) error

type OssManagerMock

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

func (OssManagerMock) CreateBucket

func (a OssManagerMock) CreateBucket(name string, options ...oss.Option) error

func (OssManagerMock) DeleteBucket

func (a OssManagerMock) DeleteBucket(name string) error

func (OssManagerMock) DeleteObject

func (a OssManagerMock) DeleteObject(bucket oss.Bucket, name string) error

func (OssManagerMock) GetBucket

func (a OssManagerMock) GetBucket(name string) (*oss.Bucket, error)

func (OssManagerMock) MultipartUploadFile

func (a OssManagerMock) MultipartUploadFile(
	bucket oss.Bucket, objectKey, filePath string, partSize int64, options ...oss.Option) error

func (OssManagerMock) UploadFile

func (a OssManagerMock) UploadFile(
	bucket oss.Bucket, objectKey, filePath string, partSize int64, options ...oss.Option) error

type RegistryClientMock

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

func (RegistryClientMock) Delete

func (c RegistryClientMock) Delete(instanceID string) error

func (RegistryClientMock) Fetch

func (c RegistryClientMock) Fetch(instanceID string) (registry.AgentSettings, error)

func (RegistryClientMock) Update

func (c RegistryClientMock) Update(instanceID string, agentSettings registry.AgentSettings) error

type StemcellManagerMock

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

func (StemcellManagerMock) CopyImage

func (a StemcellManagerMock) CopyImage(args *ecs.CopyImageRequest) (string, error)

func (StemcellManagerMock) DeleteStemcell

func (a StemcellManagerMock) DeleteStemcell(id string) error

func (StemcellManagerMock) FindStemcellById

func (a StemcellManagerMock) FindStemcellById(id string) (*ecs.Image, error)

func (StemcellManagerMock) ImportImage

func (a StemcellManagerMock) ImportImage(args *ecs.ImportImageRequest) (string, error)

func (StemcellManagerMock) OpenLocalFile

func (a StemcellManagerMock) OpenLocalFile(path string) (*os.File, error)

func (StemcellManagerMock) WaitForImageReady

func (a StemcellManagerMock) WaitForImageReady(id string) error

type TestContext

type TestContext struct {
	Disks             map[string]*ecs.Disk
	Instances         map[string]*ecs.Instance
	Stemcells         map[string]*ecs.Image
	Buckets           map[string]*oss.Bucket
	OssObjects        map[string]string
	Snapshots         map[string]string
	NetworkInterfaces map[string]*ecs.NetworkInterface
	// contains filtered or unexported fields
}

func NewTestContext

func NewTestContext(config alicloud.Config) TestContext

func (TestContext) NewBucket

func (c TestContext) NewBucket(name string) (string, *oss.Bucket)

func (TestContext) NewDisk

func (c TestContext) NewDisk(instCid string) (string, *ecs.Disk)

func (TestContext) NewInstance

func (c TestContext) NewInstance() (string, *ecs.Instance)

func (TestContext) NewNetworkInterface

func (c TestContext) NewNetworkInterface() *ecs.NetworkInterface

func (TestContext) NewObject

func (c TestContext) NewObject(name, path string) string

func (TestContext) NewSnapshot

func (c TestContext) NewSnapshot(diskCid string) string

func (TestContext) NewStemcell

func (c TestContext) NewStemcell() (string, *ecs.Image)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL