Documentation
¶
Index ¶
- func GetVersionLocatorFromStackDefinitionForMemberName(pathToStackDefinition string, memberName string) (string, error)
- func TrackAndResyncState(options *TestProjectsOptions, stackDetails *project.ProjectConfig, ...) (errors []error)
- type TestProjectsOptions
- func (options *TestProjectsOptions) Clone() (*TestProjectsOptions, error)
- func (options *TestProjectsOptions) ConfigureTestStack() error
- func (options *TestProjectsOptions) ProjectsLog(message string)
- 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 ¶
This section is empty.
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 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. 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{} // 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 // 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) ProjectsLog ¶ added in v1.39.0
func (options *TestProjectsOptions) ProjectsLog(message string)
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)