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

feat: testing-isolation split into prod and dev #3936

Merged
merged 13 commits into from
Jan 9, 2025

Conversation

davidcavazos
Copy link
Contributor

Description

Splitting into two different configs, one for prod and one for dev. The prod config contains all the tests that are consistently passing. The dev config is to run everything else that we're still working on.

The prod config excludes packages that are still not supported. The dev config excludes all the packages passing in the prod config, so it will only run "failing" tests, but that way we can keep iterating on them without blocking PRs.

The workflow got copied for the dev config, the only difference is the config file used and that linting doesn't need to happen on the dev workflow.

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: workflows Issues related to the Workflows API. labels Dec 13, 2024
Copy link
Contributor

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

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

Hi @davidcavazos and reviewers,

I'm currently reviewing this pull request and will post my detailed review in a few minutes. In the meantime, here's a quick summary to help everyone get up to speed:

This PR refactors the testing infrastructure to improve the CI/CD process. The main change is splitting the testing configuration into two separate files: nodejs-prod.jsonc and nodejs-dev.jsonc. nodejs-prod.jsonc includes only consistently passing tests, excluding unsupported packages. nodejs-dev.jsonc runs all other tests, allowing for iterative development without blocking PRs. The CI workflows (ci-prod.yaml and ci-dev.yaml) have been updated to use these respective config files. The ci-dev.yaml workflow also removes linting, as it's not needed for the experimental tests.

Specifically, the changes include:

  • Creation of a new configuration file: .github/config/nodejs-dev.jsonc, which lists packages to exclude from the development testing workflow.
  • Modification of the production configuration file: .github/config/nodejs-prod.jsonc, which now only includes packages that consistently pass tests.
  • Modification of the CI workflows: .github/workflows/ci-dev.yaml and .github/workflows/ci-prod.yaml, to use the new configuration files and adjust the testing process accordingly.

Let me know if you have any questions.


And now, a little haiku to lighten the mood:

Tests split, now we see,
Dev and prod, a clearer path,
Code flows smoothly on.

Copy link
Contributor

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

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

This pull request introduces a good approach to separate production and development tests by creating two distinct config files, nodejs-prod.jsonc and nodejs-dev.jsonc, and corresponding workflows. This allows for isolating consistently passing tests from those still under development, which helps streamline the PR process by preventing failing tests from blocking PRs. The exclusion logic, where the development configuration excludes passing production tests, effectively focuses development efforts on the areas needing attention. However, consider adding more details to the documentation, specifically the README and CONTRIBUTING files, to explain the new setup, how to run tests with each configuration, and how to update the configuration files.

.github/config/nodejs-dev.jsonc Show resolved Hide resolved
.github/workflows/ci-dev.yaml Show resolved Hide resolved
.github/workflows/ci-prod.yaml Show resolved Hide resolved
.github/workflows/ci-prod.yaml Show resolved Hide resolved
@davidcavazos davidcavazos marked this pull request as ready for review December 13, 2024 21:13
@davidcavazos davidcavazos requested review from a team as code owners December 13, 2024 21:13
@davidcavazos
Copy link
Contributor Author

Failing tests are all under "experimental" which are expected.

@davidcavazos
Copy link
Contributor Author

With this, it's safe to disable any workflow that is already covered in prod.

@davidcavazos
Copy link
Contributor Author

The following 13 packages were previously not tested on GitHub Actions, but now they are and tests passing:

  • appengine/hello-world/flexible_nodejs16_and_earlier
  • appengine/metadata/flexible_nodejs16_and_earlier
  • appengine/storage/flexible_nodejs16_and_earlier
  • functions/http/parseXML
  • routeoptimization/snippets
  • run/hello-broken
  • run/helloworld
  • run/image-processing
  • run/jobs
  • run/logging-manual
  • run/markdown-preview/renderer
  • run/pubsub
  • run/websockets

There are currently 122 packages in prod where tests are passing consistently.

There are 52 packages that are currently failing, some of them are parent directories that should actually just be skipped.

Copy link
Contributor

Hello @eddie-santos! I'm Gemini and I'm here to help. Here are some things I can help with via the following comment based commands:

  • @code-review-assist review: Start a code review at the latest commit.
  • @code-review-assist summarize: Summarize the current state of the pull request.
  • @code-review-assist help: Show this message again.
  • @code-review-assist walkthrough: Provide a walkthrough of the repository with respect to the current pull request.

Otherwise you can tag me in a comment via @code-review-assist and I'll do my best to help!

Copy link
Contributor

Gemini encountered an error creating the walkthrough. You can try again by commenting @code-review-assist walkthrough.

@iennae
Copy link
Contributor

iennae commented Dec 20, 2024

@code-review-assist walkthrough

Copy link
Contributor

Gemini encountered an error creating the walkthrough. You can try again by commenting @code-review-assist walkthrough.

@umairidris
Copy link
Member

@code-review-assist walkthrough

Copy link
Contributor

Google Cloud Platform Node.js Samples Walkthrough

This repository contains Node.js code samples for various Google Cloud Platform (GCP) products. The samples are designed to be used with the official GCP documentation and tutorials, providing practical examples of how to interact with different GCP services.

Repository Purpose: The primary goal of this repository is to provide readily usable, well-documented code examples that developers can integrate into their projects. These samples cover a wide range of GCP services, allowing developers to quickly learn and implement GCP functionalities in their Node.js applications.

Repository Structure: The repository is organized into subdirectories, each representing a specific GCP product (e.g., appengine, cloud-sql, functions, compute, etc.). Within each product directory, you'll find further subdirectories containing individual samples, often with separate folders for the sample code itself, unit tests, and integration tests. Many samples also include a README.md file with specific instructions for setup, execution, and deployment.

Code Flow and Execution:

  1. Dependencies: Each sample directory usually has a package.json file listing the necessary Node.js packages. These dependencies are installed using npm install.
  2. Build (if applicable): Some samples, particularly those using TypeScript, require a build step (npm run build) to compile the code into JavaScript before execution.
  3. Execution: Samples are typically run using npm start (or a similar command specified in the package.json file). This often involves setting environment variables to configure the sample with your GCP project credentials and other necessary parameters.
  4. Testing: A significant portion of the repository is dedicated to testing. Unit tests verify the correctness of individual functions, while integration tests ensure that different parts of the sample code work together correctly. Tests are typically run using npm test.
  5. Deployment: Many samples include instructions for deploying them to various GCP environments, such as App Engine, Cloud Run, or Cloud Functions. Deployment commands are usually provided in the sample's README.md file and often involve using the gcloud command-line tool.

Pull Request Impact:

This pull request, "feat: testing-isolation split into prod and dev," introduces a significant change to the repository's testing infrastructure. It aims to improve the efficiency of the CI/CD pipeline by separating the test suite into two configurations: one for production (nodejs-prod.jsonc) and one for development (nodejs-dev.jsonc).

  • Production Configuration: This configuration includes only consistently passing tests and excludes packages that are not yet fully supported.
  • Development Configuration: This configuration runs all other tests, including those that are still under development or are known to be flaky. This allows for continuous iteration on these tests without blocking pull requests.

The pull request also duplicates the CI/CD workflow, creating separate workflows for production and development testing. The development workflow omits the linting step, further streamlining the development process. This approach is generally effective in separating stable and unstable tests, but it's crucial to ensure that the production configuration remains comprehensive enough to catch regressions in the main codebase. Regular review and updates to both configurations will be necessary to maintain their effectiveness.

Additional Notes: The repository utilizes various tools and configurations for code style enforcement (ESLint, Prettier), automated testing (Mocha), and CI/CD (GitHub Actions). Understanding these tools and their configurations is essential for contributing to the repository effectively. The CONTRIBUTING.md file provides detailed guidelines for contributing to the project.

@davidcavazos davidcavazos force-pushed the test-isolation-dev-prod branch from 8d2a19d to 9036fbf Compare December 23, 2024 23:46
@telpirion telpirion self-assigned this Jan 8, 2025
@davidcavazos davidcavazos merged commit 24cf623 into main Jan 9, 2025
137 of 177 checks passed
@davidcavazos davidcavazos deleted the test-isolation-dev-prod branch January 9, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: workflows Issues related to the Workflows API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants