cases

package
v0.0.0-...-7404c28 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TBizID uint32 = math.MaxUint32
	// TZhEnNumUnderHyphenSpace to test: Only Chinese, English, number, underline, hyphen, space are allowed.
	TZhEnNumUnderHyphenSpace string = "中文_English- 12345"
	// TZhEnNumUnderHyphenDot to test: Only Chinese, English, number, underline, hyphen, point are allowed.
	TZhEnNumUnderHyphenDot string = "中文_English-12345."
	// TEnNumUnderHyphenDot to test: Only English, number, underline, hyphen, point are allowed.
	TEnNumUnderHyphenDot string = "English_12.3-4"
	// TZhEnNumUnderHyphen to test: Only Chinese, English, number, underline, hyphen are allowed.
	TZhEnNumUnderHyphen string = "中文_English-12345"
	// TNumber to test: string should start and end with number.
	TNumber string = "12345"
	// TEnglish to test: string should start and end with English.
	TEnglish string = "English"
	// TChinese to test: string should start and end with Chinese.
	TChinese string = "中文"
)

normal generic test cases. T means true, for normal test.

View Source
const (
	WID uint32 = 0
	// WCharacter to test: Only Chinese, English, number, underline, hyphen, space, dot are allowed.
	WCharacter string = "¥@%&"
	// WPrefix to test: string should start with Chinese, English, number.
	WPrefix string = "_underline_prefix"
	// WTail to test: string should end with Chinese, English, number.
	WTail string = "underline_tail_"
	// WEnum If the field value is a limited range value, like file type and so on, use this test case.
	WEnum string = "wrong_enum"
)

abnormal generic test cases. W means wrong, for abnormal test.

Variables

This section is empty.

Functions

func CountPage

func CountPage() *pbbase.BasePage

CountPage count data page.

func GenApiCtxHeader

func GenApiCtxHeader() (context.Context, http.Header)

GenApiCtxHeader generate request context for api client

func GenCacheContext

func GenCacheContext() context.Context

GenCacheContext generate request context for cache client

func GenListAppByIdsReq

func GenListAppByIdsReq(bizId uint32, appIds []uint32) (*pbcs.ListAppsReq, error)

GenListAppByIdsReq generate a list_app request by biz_id and app_ids.

func GenListCommitByIdsReq

func GenListCommitByIdsReq(bizId, appId uint32, commitIds []uint32) (*pbcs.ListCommitsReq, error)

GenListCommitByIdsReq generate a list_commit request by biz_id, app_id and commit_ids.

func GenListContentByIdsReq

func GenListContentByIdsReq(bizId, appId uint32, contentIds []uint32) (*pbcs.ListContentsReq, error)

GenListContentByIdsReq generate a list_content request by biz_id, app_id and content_ids.

func GenListHookByIdsReq

func GenListHookByIdsReq(appId uint32, hookIds []uint32) (*pbcs.ListHooksReq, error)

GenListHookByIdsReq generate a list_hook request by app_ids.

func GenListInstancePublishByIdsReq

func GenListInstancePublishByIdsReq(bizId uint32, publishIds []uint32) (
	*pbcs.ListPublishedInstanceReq, error)

GenListInstancePublishByIdsReq generate a list_app_instance_publish request by biz_id and publish ids.

func GenListReleaseByIdsReq

func GenListReleaseByIdsReq(bizId, appId uint32, releaseIds []uint32) (*pbcs.ListReleasesReq, error)

GenListReleaseByIdsReq generate a list_release request by biz_id, app_id and release_ids.

func GenListStrategyByIdsReq

func GenListStrategyByIdsReq(bizId, appId uint32, strategyIds []uint32) (*pbcs.ListStrategiesReq, error)

GenListStrategyByIdsReq generate a list_strategy request by biz_id, app_id and strategy ids.

func GenListStrategyPublishByIdsReq

func GenListStrategyPublishByIdsReq(bizId, appId uint32, publishIds []uint32) (
	*pbcs.ListPubStrategyHistoriesReq, error)

GenListStrategyPublishByIdsReq generate a list_strategy_publish request by biz_id, app_id and publish ids.

func GenListStrategySetByIdsReq

func GenListStrategySetByIdsReq(bizId, appId uint32, stgSetIds []uint32) (*pbcs.ListStrategySetsReq, error)

GenListStrategySetByIdsReq generate a list_strategy_set request by biz_id, app_id and strategy_set ids.

func GenMainSelector

func GenMainSelector() *selector.Selector

GenMainSelector generate a main selector for test

func GenQueryFilterByIds

func GenQueryFilterByIds(ids []uint32) (*pbstruct.Struct, error)

GenQueryFilterByIds query app filter by id

func GenSubSelector

func GenSubSelector() *selector.Selector

GenSubSelector generate a sub selector for test

func ListPage

func ListPage() *pbbase.BasePage

ListPage list data page.

func RandName

func RandName(prefix string) string

RandName generate rand resource name.

func RandNameN

func RandNameN(prefix string, n int) string

RandNameN generate rand resource name of n length.

func RandString

func RandString(n int) string

RandString generate a random string of n length.

func SoCreateRevision

func SoCreateRevision(actual interface{}, expected ...interface{}) string

SoCreateRevision a func for So() of convey, it is aimed to verify create revision

func SoRevision

func SoRevision(actual interface{}, expected ...interface{}) string

SoRevision a func for So() of convey, it is aimed to verify revision

func SoShouldJsonEqual

func SoShouldJsonEqual(actual interface{}, expected ...interface{}) string

SoShouldJsonEqual a func for So() of convey, it is aimed to verify that the JSON of the two values are equal.

Types

type ResourceManager

type ResourceManager struct {
	// App key is app mode, value is []uint32 of app id
	App map[table.AppMode][]uint32
	// Hook key is app id, value is []uint32 of hook id
	Hook map[uint32][]uint32
	// ConfigItem key is app id, value is []uint32 of config item id
	ConfigItem map[uint32][]uint32
	// Content key is config item id, value is content id
	Content map[uint32]uint32
	// Commit key is content id, value is commit id
	Commit map[uint32]uint32
	// Release key is app id, value is release id
	Release map[uint32]uint32
	// StrategySet key is app id, value is strategy set id
	StrategySet map[uint32]uint32
	// Strategies key is strategy set id, value is strategy id
	Strategies map[uint32][]uint32
	// AppToStrategy key is app id, value is strategy id
	AppToStrategy map[uint32][]uint32
	// Publish key is app id, value is publish strategy id
	Publish map[uint32][]uint32
	// Instance key is app id, value is publish instance id
	Instance map[uint32][]uint32
}

ResourceManager struct of resource manager, which is to save created data ids. Its purpose is to conveniently obtain the ID of the resource created earlier.

func NewResourceManager

func NewResourceManager() *ResourceManager

NewResourceManager initial resource manager

func (*ResourceManager) AddApp

func (rm *ResourceManager) AddApp(mode table.AppMode, appId uint32)

AddApp add a created app id

func (*ResourceManager) AddCommit

func (rm *ResourceManager) AddCommit(contentId, commitId uint32)

AddCommit add a created commit id

func (*ResourceManager) AddConfigItem

func (rm *ResourceManager) AddConfigItem(appId, configItemId uint32)

AddConfigItem add a created config item id

func (*ResourceManager) AddContent

func (rm *ResourceManager) AddContent(configItemId, contentId uint32)

AddContent add a created content id

func (*ResourceManager) AddHook

func (rm *ResourceManager) AddHook(appId, hookId uint32)

AddHook add a created hook id

func (*ResourceManager) AddInstance

func (rm *ResourceManager) AddInstance(appId, publishId uint32)

AddInstance add a created publish instance id

func (*ResourceManager) AddPublish

func (rm *ResourceManager) AddPublish(appId, publishId uint32)

AddPublish add a created publish strategy id

func (*ResourceManager) AddRelease

func (rm *ResourceManager) AddRelease(appId, releaseId uint32)

AddRelease add a created release id

func (*ResourceManager) AddStrategy

func (rm *ResourceManager) AddStrategy(appId, stgSetId, stgId uint32)

AddStrategy add a created strategy id

func (*ResourceManager) AddStrategySet

func (rm *ResourceManager) AddStrategySet(appId, stgSetId uint32)

AddStrategySet add a created strategy set id

func (*ResourceManager) DeleteApp

func (rm *ResourceManager) DeleteApp(mode table.AppMode, id uint32)

DeleteApp delete an app resource id

func (*ResourceManager) DeleteConfigItem

func (rm *ResourceManager) DeleteConfigItem(appId uint32, ciId uint32)

DeleteConfigItem delete a created config item id

func (*ResourceManager) DeleteHook

func (rm *ResourceManager) DeleteHook(appId uint32, ciId uint32)

DeleteHook delete a created hook id

func (*ResourceManager) DeleteStrategy

func (rm *ResourceManager) DeleteStrategy(appId, stgSetId, stgId uint32)

DeleteStrategy delete a created strategy id

func (*ResourceManager) DeleteStrategySet

func (rm *ResourceManager) DeleteStrategySet(appId uint32)

DeleteStrategySet delete a created strategy set id

func (*ResourceManager) GetApp

func (rm *ResourceManager) GetApp(mode table.AppMode) uint32

GetApp get an app resource id

func (*ResourceManager) GetAppToRelease

func (rm *ResourceManager) GetAppToRelease() (appId, relId uint32)

GetAppToRelease get an app id and release id, when app has release

func (*ResourceManager) GetAppToStrategy

func (rm *ResourceManager) GetAppToStrategy() (appId, stgId uint32)

GetAppToStrategy get an app id and stg id, when app has strategy

func (*ResourceManager) GetAppToStrategySet

func (rm *ResourceManager) GetAppToStrategySet() (appId, stgSetId uint32)

GetAppToStrategySet get an app id and strategy set id, when app has strategy set

func (*ResourceManager) GetCommit

func (rm *ResourceManager) GetCommit(contentId uint32) uint32

GetCommit get a created commit id

func (*ResourceManager) GetConfigItem

func (rm *ResourceManager) GetConfigItem(appId uint32) uint32

GetConfigItem get a created config item id

func (*ResourceManager) GetContent

func (rm *ResourceManager) GetContent(configItemId uint32) uint32

GetContent get a created content id

func (*ResourceManager) GetHook

func (rm *ResourceManager) GetHook(appId uint32) uint32

GetHook get a created hook id

func (*ResourceManager) GetInstance

func (rm *ResourceManager) GetInstance(appId uint32) uint32

GetInstance get a created publish id

func (*ResourceManager) GetPublish

func (rm *ResourceManager) GetPublish(appId uint32) uint32

GetPublish get a created publish id

func (*ResourceManager) GetRelease

func (rm *ResourceManager) GetRelease(appId uint32) uint32

GetRelease get a created release id

func (*ResourceManager) GetStrategy

func (rm *ResourceManager) GetStrategy(stgSetId uint32) uint32

GetStrategy get a created strategy id

func (*ResourceManager) GetStrategySet

func (rm *ResourceManager) GetStrategySet(appId uint32) uint32

GetStrategySet get a created strategy set id

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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