Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail on Windows when Repo setup in Windows filesystem before starting Devcontainer. #7121

Closed
1 task done
jhandel opened this issue Feb 2, 2024 · 3 comments · Fixed by #7134
Closed
1 task done
Labels
bug Something is broken or not working as expected triaged This issue has been reviewed and triaged

Comments

@jhandel
Copy link
Contributor

jhandel commented Feb 2, 2024

Steps to reproduce

Pull source code from GH client in Windows cmd (or GH desktop).
Start Devcontainer using VS Code Devcontainer extension
Run make build
Run make test

tests that rely on comparing sample files (like terraform recipe tests) fail due to test files being checked out with LFCR (\r\n) but tests expecting only LF (\n)

Observed behavior

Example results from terraform test.

expected  : &terraform.moduleInspectResult{ContextVarExists:true, RequiredProviders:[]string{"aws"}, ResultOutputExists:true, Parameters:map[string]interface {}{"context":map[string]interface {}{"defaultValue":interface {}(nil), "description":"This variable contains Radius recipe context.", "name":"context", "pos":tfconfig.SourcePos{Filename:"testdata/.terraform/modules/test-module-recipe-context-outputs/variables.tf", Line:1}, "required":true, "sensitive":false, "type":"object({\n    resource = object({\n      name = string\n      id = string\n      type = string\n    })\n\n    application = object({\n      name = string\n      id = string\n    })\n\n    environment = object({\n      name = string\n      id = string\n    })\n\n    runtime = object({\n      kubernetes = optional(object({\n        namespace = string\n        environmentNamespace = string\n      }))\n    })\n\n    azure = optional(object({\n      resourceGroup = object({\n        name = string\n        id = string\n      })\n      subscription = object({\n        subscriptionId = string\n        id = string\n      })\n    }))\n    \n    aws = optional(object({\n      region = string\n      account = string\n    }))\n  })"}}}
actual  : &terraform.moduleInspectResult{ContextVarExists:true, RequiredProviders:[]string{"aws"}, ResultOutputExists:true, Parameters:map[string]interface {}{"context":map[string]interface {}{"defaultValue":interface {}(nil), "description":"This variable contains Radius recipe context.", "name":"context", "pos":tfconfig.SourcePos{Filename:"testdata/.terraform/modules/test-module-recipe-context-outputs/variables.tf", Line:1}, "required":true, "sensitive":false, "type":"object({\r\n    resource = object({\r\n      name = string\r\n      id = string\r\n      type = string\r\n    })\r\n\r\n    application = object({\r\n      name = string\r\n      id = string\r\n    })\r\n\r\n    environment = object({\r\n      name = string\r\n      id = string\r\n    })\r\n\r\n    runtime = object({\r\n      kubernetes = optional(object({\r\n        namespace = string\r\n        environmentNamespace = string\r\n      }))\r\n    })\r\n\r\n    azure = optional(object({\r\n      resourceGroup = object({\r\n        name = string\r\n        id = string\r\n      })\r\n      subscription = object({\r\n        subscriptionId = string\r\n        id = string\r\n      })\r\n    }))\r\n    \r\n    aws = optional(object({\r\n      region = string\r\n      account = string\r\n    }))\r\n  })"}}}

Desired behavior

working tests pass.

Workaround

add .gitattributes

*.tf text eol=lf
*.json text eol=lf
*.yaml text eol=lf

to the following folders:

  • pkg/corperp/renderers/containers/testdata
  • pkg/recipes/terraform/config/testdata
  • pkg/recipes/terraform/testdata/.terraform/modules

rad Version

v0.30.0-rc3-2-g2e4d2ed

Operating system

Windows 11 with WSL 2 and Docker Desktop running the Devcontainer from the solution.

Additional context

No response

Would you like to support us?

  • Yes, I would like to support you

AB#11104

@jhandel jhandel added the bug Something is broken or not working as expected label Feb 2, 2024
@radius-triage-bot
Copy link

👋 @jhandel Thanks for filing this bug report.

A project maintainer will review this report and get back to you soon. If you'd like immediate help troubleshooting, please visit our Discord server.

For more information on our triage process please visit our triage overview

@radius-triage-bot
Copy link

👍 We've reviewed this issue and have agreed to add it to our backlog. Please subscribe to this issue for notifications, we'll provide updates when we pick it up.

We also welcome community contributions! If you would like to pick this item up sooner and submit a pull request, please visit our contribution guidelines and assign this to yourself by commenting "/assign" on this issue.

For more information on our triage process please visit our triage overview

@nicolejms
Copy link
Contributor

There is open PR associated with this so may be fixed once merged.

willdavsmith pushed a commit to willdavsmith/radius that referenced this issue Mar 4, 2024
…ly qualified names (also make life a little better for windows file system contributors) (radius-project#7134)

# Description

Updated clivalidation.RequireResourceType so that it can take either
fully qualified names or short names.. and if a short name is used and
there are duplicate short names display the list of matching short
names.

I also added a .gitattributes to the following folders so that their
test files would maintain lf line ends instead of crlf line ends when
cloned or pulled into a windows filesystem.

* pkg/corperp/renderers/containers/testdata
* pkg/recipes/terraform/config/testdata
* pkg/recipes/terraform/testdata/.terraform/modules


## Type of change

This pull request fixes a bug in Radius and has an approved issue 

Fixes: radius-project#7070

This pull request fixes a bug in Radius but its not an approved issue

Fixes:  radius-project#7121

---------

Signed-off-by: Josh <[email protected]>
willdavsmith pushed a commit to willdavsmith/radius that referenced this issue Apr 8, 2024
…ly qualified names (also make life a little better for windows file system contributors) (radius-project#7134)

# Description

Updated clivalidation.RequireResourceType so that it can take either
fully qualified names or short names.. and if a short name is used and
there are duplicate short names display the list of matching short
names.

I also added a .gitattributes to the following folders so that their
test files would maintain lf line ends instead of crlf line ends when
cloned or pulled into a windows filesystem.

* pkg/corperp/renderers/containers/testdata
* pkg/recipes/terraform/config/testdata
* pkg/recipes/terraform/testdata/.terraform/modules

## Type of change

This pull request fixes a bug in Radius and has an approved issue

Fixes: radius-project#7070

This pull request fixes a bug in Radius but its not an approved issue

Fixes:  radius-project#7121

---------

Signed-off-by: Josh <[email protected]>
Signed-off-by: willdavsmith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken or not working as expected triaged This issue has been reviewed and triaged
Projects
None yet
2 participants