// Code generated by "gen/generator.go"; DO NOT EDIT.
// In order to regenerate this file execute `go generate` from the repository root.
// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md).

package provider

import (
	"regexp"
	"testing"

	"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)

func TestAccDataSourceFvRsConsWithFvAEPg(t *testing.T) {

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "both", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			{
				Config:             testConfigFvRsConsDataSourceDependencyWithFvAEPg,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("data.aci_relation_to_consumed_contract.test", "contract_name", "test_tn_vz_br_cp_name"),
					resource.TestCheckResourceAttr("data.aci_relation_to_consumed_contract.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("data.aci_relation_to_consumed_contract.test", "priority", "unspecified"),
				),
			},
			{
				Config:      testConfigFvRsConsNotExistingFvAEPg,
				ExpectError: regexp.MustCompile("Failed to read aci_relation_to_consumed_contract data source"),
			},
		},
	})
}
func TestAccDataSourceFvRsConsWithFvESg(t *testing.T) {

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "both", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			{
				Config:             testConfigFvRsConsDataSourceDependencyWithFvESg,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("data.aci_relation_to_consumed_contract.test", "contract_name", "test_tn_vz_br_cp_name"),
					resource.TestCheckResourceAttr("data.aci_relation_to_consumed_contract.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("data.aci_relation_to_consumed_contract.test", "priority", "unspecified"),
				),
			},
			{
				Config:      testConfigFvRsConsNotExistingFvESg,
				ExpectError: regexp.MustCompile("Failed to read aci_relation_to_consumed_contract data source"),
			},
		},
	})
}

const testConfigFvRsConsDataSourceDependencyWithFvAEPg = testConfigFvRsConsMinDependencyWithFvAEPg + `
data "aci_relation_to_consumed_contract" "test" {
  parent_dn = aci_application_epg.test.id
  contract_name = "test_tn_vz_br_cp_name"
  depends_on = [aci_relation_to_consumed_contract.test]
}
`

const testConfigFvRsConsNotExistingFvAEPg = testConfigFvAEPgMinDependencyWithFvAp + `
data "aci_relation_to_consumed_contract" "test_non_existing" {
  parent_dn = aci_application_epg.test.id
  contract_name = "non_existing_tn_vz_br_cp_name"
}
`
const testConfigFvRsConsDataSourceDependencyWithFvESg = testConfigFvRsConsMinDependencyWithFvESg + `
data "aci_relation_to_consumed_contract" "test" {
  parent_dn = aci_endpoint_security_group.test.id
  contract_name = "test_tn_vz_br_cp_name"
  depends_on = [aci_relation_to_consumed_contract.test]
}
`

const testConfigFvRsConsNotExistingFvESg = testConfigFvESgMinDependencyWithFvAp + `
data "aci_relation_to_consumed_contract" "test_non_existing" {
  parent_dn = aci_endpoint_security_group.test.id
  contract_name = "non_existing_tn_vz_br_cp_name"
}
`
