Skip to content

Commit

Permalink
Rel updates (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
RutvikS-crest committed Jan 24, 2022
1 parent d50651a commit 69d768d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 45 deletions.
24 changes: 12 additions & 12 deletions testacc/data_source_aci_vzFilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
)

func TestAccAciFilterDataSource_Basic(t *testing.T) {
resourceName := "aci_filter.test"
dataSourceName := "data.aci_filter.test"
randomParameter := acctest.RandStringFromCharSet(5, "abcdefghijklmnopqrstuvwxyz")
resourceName := "aci_filter.test"
dataSourceName := "data.aci_filter.test"
randomParameter := acctest.RandStringFromCharSet(5, "abcdefghijklmnopqrstuvwxyz")
randomValue := acctest.RandString(5)
rName := makeTestVariable(acctest.RandString(5))
resource.ParallelTest(t, resource.TestCase{
Expand All @@ -21,19 +21,19 @@ func TestAccAciFilterDataSource_Basic(t *testing.T) {
CheckDestroy: testAccCheckAciFilterDestroy,
Steps: []resource.TestStep{
{
Config: CreateAccFilterDSWithoutTenant(rName),
ExpectError: regexp.MustCompile(`Missing required argument`),
Config: CreateAccFilterDSWithoutTenant(rName),
ExpectError: regexp.MustCompile(`Missing required argument`),
},
{
Config: CreateAccFilterDSWithoutName(rName),
Config: CreateAccFilterDSWithoutName(rName),
ExpectError: regexp.MustCompile(`Missing required argument`),
},
{
Config: CreateAccFilterConfigDataSource(rName),
Config: CreateAccFilterConfigDataSource(rName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrPair(dataSourceName, "description", resourceName, "description"),
resource.TestCheckResourceAttrPair(dataSourceName, "name_alias", resourceName, "name_alias"),
resource.TestCheckResourceAttrPair(dataSourceName, "annotation", resourceName, "annotation"),
resource.TestCheckResourceAttrPair(dataSourceName, "description", resourceName, "description"),
resource.TestCheckResourceAttrPair(dataSourceName, "name_alias", resourceName, "name_alias"),
resource.TestCheckResourceAttrPair(dataSourceName, "annotation", resourceName, "annotation"),

resource.TestCheckResourceAttrPair(dataSourceName, "tenant_dn", resourceName, "tenant_dn"),
resource.TestCheckResourceAttrPair(dataSourceName, "name", resourceName, "name"),
Expand All @@ -44,8 +44,8 @@ func TestAccAciFilterDataSource_Basic(t *testing.T) {
ExpectError: regexp.MustCompile(`An argument named (.)+ is not expected here.`),
},
{
Config: CreateAccFilterDSWithInvalidName(rName),
ExpectError: regexp.MustCompile(`(.)+ Object may not exists`),
Config: CreateAccFilterDSWithInvalidName(rName),
ExpectError: regexp.MustCompile(`(.)+ Object may not exists`),
},
{
Config: CreateAccFilterDataSourceUpdate(rName, "description", "description"),
Expand Down
4 changes: 2 additions & 2 deletions testacc/resource_aci_fvap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func TestAccAciApplicationProfile_Basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "description", "from terraform"), // comparing description with value which is given in configuration
resource.TestCheckResourceAttr(resourceName, "name_alias", "test_ap"), // comparing name_alias with value which is given in configuration
resource.TestCheckResourceAttr(resourceName, "relation_fv_rs_ap_mon_pol", ""),
resource.TestCheckResourceAttr(resourceName, "annotation", "tag"), // comparing annotation with value which is given in configuration
resource.TestCheckResourceAttr(resourceName, "prio", "level1"), // comparing prio with value which is given in configuration
resource.TestCheckResourceAttr(resourceName, "annotation", "tag"), // comparing annotation with value which is given in configuration
resource.TestCheckResourceAttr(resourceName, "prio", "level1"), // comparing prio with value which is given in configuration
resource.TestCheckResourceAttr(resourceName, "name", rName),
resource.TestCheckResourceAttr(resourceName, "tenant_dn", fmt.Sprintf("uni/tn-%s", rName)),
testAccCheckAciApplicationProfileIdEqual(&application_profile_default, &application_profile_updated), // this function will check whether id or dn of both resource are same or not to make sure updation is performed on the same resource
Expand Down
62 changes: 31 additions & 31 deletions testacc/resource_aci_vzfilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,33 @@ func TestAccAciFilter_Basic(t *testing.T) {
ExpectError: regexp.MustCompile(`Missing required argument`),
},
{
Config: CreateAccFilterConfig(rName),

Config: CreateAccFilterConfig(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAciFilterExists(resourceName, &filter_default),
resource.TestCheckResourceAttr(resourceName, "description", ""),
testAccCheckAciFilterExists(resourceName, &filter_default),
resource.TestCheckResourceAttr(resourceName, "description", ""),
resource.TestCheckResourceAttr(resourceName, "name_alias", ""),
resource.TestCheckResourceAttr(resourceName, "relation_vz_rs_filt_graph_att", ""),
resource.TestCheckResourceAttr(resourceName, "relation_vz_rs_fwd_r_flt_p_att", ""),
resource.TestCheckResourceAttr(resourceName, "relation_vz_rs_rev_r_flt_p_att", ""),
resource.TestCheckResourceAttr(resourceName, "annotation", "orchestrator:terraform"),
resource.TestCheckResourceAttr(resourceName, "relation_vz_rs_rev_r_flt_p_att", ""),
resource.TestCheckResourceAttr(resourceName, "annotation", "orchestrator:terraform"),
resource.TestCheckResourceAttr(resourceName, "name", rName),
resource.TestCheckResourceAttr(resourceName, "tenant_dn", fmt.Sprintf("uni/tn-%s", rName)),
),
},
{
Config: CreateAccFilterConfigWithOptionalValues(rName),
Config: CreateAccFilterConfigWithOptionalValues(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAciFilterExists(resourceName, &filter_updated),
resource.TestCheckResourceAttr(resourceName, "description", "From Terraform"),
resource.TestCheckResourceAttr(resourceName, "name_alias", "alias_filter"),
resource.TestCheckResourceAttr(resourceName, "description", "From Terraform"),
resource.TestCheckResourceAttr(resourceName, "name_alias", "alias_filter"),
resource.TestCheckResourceAttr(resourceName, "annotation", "tag_filter"),
resource.TestCheckResourceAttr(resourceName, "relation_vz_rs_filt_graph_att", ""),
resource.TestCheckResourceAttr(resourceName, "relation_vz_rs_fwd_r_flt_p_att", ""),
resource.TestCheckResourceAttr(resourceName, "relation_vz_rs_rev_r_flt_p_att", ""),
resource.TestCheckResourceAttr(resourceName, "name", rName),
resource.TestCheckResourceAttr(resourceName, "tenant_dn", fmt.Sprintf("uni/tn-%s", rName)),
testAccCheckAciFilterIdEqual(&filter_default, &filter_updated),
resource.TestCheckResourceAttr(resourceName, "tenant_dn", fmt.Sprintf("uni/tn-%s", rName)),
testAccCheckAciFilterIdEqual(&filter_default, &filter_updated),
),
},
{
Expand All @@ -75,28 +75,28 @@ func TestAccAciFilter_Basic(t *testing.T) {
ExpectError: regexp.MustCompile(`Missing required argument`),
},
{
Config: CreateAccFilterConfigUpdatedName(rName, longrName),
Config: CreateAccFilterConfigUpdatedName(rName, longrName),
ExpectError: regexp.MustCompile(fmt.Sprintf("property name of flt-%s failed validation for value '%s'", longrName, longrName)),
},
{
Config: CreateAccFilterConfigWithParentAndName(rName, rOther),
Config: CreateAccFilterConfigWithParentAndName(rName, rOther),
Check: resource.ComposeTestCheckFunc(
testAccCheckAciFilterExists(resourceName, &filter_updated),
resource.TestCheckResourceAttr(resourceName, "name", rOther),
resource.TestCheckResourceAttr(resourceName, "tenant_dn", fmt.Sprintf("uni/tn-%s", rName)),
testAccCheckAciFilterIdNotEqual(&filter_default, &filter_updated),
resource.TestCheckResourceAttr(resourceName, "name", rOther),
resource.TestCheckResourceAttr(resourceName, "tenant_dn", fmt.Sprintf("uni/tn-%s", rName)),
testAccCheckAciFilterIdNotEqual(&filter_default, &filter_updated),
),
},
{
Config: CreateAccFilterConfig(rName),
Config: CreateAccFilterConfig(rName),
},
{
Config: CreateAccFilterConfigWithParentAndName(prOther, rName),
Config: CreateAccFilterConfigWithParentAndName(prOther, rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAciFilterExists(resourceName, &filter_updated),
resource.TestCheckResourceAttr(resourceName, "name", rName),
resource.TestCheckResourceAttr(resourceName, "tenant_dn", fmt.Sprintf("uni/tn-%s", prOther)),
testAccCheckAciFilterIdNotEqual(&filter_default, &filter_updated),
testAccCheckAciFilterIdNotEqual(&filter_default, &filter_updated),
),
},
},
Expand All @@ -106,41 +106,41 @@ func TestAccAciFilter_Basic(t *testing.T) {

func TestAccFilter_NegativeCases(t *testing.T) {
rName := makeTestVariable(acctest.RandString(5))
longDescAnnotation := acctest.RandString(129)
longNameAlias := acctest.RandString(64)
randomParameter := acctest.RandStringFromCharSet(5, "abcdefghijklmnopqrstuvwxyz")
randomValue := acctest.RandString(5)
longDescAnnotation := acctest.RandString(129)
longNameAlias := acctest.RandString(64)
randomParameter := acctest.RandStringFromCharSet(5, "abcdefghijklmnopqrstuvwxyz")
randomValue := acctest.RandString(5)
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAciFilterDestroy,
Steps: []resource.TestStep{
{
Config: CreateAccFilterConfig(rName),
Config: CreateAccFilterConfig(rName),
},
{
Config: CreateAccFilterWithInValidTenantDn(rName),
ExpectError: regexp.MustCompile(`unknown property value (.)+, name dn, class vzFilter (.)+`),
Config: CreateAccFilterWithInValidTenantDn(rName),
ExpectError: regexp.MustCompile(`unknown property value (.)+, name dn, class vzFilter (.)+`),
},
{
Config: CreateAccFilterUpdatedAttr(rName, "description", longDescAnnotation),
Config: CreateAccFilterUpdatedAttr(rName, "description", longDescAnnotation),
ExpectError: regexp.MustCompile(`property descr of (.)+ failed validation for value '(.)+'`),
},
{
Config: CreateAccFilterUpdatedAttr(rName, "annotation", longDescAnnotation),
Config: CreateAccFilterUpdatedAttr(rName, "annotation", longDescAnnotation),
ExpectError: regexp.MustCompile(`property annotation of (.)+ failed validation for value '(.)+'`),
},
{
Config: CreateAccFilterUpdatedAttr(rName, "name_alias", longNameAlias),
Config: CreateAccFilterUpdatedAttr(rName, "name_alias", longNameAlias),
ExpectError: regexp.MustCompile(`property nameAlias of (.)+ failed validation for value '(.)+'`),
},

{
Config: CreateAccFilterUpdatedAttr(rName, randomParameter, randomValue),
Config: CreateAccFilterUpdatedAttr(rName, randomParameter, randomValue),
ExpectError: regexp.MustCompile(`An argument named (.)+ is not expected here.`),
},
{
Config: CreateAccFilterConfig(rName),
Config: CreateAccFilterConfig(rName),
},
},
})
Expand Down

0 comments on commit 69d768d

Please sign in to comment.