3434 tmpDir = os .TempDir ()
3535)
3636
37- func BidirectionalConversion (t * testing.T , ignoredFields []string , ignoredAssetFields [] string ) {
37+ func BidirectionalConversion (t * testing.T , ignoredFields []string ) {
3838 testName := t .Name ()
3939 stepNumbers , err := getStepNumbers (testName )
4040 if err != nil {
@@ -77,13 +77,13 @@ func BidirectionalConversion(t *testing.T, ignoredFields []string, ignoredAssetF
7777 tName := fmt .Sprintf ("%s_%s" , testName , subtestName )
7878 if primaryResource != "" {
7979 t .Logf ("Test for the primary resource %s begins." , primaryResource )
80- err = testSingleResource (t , tName , resourceTestData [primaryResource ], tfDir , ignoredFields , ignoredAssetFields , logger , true )
80+ err = testSingleResource (t , tName , resourceTestData [primaryResource ], tfDir , ignoredFields , logger , true )
8181 if err != nil {
8282 return err
8383 }
8484 } else {
8585 for _ , testData := range resourceTestData {
86- err = testSingleResource (t , tName , testData , tfDir , ignoredFields , ignoredAssetFields , logger , false )
86+ err = testSingleResource (t , tName , testData , tfDir , ignoredFields , logger , false )
8787 if err != nil {
8888 return err
8989 }
@@ -110,7 +110,7 @@ func BidirectionalConversion(t *testing.T, ignoredFields []string, ignoredAssetF
110110}
111111
112112// Tests a single resource
113- func testSingleResource (t * testing.T , testName string , testData ResourceTestData , tfDir string , ignoredFields []string , ignoredAssetFields [] string , logger * zap.Logger , primaryResource bool ) error {
113+ func testSingleResource (t * testing.T , testName string , testData ResourceTestData , tfDir string , ignoredFields []string , logger * zap.Logger , primaryResource bool ) error {
114114 resourceType := testData .ResourceType
115115 var tfplan2caiSupported , cai2hclSupported bool
116116 if _ , tfplan2caiSupported = tfplan2caiconverters .ConverterMap [resourceType ]; ! tfplan2caiSupported {
@@ -213,7 +213,7 @@ func testSingleResource(t *testing.T, testName string, testData ResourceTestData
213213
214214 // Convert the export config to roundtrip assets and then convert the roundtrip assets back to roundtrip config
215215 ancestryCache , defaultProject := getAncestryCache (assets )
216- roundtripAssets , roundtripConfigData , err := getRoundtripConfig (t , testName , tfDir , ancestryCache , defaultProject , logger , ignoredAssetFields )
216+ roundtripAssets , roundtripConfigData , err := getRoundtripConfig (t , testName , tfDir , ancestryCache , defaultProject , logger )
217217 if err != nil {
218218 return fmt .Errorf ("error when converting the round-trip config: %#v" , err )
219219 }
@@ -404,7 +404,7 @@ func isIgnored(key string, ignoredFields map[string]any) bool {
404404}
405405
406406// Converts a tfplan to CAI asset, and then converts the CAI asset into HCL
407- func getRoundtripConfig (t * testing.T , testName string , tfDir string , ancestryCache map [string ]string , defaultProject string , logger * zap.Logger , ignoredAssetFields [] string ) ([]caiasset.Asset , []byte , error ) {
407+ func getRoundtripConfig (t * testing.T , testName string , tfDir string , ancestryCache map [string ]string , defaultProject string , logger * zap.Logger ) ([]caiasset.Asset , []byte , error ) {
408408 fileName := fmt .Sprintf ("%s_export" , testName )
409409 roundtripAssetFile := fmt .Sprintf ("%s_roundtrip.json" , testName )
410410
@@ -421,7 +421,6 @@ func getRoundtripConfig(t *testing.T, testName string, tfDir string, ancestryCac
421421 return nil , nil , err
422422 }
423423
424- deleteFieldsFromAssets (roundtripAssetsCopy , ignoredAssetFields )
425424 roundtripConfig , err := cai2hcl .Convert (roundtripAssetsCopy , & cai2hcl.Options {
426425 ErrorLogger : logger ,
427426 })
0 commit comments