diff --git a/pkg/remote/google/repository/asset_test.go b/pkg/remote/google/repository/asset_test.go index 29211049..03e16444 100644 --- a/pkg/remote/google/repository/asset_test.go +++ b/pkg/remote/google/repository/asset_test.go @@ -25,7 +25,7 @@ func Test_assetRepository_searchAllResources_CacheHit(t *testing.T) { } c := &cache.MockCache{} - c.On("Get", "googleSearchAllResources").Return(expectedResults).Times(1) + c.On("Get", "SearchAllResources").Return(expectedResults).Times(1) repo := NewAssetRepository(nil, config.GCPTerraformConfig{Project: ""}, c) got, err := repo.searchAllResources("google_fake_type") @@ -51,8 +51,8 @@ func Test_assetRepository_searchAllResources_CacheMiss(t *testing.T) { t.Fatal(err) } c := &cache.MockCache{} - c.On("Get", "googleSearchAllResources").Return(nil).Times(1) - c.On("Put", "googleSearchAllResources", mock.IsType([]*assetpb.ResourceSearchResult{})).Return(false).Times(1) + c.On("Get", "SearchAllResources").Return(nil).Times(1) + c.On("Put", "SearchAllResources", mock.IsType([]*assetpb.ResourceSearchResult{})).Return(false).Times(1) repo := NewAssetRepository(assetClient, config.GCPTerraformConfig{Project: ""}, c) got, err := repo.searchAllResources("google_fake_type") diff --git a/pkg/remote/google_compute_scanner_test.go b/pkg/remote/google_compute_scanner_test.go index 4bb39203..482ac216 100644 --- a/pkg/remote/google_compute_scanner_test.go +++ b/pkg/remote/google_compute_scanner_test.go @@ -1,10 +1,8 @@ package remote import ( - "context" "testing" - asset "cloud.google.com/go/asset/apiv1" "github.com/cloudskiff/driftctl/mocks" "github.com/cloudskiff/driftctl/pkg/filter" "github.com/cloudskiff/driftctl/pkg/remote/alerts" @@ -460,13 +458,9 @@ func TestGoogleComputeNetwork(t *testing.T) { c.setupAlerterMock(alerter) } - var assetClient *asset.Client - if !shouldUpdate { - var err error - assetClient, err = testgoogle.NewFakeAssetServer(c.response, c.responseErr) - if err != nil { - tt.Fatal(err) - } + assetClient, err := testgoogle.NewFakeAssetServer(c.response, c.responseErr) + if err != nil { + tt.Fatal(err) } realProvider, err := terraform2.InitTestGoogleProvider(providerLibrary, providerVersion) @@ -478,11 +472,6 @@ func TestGoogleComputeNetwork(t *testing.T) { // Replace mock by real resources if we are in update mode if shouldUpdate { - ctx := context.Background() - assetClient, err = asset.NewClient(ctx) - if err != nil { - tt.Fatal(err) - } err = realProvider.Init() if err != nil { tt.Fatal(err) diff --git a/pkg/resource/google/google_compute_network.go b/pkg/resource/google/google_compute_network.go index e8706dde..0421af26 100644 --- a/pkg/resource/google/google_compute_network.go +++ b/pkg/resource/google/google_compute_network.go @@ -9,6 +9,7 @@ func initGoogleComputeNetworkMetadata(resourceSchemaRepository resource.SchemaRe res.Attributes().SafeDelete([]string{"timeouts"}) res.Attributes().SafeDelete([]string{"self_link"}) res.Attributes().SafeDelete([]string{"gateway_ipv4"}) + res.Attributes().SafeDelete([]string{"delete_default_routes_on_create"}) }) resourceSchemaRepository.SetResolveReadAttributesFunc(GoogleComputeNetworkResourceType, func(res *resource.Resource) map[string]string { return map[string]string{ diff --git a/pkg/resource/google/google_compute_network_test.go b/pkg/resource/google/google_compute_network_test.go index 112ff9bb..4cb475f6 100644 --- a/pkg/resource/google/google_compute_network_test.go +++ b/pkg/resource/google/google_compute_network_test.go @@ -15,6 +15,7 @@ func TestAcc_Google_ComputeNetwork(t *testing.T) { "scan", "--to", "gcp+tf", "--filter", "Type=='google_compute_network'", + "--deep", }, Checks: []acceptance.AccCheck{ { @@ -24,6 +25,7 @@ func TestAcc_Google_ComputeNetwork(t *testing.T) { } result.AssertInfrastructureIsInSync() result.AssertManagedCount(3) + result.AssertDriftCountTotal(0) }, }, },