Documentation
¶
Index ¶
- Variables
- func GetVersionLocatorFromStackDefinitionForMemberName(pathToStackDefinition string, memberName string) (string, error)
- func TrackAndResyncState(options *TestProjectsOptions, stackDetails *project.ProjectConfig, ...) (errors []error)
- type Status
- type TestProjectsOptions
- func (options *TestProjectsOptions) Clone() (*TestProjectsOptions, error)
- func (options *TestProjectsOptions) ConfigureTestStack() error
- func (options *TestProjectsOptions) RunProjectsTest() error
- func (options *TestProjectsOptions) TestTearDown()
- func (options *TestProjectsOptions) TriggerDeploy() error
- func (options *TestProjectsOptions) TriggerDeployAndWait() (errorList []error)
- func (options *TestProjectsOptions) TriggerUnDeploy() (bool, []error)
- func (options *TestProjectsOptions) TriggerUnDeployAndWait() (errorList []error)
Constants ¶
This section is empty.
Variables ¶
var Statuses = map[string]string{ project.ProjectConfig_State_Deployed: common.ColorizeString(common.Colors.Green, project.ProjectConfig_State_Deployed), project.ProjectConfig_State_Deploying: common.ColorizeString(common.Colors.Orange, project.ProjectConfig_State_Deploying), project.ProjectConfig_State_DeployingFailed: common.ColorizeString(common.Colors.Red, project.ProjectConfig_State_DeployingFailed), project.ProjectConfig_State_Undeploying: common.ColorizeString(common.Colors.Orange, project.ProjectConfig_State_Undeploying), project.ProjectConfig_State_UndeployingFailed: common.ColorizeString(common.Colors.Red, project.ProjectConfig_State_UndeployingFailed), project.ProjectConfig_State_Validated: common.ColorizeString(common.Colors.Green, project.ProjectConfig_State_Validated), project.ProjectConfig_State_Validating: common.ColorizeString(common.Colors.Orange, project.ProjectConfig_State_Validating), project.ProjectConfig_State_ValidatingFailed: common.ColorizeString(common.Colors.Red, project.ProjectConfig_State_ValidatingFailed), project.ProjectConfig_State_Approved: common.ColorizeString(common.Colors.Green, project.ProjectConfig_State_Approved), project.ProjectConfig_State_Draft: common.ColorizeString(common.Colors.Blue, project.ProjectConfig_State_Draft), project.ProjectConfig_State_ApplyFailed: common.ColorizeString(common.Colors.Red, project.ProjectConfig_State_ApplyFailed), project.ProjectConfig_State_Deleting: common.ColorizeString(common.Colors.Orange, project.ProjectConfig_State_Deleting), project.ProjectConfig_State_DeletingFailed: common.ColorizeString(common.Colors.Red, project.ProjectConfig_State_DeletingFailed), project.ProjectConfig_State_Deleted: common.ColorizeString(common.Colors.Green, project.ProjectConfig_State_Deleted), project.ProjectConfig_StateCode_AwaitingValidation: common.ColorizeString(common.Colors.Yellow, project.ProjectConfig_StateCode_AwaitingValidation), project.ProjectConfig_StateCode_AwaitingPrerequisite: common.ColorizeString(common.Colors.Yellow, project.ProjectConfig_StateCode_AwaitingPrerequisite), project.ProjectConfig_StateCode_AwaitingInput: common.ColorizeString(common.Colors.Yellow, project.ProjectConfig_StateCode_AwaitingInput), project.ProjectConfig_StateCode_AwaitingMemberDeployment: common.ColorizeString(common.Colors.Yellow, project.ProjectConfig_StateCode_AwaitingMemberDeployment), project.ProjectConfig_StateCode_AwaitingStackSetup: common.ColorizeString(common.Colors.Yellow, project.ProjectConfig_StateCode_AwaitingStackSetup), "nil": common.ColorizeString(common.Colors.Red, "nil"), "Unknown": common.ColorizeString(common.Colors.Purple, "Unknown"), }
Statuses is a map of the status strings to colorized strings
Functions ¶
func GetVersionLocatorFromStackDefinitionForMemberName ¶ added in v1.33.0
func TrackAndResyncState ¶ added in v1.39.0
func TrackAndResyncState( options *TestProjectsOptions, stackDetails *project.ProjectConfig, stackMembers []*project.ProjectConfig, memberStateStartTime map[string]time.Time, mu *sync.Mutex, ) (errors []error)
TrackAndResyncState tracks the state of members and triggers a resync if a member is stuck in a state for more than the options.StackAutoSyncInterval.
Types ¶
type Status ¶ added in v1.39.6
type Status struct { DEPLOYED string DEPLOYING string DEPLOYING_FAILED string VALIDATED string VALIDATING string VALIDATING_FAILED string AWAITING_VALIDATION string APPROVED string DRAFT string AWAITING_PREREQUISITE string AWAITING_INPUT string NIL string UNKOWN string }
Status is a struct of the status strings
type TestProjectsOptions ¶
type TestProjectsOptions struct { // REQUIRED: a pointer to an initialized testing object. // Typically you would assign the test object used in the unit test. Testing *testing.T `copier:"-"` // The default constructors will use this map to check that all required environment variables are set properly. // If any are missing, the test will fail. RequiredEnvironmentVars map[string]string // Only required if using the WithVars constructor, as this value will then populate the `resource_group` input variable. // This resource group will be used to create the project and stack. ResourceGroup string // REQUIRED: the string prefix that will be prepended to all resource names, typically sent in as terraform input variable. // Set this value in the default constructors and a unique 6-digit random string will be appended. // Can then be referenced after construction and used as unique variable. // // Example: // Supplied to constructor = `my-test` // After constructor = `my-test-xu5oby` Prefix string ProjectName string ProjectDescription string ProjectLocation string ProjectDestroyOnDelete *bool ProjectMonitoringEnabled *bool ProjectAutoDeploy *bool ProjectEnvironments []project.EnvironmentPrototype CloudInfoService cloudinfo.CloudInfoServiceI // OPTIONAL: Supply if you need multiple tests to share info service and data // ProjectsApiURL Base URL of the schematics REST API. Set to override default. // Default: https://projects.api.cloud.ibm.com ProjectsApiURL string // ConfigrationPath Path to the configuration file that will be used to create the project. // Deprecated: Use StackConfigurationPath instead. ConfigrationPath string // StackConfigurationPath Path to the configuration file that will be used to create the stack. StackConfigurationPath string StackCatalogJsonPath string // StackAutoSync If set to true, when deploying or undeploying a member, a sync with Schematics will be executed if the member has not updated before the StackAutoSyncInterval. StackAutoSync bool // StackAutoSyncInterval The number of minutes to wait before syncing with Schematics if state has not updated. Default is 20 minutes. StackAutoSyncInterval int // Deprecated: Deploy order is now determined by the project. StackConfigurationOrder []string // Deprecated: Deploy groups are now determined by the project. StackUndeployOrder []string // StackAuthorizations The authorizations to use for the project. // If not set, the default will be to use the TF_VAR_ibmcloud_api_key environment variable. // Can be used to set Trusted Profile or API Key. StackAuthorizations *project.ProjectConfigAuth // StackMemberInputs [ "primary-da": {["input1": "value1", "input2": 2]}, "secondary-da": {["input1": "value1", "input2": 2]}] StackMemberInputs map[string]map[string]interface{} // StackInputs {"input1": "value1", "input2": 2} StackInputs map[string]interface{} // CatalogProductName The name of the product in the catalog. Defaults to the first product in the catalog. CatalogProductName string // CatalogFlavorName The name of the flavor in the catalog. Defaults to the first flavor in the catalog. CatalogFlavorName string // ParallelDeploy If set to true, the test will deploy the stack in parallel. // This will deploy the stack in batches of whatever is not waiting on a prerequisite to be deployed. // Note Undeploy will still be in serial. // Deprecated: All deploys are now parallel by default using projects built-in parallel deploy feature. ParallelDeploy bool // ValidationTimeoutMinutes The number of minutes to wait for the project to validate. // Deprecated: This is now handled by projects and we only use DeployTimeoutMinutes for the entire project. ValidationTimeoutMinutes int // DeployTimeoutMinutes The number of minutes to wait for the stack to deploy. Also used for undeploy. Default is 6 hours. DeployTimeoutMinutes int // If you want to skip teardown use this flag SkipTestTearDown bool SkipUndeploy bool SkipProjectDelete bool // Hooks These allow us to inject custom code into the test process // example to set a hook: // options.PreDeployHook = func(options *TestProjectsOptions) error { // // do something // return nil // } PreDeployHook func(options *TestProjectsOptions) error // In upgrade tests, this hook will be called before the deploy PostDeployHook func(options *TestProjectsOptions) error // In upgrade tests, this hook will be called after the deploy PreUndeployHook func(options *TestProjectsOptions) error // If this fails, the undeploy will continue PostUndeployHook func(options *TestProjectsOptions) error Logger *common.TestLogger // contains filtered or unexported fields }
func TestProjectOptionsDefault ¶
func TestProjectOptionsDefault(originalOptions *TestProjectsOptions) *TestProjectsOptions
TestProjectOptionsDefault Default constructor for TestProjectsOptions This function will accept an existing instance of TestProjectOptions values, and return a new instance of TestProjectOptions with the original values set along with appropriate default values for any properties that were not set in the original options. Summary of default values: - Prefix: original prefix with a unique 6-digit random string appended
func (*TestProjectsOptions) Clone ¶
func (options *TestProjectsOptions) Clone() (*TestProjectsOptions, error)
Clone makes a deep copy of most fields on the Options object and returns it.
NOTE: options.SshAgent and options.Logger CANNOT be deep copied (e.g., the SshAgent struct contains channels and listeners that can't be meaningfully copied), so the original values are retained.
func (*TestProjectsOptions) ConfigureTestStack ¶ added in v1.34.0
func (options *TestProjectsOptions) ConfigureTestStack() error
func (*TestProjectsOptions) RunProjectsTest ¶
func (options *TestProjectsOptions) RunProjectsTest() error
RunProjectsTest : Run the test for the projects service Creates a new project Adds a configuration Deploys the configuration Deletes the project
func (*TestProjectsOptions) TestTearDown ¶
func (options *TestProjectsOptions) TestTearDown()
func (*TestProjectsOptions) TriggerDeploy ¶ added in v1.39.0
func (options *TestProjectsOptions) TriggerDeploy() error
TriggerDeploy is assuming auto deploy is enabled so just triggers validate at the stack level
func (*TestProjectsOptions) TriggerDeployAndWait ¶ added in v1.39.0
func (options *TestProjectsOptions) TriggerDeployAndWait() (errorList []error)
func (*TestProjectsOptions) TriggerUnDeploy ¶ added in v1.39.0
func (options *TestProjectsOptions) TriggerUnDeploy() (bool, []error)
func (*TestProjectsOptions) TriggerUnDeployAndWait ¶ added in v1.39.0
func (options *TestProjectsOptions) TriggerUnDeployAndWait() (errorList []error)