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

422 when trying to generate tests for golang code #116

Open
Cyndir opened this issue Nov 7, 2023 · 4 comments
Open

422 when trying to generate tests for golang code #116

Cyndir opened this issue Nov 7, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@Cyndir
Copy link

Cyndir commented Nov 7, 2023

If i try to generate tests for a piece of golang code, I get 422 Unprocessable Content. This occurs through both the codelens decoration and the right click menu. However, highlighting the exact same function and using the chat slash commands successfully generates tests.

func (h HTTPHandler) GetNewAccount(w http.ResponseWriter, r *http.Request, id string) { _, _ = h.service.LegacyService.GetAccount(r.Context(), id, "", true) }

This is a simple snippet that replicates this. Not sure if the implementation of the various levels of structs plays a part, but even defining them with the bare minimum to make this code valid encounters the issue.

@jaapbrasser
Copy link

Hi @Cyndir,

I've tried to replicate your error message, and I could not with the code sample you provided. Could you please provide / try the following:

  • Update the Integration to the latest version, which is 0.7.16 at the time of writing
  • Provide the Request ID of the failed request
  • A screenshot to provide more context, ensure that no confidential information is shown in the screenshot

@Cyndir
Copy link
Author

Cyndir commented Nov 13, 2023

Screenshot 2023-11-13 at 10 49 50 AM
I updated to 0.7.16. I'm not sure where I can get the request ID from, I don't see it in any logs or anything.

In the attached screenshot, if I right click on testfunction and click generate tests, I get the pictured result. Notably, the CodeLens decoration is also missing from the function. If I remove (s userData), the CodeLens reappears and the "Test this function" decoration works as expected.

@almog-lv almog-lv changed the title 422 when trying to generate tests for golang code 422 when trying to generate tests for golang code Dec 19, 2023
@SagiMedina
Copy link

@Cyndir can you please try renaming the function to something without "test" and let us know if it works?

@almog-lv almog-lv added the bug Something isn't working label Dec 19, 2023
@Cyndir
Copy link
Author

Cyndir commented Dec 20, 2023

Trying again on 0.7.26, right clicking and going to CodiumAI -> Generate Tests now functions properly. The CodeLens decoration still does not appear. Renaming the function has no effect, but removing (s UserData) restores the CodeLens buttons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants