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

Add v2 buf.yaml LintWithWorkspaceTest test cases #215

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

drice-buf
Copy link
Contributor

No description provided.

@drice-buf drice-buf force-pushed the drice/lint_with_workspace_tests_v2 branch from f7805bd to d9a71cc Compare July 29, 2024 16:49
@drice-buf drice-buf force-pushed the drice/lint_with_workspace_tests_v2 branch from d9a71cc to 9f5e9f4 Compare July 29, 2024 17:16
@drice-buf drice-buf marked this pull request as ready for review July 29, 2024 17:35
@drice-buf drice-buf requested a review from jhump July 29, 2024 19:41
andrewparmet
andrewparmet previously approved these changes Jul 29, 2024

@Test
fun `lint a basic correct message with default config v2`() {
super.`lint a basic correct message with default config`()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Heh. Do you have plans to hoist this up into the base test classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would you suggest as a good idiom for two tests that do exactly the same thing but use different resource dirs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I only added a _v2 test for cases that contain a buf.work.yaml file, which are generally the WithWorkspace tests. Accordingly I define these cases only in the leaf classes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is a good idiom for exactly this case. My question was more about: these super tests are also applicable to situations in which ones doesn't use workspaces, and those still run against v1 buf.yamls. Defining these tests in the base classes will allow the test suite to declare it supports v2 configs for each of the three scenarios.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The super function is itself a @Test case that runs against the resource dir that does not end with _v2

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right - and would it also make sense to run v2 tests against a "vanilla" project (i.e., one not using workspaces)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we need to test against every version of Buf CLI - apart from some edge cases which we unfortunately ran into, it is meant to be fully backwards compatible.

@@ -72,7 +72,7 @@ abstract class AbstractBufIntegrationTest : IntegrationTest {
"-PkotlinVersion=1.7.20",
"-PandroidGradleVersion=7.3.0",
)
.withDebug(false) // Enable for interactive debugging
.withDebug(true) // Enable for interactive debugging
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this affect anything if you don't want to debug? E.g. does it let tests run to completion or does it stop and wait for a debugger to attach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, I will put this back, it was just for my own debugging but I like having the explicit set to false to make it easy to see where to set it.

@@ -0,0 +1,3 @@
version: v2
modules:
- path: workspace
Copy link
Collaborator

Choose a reason for hiding this comment

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

For my own understanding - is buf.work.yaml just not a thing anymore in v2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From https://buf.build/docs/configuration/v1/buf-work-yaml:

Buf now has a v2 configuration available, where this file is no longer used.

@drice-buf drice-buf merged commit c274827 into main Jul 29, 2024
8 checks passed
@drice-buf drice-buf deleted the drice/lint_with_workspace_tests_v2 branch July 29, 2024 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants