add metadata test and acc test

main
Martin Guibert 2021-11-10 14:07:31 +01:00
parent d498ee9973
commit ed405dfbcd
No known key found for this signature in database
GPG Key ID: 990E40316943BAA6
4 changed files with 88 additions and 19 deletions

View File

@ -0,0 +1,30 @@
package azurerm_test
import (
"testing"
"github.com/cloudskiff/driftctl/test"
"github.com/cloudskiff/driftctl/test/acceptance"
)
func TestAcc_Azure_PrivateDNSCNAMERecord(t *testing.T) {
acceptance.Run(t, acceptance.AccTestCase{
TerraformVersion: "0.15.5",
Paths: []string{"./testdata/acc/azurerm_private_dns_cname_record"},
Args: []string{
"scan",
"--to", "azure+tf", "--deep",
},
Checks: []acceptance.AccCheck{
{
Check: func(result *test.ScanResult, stdout string, err error) {
if err != nil {
t.Fatal(err)
}
result.AssertInfrastructureIsInSync()
result.AssertManagedCount(2)
},
},
},
})
}

View File

@ -11,25 +11,26 @@ import (
func TestAzureMetadata_Flags(t *testing.T) {
testcases := map[string][]resource.Flags{
AzureContainerRegistryResourceType: {},
AzureFirewallResourceType: {},
AzurePostgresqlServerResourceType: {},
AzurePostgresqlDatabaseResourceType: {},
AzurePublicIPResourceType: {},
AzureResourceGroupResourceType: {},
AzureRouteResourceType: {},
AzureRouteTableResourceType: {},
AzureStorageAccountResourceType: {},
AzureStorageContainerResourceType: {},
AzureSubnetResourceType: {},
AzureVirtualNetworkResourceType: {},
AzureNetworkSecurityGroupResourceType: {resource.FlagDeepMode},
AzureLoadBalancerResourceType: {},
AzurePrivateDNSZoneResourceType: {resource.FlagDeepMode},
AzurePrivateDNSARecordResourceType: {resource.FlagDeepMode},
AzurePrivateDNSAAAARecordResourceType: {resource.FlagDeepMode},
AzureImageResourceType: {},
AzureSSHPublicKeyResourceType: {resource.FlagDeepMode},
AzureContainerRegistryResourceType: {},
AzureFirewallResourceType: {},
AzurePostgresqlServerResourceType: {},
AzurePostgresqlDatabaseResourceType: {},
AzurePublicIPResourceType: {},
AzureResourceGroupResourceType: {},
AzureRouteResourceType: {},
AzureRouteTableResourceType: {},
AzureStorageAccountResourceType: {},
AzureStorageContainerResourceType: {},
AzureSubnetResourceType: {},
AzureVirtualNetworkResourceType: {},
AzureNetworkSecurityGroupResourceType: {resource.FlagDeepMode},
AzureLoadBalancerResourceType: {},
AzurePrivateDNSZoneResourceType: {resource.FlagDeepMode},
AzurePrivateDNSARecordResourceType: {resource.FlagDeepMode},
AzurePrivateDNSAAAARecordResourceType: {resource.FlagDeepMode},
AzurePrivateDNSCNameRecordResourceType: {resource.FlagDeepMode},
AzureImageResourceType: {},
AzureSSHPublicKeyResourceType: {resource.FlagDeepMode},
}
schemaRepository := testresource.InitFakeSchemaRepository(tf.AZURE, "2.71.0")

View File

@ -0,0 +1,2 @@
*
!azurerm_private_dns_cname_record

View File

@ -0,0 +1,36 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.71.0"
}
}
}
provider "azurerm" {
features {}
}
data "azurerm_resource_group" "example" {
name = "driftctl-qa-1"
}
resource "azurerm_private_dns_zone" "testzone" {
name = "this-zone-is-a-test-for-driftctl.com"
resource_group_name = data.azurerm_resource_group.example.name
}
resource "azurerm_private_dns_cname_record" "othertestcname" {
name = "othertest"
zone_name = azurerm_private_dns_zone.testzone.name
resource_group_name = data.azurerm_resource_group.example.name
ttl = 300
record = "othertest.com"
}
resource "azurerm_private_dns_cname_record" "testcname" {
name = "test"
zone_name = azurerm_private_dns_zone.testzone.name
resource_group_name = data.azurerm_resource_group.example.name
ttl = 300
record = "test.com"
}