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

chore(docs): move coder_parameter example #243

Merged
merged 11 commits into from
Jun 25, 2024
Merged

Conversation

stirby
Copy link
Contributor

@stirby stirby commented Jun 24, 2024

The coder_parameter data-source's code example was in the resources directory by mistake, moved.

Fixes #242.


Curious what the failed examples_test.go looks like so intentionally ignored.

@stirby stirby requested a review from mtojek June 24, 2024 20:04
@stirby
Copy link
Contributor Author

stirby commented Jun 24, 2024

@mtojek I removed the coder_parameter test from examples_test.go since that test targets resources specifically.

I find it interesting that the only two resources which don't generate code examples in the docs are prefixed with the provider.

Since coder_workspace_tags is in the correct directory, the problem may be deeper than a pathing issue.

I couldn't find any errors in the output of make gen's tfplugindocs call:

...
generating missing resource content
generating new template for "coder_app"
...
generating missing data source content
...
generating new template for data-source "coder_workspace_owner"
generating new template for data-source "coder_workspace_tags"
...
generating new template for data-source "coder_parameter"
generating missing function content
generating missing provider content
...

I also tried to add other resources to the examples_test.go, each of which failed.


All this said, I would actually like to take a stab at rewriting the examples_test.go. My fear is that the tests only pass with inclusion of the provider, which prevents the docs from correctly generating.

Mind taking a look?

@stirby
Copy link
Contributor Author

stirby commented Jun 24, 2024

For now, lazily duplicated resource examples test loop for data sources to test.

@mtojek
Copy link
Member

mtojek commented Jun 25, 2024

Alright, I think I made the CI happy now. coder_parameter and coder_workspace_tags are in data-sources now, and examples_test.go is validating them.

I also tried to add other resources to the examples_test.go, each of which failed.

This may not be straightforward if examples depend on external fields or providers. For instance: coder_agent_instance uses google_compute_instance and we do not import gcp module.

EDIT:

Let me know if this is ready to review, and I will re-check everything 👍

@stirby
Copy link
Contributor Author

stirby commented Jun 25, 2024

I did some reading of other providers. Rarely do code examples reference other providers but it feels essential for our examples like coder_agent. I think we could revisit extending the testing someday but full coverage is not critical right now.

I think this is ready for your review.

Edit: trying one more thing.

@stirby
Copy link
Contributor Author

stirby commented Jun 25, 2024

Ended up over complicating. Should be good for your review.

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@stirby stirby merged commit b73066b into main Jun 25, 2024
12 checks passed
@stirby stirby deleted the coder-parameter-example branch June 25, 2024 21:48
@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code example not consumed in docs generation
2 participants