Documentation
¶
Overview ¶
Package core contains compatibility testing framework core types and functions
Index ¶
- Variables
- func ConstructTestPluginCmd(version RuntimeVersion, apis []*API) (string, error)
- func Exec(command string) (stdOut, stdErr *bytes.Buffer, err error)
- func ParseStdout(s string) (map[RuntimeAPIName][]APILog, error)
- func ParseStr(val interface{}) (string, error)
- func SetupTempCfgFiles() (files []*os.File, cleanup func())
- type API
- type APIArgumentType
- type APILog
- type APIResponse
- type Command
- type Output
- type ResponseType
- type Result
- type RuntimeAPIName
- type RuntimeAPIVersion
- type RuntimeVersion
- type TestCase
- type ValidationStrategy
Constants ¶
This section is empty.
Variables ¶
var SupportedRuntimeVersions = []RuntimeVersion{ Version0116, Version0254, Version0280, Version090, Version102, VersionLatest, }
SupportedRuntimeVersions Current supported runtime library versions
Functions ¶
func ConstructTestPluginCmd ¶
func ConstructTestPluginCmd(version RuntimeVersion, apis []*API) (string, error)
ConstructTestPluginCmd constructs the specific runtime test plugin command as per runtime version and apis
func ParseStdout ¶
func ParseStdout(s string) (map[RuntimeAPIName][]APILog, error)
ParseStdout convert the string represented std out log into map structure
func SetupTempCfgFiles ¶
SetupTempCfgFiles mock runtime config files
Types ¶
type API ¶
type API struct { Name RuntimeAPIName `json:"name" yaml:"name"` Version RuntimeVersion `json:"version" yaml:"version"` Arguments map[APIArgumentType]interface{} `json:"arguments" yaml:"arguments"` Output *Output `json:"output" yaml:"output"` }
API represents the runtime api to execute
func ParseRuntimeAPIsFromFile ¶
ParseRuntimeAPIsFromFile reads the filepath and unmarshalls the file content into array of APIs
type APIArgumentType ¶
type APIArgumentType string
APIArgumentType describes all the arguments types required for Runtime APIs
const ( ClientConfig APIArgumentType = "clientConfig" Context APIArgumentType = "context" ContextName APIArgumentType = "contextName" SetCurrent APIArgumentType = "setCurrent" Server APIArgumentType = "server" ServerName APIArgumentType = "serverName" Name APIArgumentType = "name" Target APIArgumentType = "target" ContextType APIArgumentType = "contextType" Feature APIArgumentType = "feature" Plugin APIArgumentType = "plugin" Key APIArgumentType = "key" Value APIArgumentType = "value" DiscoverySource APIArgumentType = "discoverySource" )
type APILog ¶
type APILog struct {
APIResponse *APIResponse `json:"apiResponse" yaml:"apiResponse"`
}
APILog represents the logs/output/errors returned from runtime apis in test plugins
type APIResponse ¶
type APIResponse struct { ResponseType ResponseType `json:"responseType" yaml:"responseType"` ResponseBody interface{} `json:"responseBody" yaml:"responseBody"` }
APIResponse represents the output response returned from runtime apis
type Command ¶
type Command struct {
APIs []*API `json:"apis" yaml:"apis"`
}
Command represents the list of apis to execute as part of command execution
type Output ¶
type Output struct { ValidationStrategy ValidationStrategy `json:"validationstrategy" yaml:"validationstrategy"` Result Result `json:"result" yaml:"result"` Content string `json:"content" yaml:"content"` }
Output represents the runtime api expected output for validation
type ResponseType ¶
type ResponseType string
const ( MapResponse ResponseType = "map" BooleanResponse ResponseType = "bool" StringResponse ResponseType = "str" IntegerResponse ResponseType = "int" ErrorResponse ResponseType = "err" )
type RuntimeAPIName ¶
type RuntimeAPIName string
RuntimeAPIName describes all the Runtime APIs
const ( SetContextAPI RuntimeAPIName = "SetContext" AddContextAPI RuntimeAPIName = "AddContext" GetContextAPIName RuntimeAPIName = "GetContext" DeleteContextAPI RuntimeAPIName = "DeleteContext" RemoveContextAPI RuntimeAPIName = "RemoveContext" SetCurrentContextAPI RuntimeAPIName = "SetCurrentContext" GetCurrentContextAPI RuntimeAPIName = "GetCurrentContext" RemoveCurrentContextAPI RuntimeAPIName = "RemoveCurrentContext" GetActiveContextAPI RuntimeAPIName = "GetActiveContext" SetServerAPI RuntimeAPIName = "SetServer" AddServerAPI RuntimeAPIName = "AddServer" PutServerAPI RuntimeAPIName = "PutServer" GetServerAPI RuntimeAPIName = "GetServer" DeleteServerAPI RuntimeAPIName = "DeleteServer" RemoveServerAPI RuntimeAPIName = "RemoveServer" SetCurrentServerAPI RuntimeAPIName = "SetCurrentServer" GetCurrentServerAPI RuntimeAPIName = "GetCurrentServer" RemoveCurrentServerAPI RuntimeAPIName = "RemoveCurrentServer" SetFeatureAPI RuntimeAPIName = "SetFeature" IsFeatureEnabledAPI RuntimeAPIName = "IsFeatureEnabled" IsFeatureActivatedAPI RuntimeAPIName = "IsFeatureActivated" DeleteFeatureAPI RuntimeAPIName = "DeleteFeature" SetEnvAPI RuntimeAPIName = "SetEnv" GetEnvAPI RuntimeAPIName = "GetEnv" DeleteEnvAPI RuntimeAPIName = "DeleteEnv" GetEnvConfigurationsAPI RuntimeAPIName = "GetEnvConfigurations" SetCLIDiscoverySourceAPI RuntimeAPIName = "SetCLIDiscoverySource" GetCLIDiscoverySourceAPI RuntimeAPIName = "GetCLIDiscoverySource" DeleteCLIDiscoverySourceAPI RuntimeAPIName = "DeleteCLIDiscoverySource" GetMetadataAPI RuntimeAPIName = "GetMetadata" GetConfigMetadataAPI RuntimeAPIName = "GetConfigMetadata" GetConfigMetadataPatchStrategyAPI RuntimeAPIName = "GetConfigMetadataPatchStrategy" SetConfigMetadataPatchStrategyAPI RuntimeAPIName = "SetConfigMetadataPatchStrategy" GetConfigMetadataSettingsAPI RuntimeAPIName = "GetConfigMetadataSettings" GetConfigMetadataSettingAPI RuntimeAPIName = "GetConfigMetadataSetting" IsConfigMetadataSettingsEnabledAPI RuntimeAPIName = "IsConfigMetadataSettingsEnabled" UseUnifiedConfigAPI RuntimeAPIName = "UseUnifiedConfig" DeleteConfigMetadataSettingAPI RuntimeAPIName = "DeleteConfigMetadataSetting" SetConfigMetadataSettingAPI RuntimeAPIName = "SetConfigMetadataSetting" GetClientConfigAPI RuntimeAPIName = "GetClientConfig" StoreClientConfigAPI RuntimeAPIName = "StoreClientConfig" )
type RuntimeAPIVersion ¶
type RuntimeAPIVersion struct {
RuntimeVersion RuntimeVersion `json:"runtimeVersion,omitempty" yaml:"runtimeVersion,omitempty"`
}
RuntimeAPIVersion represents the runtime library versions used in XXXOpts structs
func (*RuntimeAPIVersion) Validate ¶
func (r *RuntimeAPIVersion) Validate() (bool, error)
Validate to verify passed version is valid and supported
type RuntimeVersion ¶
type RuntimeVersion string
RuntimeVersion Runtime library versions
const ( Version0116 RuntimeVersion = "v0.11.6" Version0254 RuntimeVersion = "v0.25.4" Version0280 RuntimeVersion = "v0.28.0" Version090 RuntimeVersion = "v0.90.0" Version102 RuntimeVersion = "v1.0.2" VersionLatest RuntimeVersion = "latest" )
func (RuntimeVersion) IsRuntimeVersionSupported ¶
func (version RuntimeVersion) IsRuntimeVersionSupported() bool
IsRuntimeVersionSupported check whether version is currently supported
type TestCase ¶
type TestCase struct {
Commands []*Command `json:"commands" yaml:"commands"`
}
TestCase represents the list of commands to execute as part of test case
type ValidationStrategy ¶
type ValidationStrategy string
ValidationStrategy used to describe the validation strategy. default is non-strict
const ValidationStrategyStrict ValidationStrategy = "strict"
ValidationStrategyStrict used to compare deep equality of objects