-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix supported patterns and extended tests (#5811)
* fix(partner center sell): fix supported attributes option Signed-off-by: Peter Harasztia <[email protected]> * fix(partner center sell): extend tests Signed-off-by: Peter Harasztia <[email protected]> * fix iam test Signed-off-by: Peter Harasztia <[email protected]> * fix merge conflict Signed-off-by: Peter Harasztia <[email protected]> --------- Signed-off-by: Peter Harasztia <[email protected]>
- Loading branch information
1 parent
d5beb7b
commit e95172e
Showing
15 changed files
with
757 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,14 +85,26 @@ func TestAccIbmOnboardingCatalogDeploymentAllArgs(t *testing.T) { | |
activeUpdate := "false" | ||
disabledUpdate := "false" | ||
kindUpdate := "deployment" | ||
overviewUiEn := "display_name" | ||
overviewUiEnUpdate := "display_name_2" | ||
rcCompatible := "true" | ||
rcCompatibleUpdate := "false" | ||
iamCompatible := "true" | ||
iamCompatibleUpdate := "false" | ||
deploymentBrokerName := "broker-petra-1" | ||
deploymentBrokerNameUpdate := "broker-petra-2" | ||
bulletTitleName := "title" | ||
bulletTitleNameUpdate := "title-2" | ||
mediaCaption := "Some random minecraft Video" | ||
mediaCaptionUpdate := "Some random minecraft Video 2" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { acc.TestAccPreCheckPartnerCenterSell(t) }, | ||
Providers: acc.TestAccProviders, | ||
CheckDestroy: testAccCheckIbmOnboardingCatalogDeploymentDestroy, | ||
Steps: []resource.TestStep{ | ||
resource.TestStep{ | ||
Config: testAccCheckIbmOnboardingCatalogDeploymentConfig(productID, catalogProductID, catalogPlanID, env, name, active, disabled, kind, objectId), | ||
Config: testAccCheckIbmOnboardingCatalogDeploymentConfig(productID, catalogProductID, catalogPlanID, env, name, active, disabled, kind, objectId, overviewUiEn, rcCompatible, iamCompatible, deploymentBrokerName, bulletTitleName, mediaCaption), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckIbmOnboardingCatalogDeploymentExists("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", conf), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "product_id", productID), | ||
|
@@ -103,10 +115,12 @@ func TestAccIbmOnboardingCatalogDeploymentAllArgs(t *testing.T) { | |
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "active", active), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "disabled", disabled), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "kind", kind), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "overview_ui.en.display_name", overviewUiEn), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "metadata.rc_compatible", rcCompatible), | ||
), | ||
}, | ||
resource.TestStep{ | ||
Config: testAccCheckIbmOnboardingCatalogDeploymentConfig(productID, catalogProductID, catalogPlanID, envUpdate, nameUpdate, activeUpdate, disabledUpdate, kindUpdate, objectId), | ||
Config: testAccCheckIbmOnboardingCatalogDeploymentUpdateConfig(productID, catalogProductID, catalogPlanID, envUpdate, nameUpdate, activeUpdate, disabledUpdate, kindUpdate, objectId, overviewUiEnUpdate, rcCompatibleUpdate, iamCompatibleUpdate, deploymentBrokerNameUpdate, bulletTitleNameUpdate, mediaCaptionUpdate), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "product_id", productID), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "catalog_product_id", catalogProductID), | ||
|
@@ -116,6 +130,8 @@ func TestAccIbmOnboardingCatalogDeploymentAllArgs(t *testing.T) { | |
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "active", activeUpdate), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "disabled", disabledUpdate), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "kind", kindUpdate), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "overview_ui.en.display_name", overviewUiEnUpdate), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_deployment.onboarding_catalog_deployment_instance", "metadata.rc_compatible", rcCompatibleUpdate), | ||
), | ||
}, | ||
resource.TestStep{ | ||
|
@@ -153,11 +169,12 @@ func testAccCheckIbmOnboardingCatalogDeploymentConfigBasic(productID string, cat | |
} | ||
rc_compatible = false | ||
} | ||
} | ||
`, productID, catalogProductID, catalogPlanID, name, active, disabled, kind, objectId) | ||
} | ||
|
||
func testAccCheckIbmOnboardingCatalogDeploymentConfig(productID string, catalogProductID string, catalogPlanID string, env string, name string, active string, disabled string, kind string, objectId string) string { | ||
func testAccCheckIbmOnboardingCatalogDeploymentConfig(productID string, catalogProductID string, catalogPlanID string, env string, name string, active string, disabled string, kind string, objectId string, overviewUiEn string, rcCompatible string, iamCompatible string, deploymentBrokerName string, bulletTitleName string, mediaCaption string) string { | ||
return fmt.Sprintf(` | ||
resource "ibm_onboarding_catalog_deployment" "onboarding_catalog_deployment_instance" { | ||
product_id = "%s" | ||
|
@@ -171,7 +188,7 @@ func testAccCheckIbmOnboardingCatalogDeploymentConfig(productID string, catalogP | |
object_id = "%s" | ||
overview_ui { | ||
en { | ||
display_name = "display_name" | ||
display_name = "%s" | ||
description = "description" | ||
long_description = "long_description" | ||
} | ||
|
@@ -182,27 +199,106 @@ func testAccCheckIbmOnboardingCatalogDeploymentConfig(productID string, catalogP | |
email = "[email protected]" | ||
} | ||
metadata { | ||
rc_compatible = true | ||
rc_compatible = "%s" | ||
service { | ||
rc_provisionable = true | ||
iam_compatible = true | ||
iam_compatible = "%s" | ||
} | ||
deployment { | ||
broker { | ||
name = "%s" | ||
guid = "guid" | ||
} | ||
location = "ams03" | ||
location_url = "https://globalcatalog.test.cloud.ibm.com/api/v1/ams03" | ||
target_crn = "crn:v1:staging:public::ams03:::environment:staging-ams03" | ||
} | ||
ui { | ||
hidden = true | ||
side_by_side_index = 1.0 | ||
strings { | ||
en { | ||
bullets { | ||
title = "%s" | ||
description = "some1" | ||
} | ||
media { | ||
type = "youtube" | ||
url = "https://www.youtube.com/embed/HtkpMgNFYtE" | ||
caption = "%s" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, productID, catalogProductID, catalogPlanID, env, name, active, disabled, kind, objectId, overviewUiEn, rcCompatible, iamCompatible, deploymentBrokerName, bulletTitleName, mediaCaption) | ||
} | ||
|
||
func testAccCheckIbmOnboardingCatalogDeploymentUpdateConfig(productID string, catalogProductID string, catalogPlanID string, env string, name string, active string, disabled string, kind string, objectId string, overviewUiEn string, rcCompatible string, iamCompatible string, deploymentBrokerName string, bulletTitleName string, mediaCaption string) string { | ||
return fmt.Sprintf(` | ||
resource "ibm_onboarding_catalog_deployment" "onboarding_catalog_deployment_instance" { | ||
product_id = "%s" | ||
catalog_product_id = "%s" | ||
catalog_plan_id = "%s" | ||
env = "%s" | ||
name = "%s" | ||
active = %s | ||
disabled = %s | ||
kind = "%s" | ||
object_id = "%s" | ||
overview_ui { | ||
en { | ||
display_name = "%s" | ||
description = "description" | ||
long_description = "long_description" | ||
} | ||
} | ||
tags = ["sample", "moreSample"] | ||
object_provider { | ||
name = "name" | ||
email = "[email protected]" | ||
} | ||
metadata { | ||
rc_compatible = "%s" | ||
service { | ||
rc_provisionable = true | ||
iam_compatible = "%s" | ||
} | ||
deployment { | ||
broker { | ||
name = "broker-petra-1" | ||
name = "%s" | ||
guid = "guid" | ||
} | ||
location = "ams03" | ||
location_url = "https://globalcatalog.test.cloud.ibm.com/api/v1/ams03" | ||
target_crn = "crn:v1:staging:public::ams03:::environment:staging-ams03" | ||
} | ||
ui { | ||
strings { | ||
en { | ||
bullets { | ||
title = "%s" | ||
description = "some1" | ||
} | ||
bullets { | ||
title = "newBullet" | ||
description = "some1" | ||
} | ||
media { | ||
type = "youtube" | ||
url = "https://www.youtube.com/embed/HtkpMgNFYtE" | ||
caption = "%s" | ||
} | ||
media { | ||
type = "youtube" | ||
url = "https://www.youtube.com/embed/HtkpMgNFYtE" | ||
caption = "newMedia" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, productID, catalogProductID, catalogPlanID, env, name, active, disabled, kind, objectId) | ||
`, productID, catalogProductID, catalogPlanID, env, name, active, disabled, kind, objectId, overviewUiEn, rcCompatible, iamCompatible, deploymentBrokerName, bulletTitleName, mediaCaption) | ||
} | ||
|
||
func testAccCheckIbmOnboardingCatalogDeploymentExists(n string, obj partnercentersellv1.GlobalCatalogDeployment) resource.TestCheckFunc { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,14 +81,26 @@ func TestAccIbmOnboardingCatalogPlanAllArgs(t *testing.T) { | |
activeUpdate := "false" | ||
disabledUpdate := "false" | ||
kindUpdate := "plan" | ||
overviewUiEn := "display_name" | ||
overviewUiEnUpdate := "display_name_2" | ||
rcCompatible := "true" | ||
rcCompatibleUpdate := "false" | ||
allowInternalUsers := "true" | ||
allowInternalUsersUpdate := "false" | ||
pricingType := "paid" | ||
pricingTypeUpdate := "free" | ||
bulletTitleName := "title" | ||
bulletTitleNameUpdate := "title-2" | ||
mediaCaption := "Some random minecraft Video" | ||
mediaCaptionUpdate := "Some random minecraft Video 2" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { acc.TestAccPreCheckPartnerCenterSell(t) }, | ||
Providers: acc.TestAccProviders, | ||
CheckDestroy: testAccCheckIbmOnboardingCatalogPlanDestroy, | ||
Steps: []resource.TestStep{ | ||
resource.TestStep{ | ||
Config: testAccCheckIbmOnboardingCatalogPlanConfig(productID, catalogProductID, env, name, active, disabled, kind, objectId), | ||
Config: testAccCheckIbmOnboardingCatalogPlanConfig(productID, catalogProductID, env, name, active, disabled, kind, objectId, overviewUiEn, rcCompatible, pricingType, allowInternalUsers, bulletTitleName, mediaCaption), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckIbmOnboardingCatalogPlanExists("ibm_onboarding_catalog_plan.onboarding_catalog_plan_instance", conf), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_plan.onboarding_catalog_plan_instance", "product_id", productID), | ||
|
@@ -101,7 +113,7 @@ func TestAccIbmOnboardingCatalogPlanAllArgs(t *testing.T) { | |
), | ||
}, | ||
resource.TestStep{ | ||
Config: testAccCheckIbmOnboardingCatalogPlanConfig(productID, catalogProductID, envUpdate, nameUpdate, activeUpdate, disabledUpdate, kindUpdate, objectId), | ||
Config: testAccCheckIbmOnboardingCatalogPlanUpdateConfig(productID, catalogProductID, envUpdate, nameUpdate, activeUpdate, disabledUpdate, kindUpdate, objectId, overviewUiEnUpdate, rcCompatibleUpdate, pricingTypeUpdate, allowInternalUsersUpdate, bulletTitleNameUpdate, mediaCaptionUpdate), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_plan.onboarding_catalog_plan_instance", "product_id", productID), | ||
resource.TestCheckResourceAttr("ibm_onboarding_catalog_plan.onboarding_catalog_plan_instance", "catalog_product_id", catalogProductID), | ||
|
@@ -154,7 +166,7 @@ func testAccCheckIbmOnboardingCatalogPlanConfigBasic(productID string, catalogPr | |
`, productID, catalogProductID, name, active, disabled, kind, objectId) | ||
} | ||
|
||
func testAccCheckIbmOnboardingCatalogPlanConfig(productID string, catalogProductID string, env string, name string, active string, disabled string, kind string, objectId string) string { | ||
func testAccCheckIbmOnboardingCatalogPlanConfig(productID string, catalogProductID string, env string, name string, active string, disabled string, kind string, objectId string, overviewUiEn string, rcCompatible string, pricingType string, allowInternalUsers string, bulletTitleName string, mediaCaption string) string { | ||
return fmt.Sprintf(` | ||
resource "ibm_onboarding_catalog_plan" "onboarding_catalog_plan_instance" { | ||
|
@@ -168,7 +180,7 @@ func testAccCheckIbmOnboardingCatalogPlanConfig(productID string, catalogProduct | |
object_id = "%s" | ||
overview_ui { | ||
en { | ||
display_name = "display_name" | ||
display_name = "%s" | ||
description = "description" | ||
long_description = "long_description" | ||
} | ||
|
@@ -179,18 +191,96 @@ func testAccCheckIbmOnboardingCatalogPlanConfig(productID string, catalogProduct | |
email = "[email protected]" | ||
} | ||
metadata { | ||
rc_compatible = false | ||
rc_compatible = "%s" | ||
pricing { | ||
type = "paid" | ||
type = "%s" | ||
origin = "global_catalog" | ||
} | ||
plan { | ||
allow_internal_users = true | ||
allow_internal_users = "%s" | ||
bindable = false | ||
} | ||
ui { | ||
strings { | ||
en { | ||
bullets { | ||
title = "%s" | ||
description = "some1" | ||
} | ||
media { | ||
type = "youtube" | ||
url = "https://www.youtube.com/embed/HtkpMgNFYtE" | ||
caption = "%s" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, productID, catalogProductID, env, name, active, disabled, kind, objectId, overviewUiEn, rcCompatible, pricingType, allowInternalUsers, bulletTitleName, mediaCaption) | ||
} | ||
|
||
func testAccCheckIbmOnboardingCatalogPlanUpdateConfig(productID string, catalogProductID string, env string, name string, active string, disabled string, kind string, objectId string, overviewUiEn string, rcCompatible string, pricingType string, allowInternalUsers string, bulletTitleName string, mediaCaption string) string { | ||
return fmt.Sprintf(` | ||
resource "ibm_onboarding_catalog_plan" "onboarding_catalog_plan_instance" { | ||
product_id = "%s" | ||
catalog_product_id = "%s" | ||
env = "%s" | ||
name = "%s" | ||
active = %s | ||
disabled = %s | ||
kind = "%s" | ||
object_id = "%s" | ||
overview_ui { | ||
en { | ||
display_name = "%s" | ||
description = "description" | ||
long_description = "long_description" | ||
} | ||
} | ||
tags = ["tag"] | ||
object_provider { | ||
name = "name" | ||
email = "[email protected]" | ||
} | ||
metadata { | ||
rc_compatible = "%s" | ||
pricing { | ||
type = "%s" | ||
origin = "global_catalog" | ||
} | ||
plan { | ||
allow_internal_users = "%s" | ||
bindable = false | ||
} | ||
ui { | ||
strings { | ||
en { | ||
bullets { | ||
title = "%s" | ||
description = "some1" | ||
} | ||
bullets { | ||
title = "newBullet" | ||
description = "some1" | ||
} | ||
media { | ||
type = "youtube" | ||
url = "https://www.youtube.com/embed/HtkpMgNFYtE" | ||
caption = "%s" | ||
} | ||
media { | ||
type = "youtube" | ||
url = "https://www.youtube.com/embed/HtkpMgNFYtE" | ||
caption = "newMedia" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, productID, catalogProductID, env, name, active, disabled, kind, objectId) | ||
`, productID, catalogProductID, env, name, active, disabled, kind, objectId, overviewUiEn, rcCompatible, pricingType, allowInternalUsers, bulletTitleName, mediaCaption) | ||
} | ||
|
||
func testAccCheckIbmOnboardingCatalogPlanExists(n string, obj partnercentersellv1.GlobalCatalogPlan) resource.TestCheckFunc { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.