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

doc: Updates contributing file with code and test best practices #1666

Merged
merged 4 commits into from
Nov 27, 2023

Conversation

lantoli
Copy link
Member

@lantoli lantoli commented Nov 27, 2023

Description

Jira ticket: INTMDB-1346

Updates contributing file with code and test best practices.

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals, I defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.

Further comments

@lantoli lantoli requested a review from a team as a code owner November 27, 2023 10:32
Copy link
Collaborator

@marcosuma marcosuma left a comment

Choose a reason for hiding this comment

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

LGTM on my side - kindly wait for other team's feedback as well.

Copy link
Member

@AgustinBettati AgustinBettati left a comment

Choose a reason for hiding this comment

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

LGTM, small detail

CONTRIBUTING.md Outdated Show resolved Hide resolved

- Each resource (and associated data sources) is in a package in `internal/service`.
- There can be multiple helper classes and they can also be used from other resources, e.g. `common_advanced_cluster.go` defines functions that are also used from other resources using `advancedcluster.FunctionName`.
- Unit and Acceptances tests are in the same `_test.go` file. They are not in the same package as the code tests, e.g. `advancedcluster` tests are in `advancedcluster_test` package so coupling is minimized.
Copy link
Member

@wtrocki wtrocki Nov 27, 2023

Choose a reason for hiding this comment

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

Format for brevity consider adding chapters:

Suggested change
- Unit and Acceptances tests are in the same `_test.go` file. They are not in the same package as the code tests, e.g. `advancedcluster` tests are in `advancedcluster_test` package so coupling is minimized.
## Code Changes
...
## Unit and Acceptance tests

Contributing is usually focused on guiding new person to do specific tasks.

Instead of

  • Unit and Acceptances tests are in the same _test.go file. They are not in the same package as the code tests, e.g. advancedcluster tests are in advancedcluster_test package so coupling is minimized.

Consider:

Create *_test.go file for both Unit and Acceptance tests.
For example see: link.

Consider reader empathy:

package so coupling is minimized.

do we need that info for the new contributions?

Copy link
Member

Choose a reason for hiding this comment

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

Those aren't blocking PR. Just some nits and CONTRIBUTING.md format tips for future.

Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
lantoli and others added 3 commits November 27, 2023 13:08
Co-authored-by: Andrea Angiolillo <andrea.angiolillo@mongodb.com>
Co-authored-by: Andrea Angiolillo <andrea.angiolillo@mongodb.com>
Co-authored-by: Agustin Bettati <bettatiagustin@gmail.com>
Copy link
Contributor

Code Coverage

Package Line Rate Health
github.com/mongodb/terraform-provider-mongodbatlas/internal/common/conversion 31%
github.com/mongodb/terraform-provider-mongodbatlas/internal/common/validate 68%
github.com/mongodb/terraform-provider-mongodbatlas/internal/provider 5%
github.com/mongodb/terraform-provider-mongodbatlas/internal/service/advancedcluster 3%
github.com/mongodb/terraform-provider-mongodbatlas/internal/service/alertconfiguration 0%
github.com/mongodb/terraform-provider-mongodbatlas/internal/service/atlasuser 0%
github.com/mongodb/terraform-provider-mongodbatlas/internal/service/cluster 1%
github.com/mongodb/terraform-provider-mongodbatlas/internal/service/databaseuser 0%
github.com/mongodb/terraform-provider-mongodbatlas/internal/service/encryptionatrest 0%
github.com/mongodb/terraform-provider-mongodbatlas/internal/service/project 0%
github.com/mongodb/terraform-provider-mongodbatlas/internal/service/projectipaccesslist 0%
github.com/mongodb/terraform-provider-mongodbatlas/internal/service/searchdeployment 23%
github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc 6%
github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas 2%
Summary 3% (315 / 10685)

@lantoli lantoli merged commit 05be678 into master Nov 27, 2023
28 checks passed
@lantoli lantoli deleted the INTMDB-1346_contributing branch November 27, 2023 12:13
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.

None yet

6 participants