[PR #1799] [MERGED] simplify integration testing with matrix jobs #2323

Closed
opened 2025-12-29 03:20:46 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/1799
Author: @vdovhanych
Created: 2/29/2024
Status: Merged
Merged: 3/2/2024
Merged by: @kradalby

Base: mainHead: github-workflows-improvements


📝 Commits (2)

  • c15d6a6 simplify integration testing with matrix jobs
  • 90d7b8a check if all of the integration tests are in the test-integration workflow

📊 Changes

96 files changed (+180 additions, -6400 deletions)

View changed files

.github/workflows/check-tests.yaml (+41 -0)
.github/workflows/test-integration-v2-TestACLAllowStarDst-postgres.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLAllowStarDst.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLAllowUser80Dst-postgres.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLAllowUser80Dst.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLAllowUserDst-postgres.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLAllowUserDst.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLDenyAllPort80-postgres.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLDenyAllPort80.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLDevice1CanAccessDevice2-postgres.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLDevice1CanAccessDevice2.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLHostsInNetMapTable-postgres.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLHostsInNetMapTable.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLNamedHostsCanReach-postgres.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLNamedHostsCanReach.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLNamedHostsCanReachBySubnet-postgres.yaml (+0 -68)
.github/workflows/test-integration-v2-TestACLNamedHostsCanReachBySubnet.yaml (+0 -68)
.github/workflows/test-integration-v2-TestApiKeyCommand-postgres.yaml (+0 -68)
.github/workflows/test-integration-v2-TestApiKeyCommand.yaml (+0 -68)
.github/workflows/test-integration-v2-TestAuthKeyLogoutAndRelogin-postgres.yaml (+0 -68)

...and 76 more files

📄 Description

This PR significantly reduces the number of integration test workflow files. I modified the setup to use the GitHub matrix strategy instead of having 90+ generated workflow files.

I also tried to keep the original go script that generated the workflow files, but now, instead of generating whole workflow files, it adds test names to a matrix strategy. This, in turn, improves readability and updates to the test structure.

This will spawn a job for every combination, so if we fe. have TestACLHostsInNetMapTable and database: [postgres, sqlite] for the matrix strategy, this will create two jobs

(TestACLHostsInNetMapTable, postgres)
(TestACLHostsInNetMapTable, sqlite)

Screenshot 2024-02-29 at 19 05 14

Or see how it will look in the PR for the already run tests.

Caveats to this setup:

  • requires you to have yq installed so you can generate test names for the workflow
  • yq will remove the empty line formatting from the GitHub file, so either fix it manually or commit it with those changes (it does not affect the functionality, but it's not as convenient to read as the current formatting)
  • the naming of the test is not that clear but can be improved to reflect better what it does( especially in regards to 0 or 1 for the usage of postgres)

I have checked that the failing tests are not connected to this change. The same issues are currently present with the previous setup.

  • read the CONTRIBUTING guidelines
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/1799 **Author:** [@vdovhanych](https://github.com/vdovhanych) **Created:** 2/29/2024 **Status:** ✅ Merged **Merged:** 3/2/2024 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `github-workflows-improvements` --- ### 📝 Commits (2) - [`c15d6a6`](https://github.com/juanfont/headscale/commit/c15d6a653045a5e0be003502b6f03f0637d3353e) simplify integration testing with matrix jobs - [`90d7b8a`](https://github.com/juanfont/headscale/commit/90d7b8abcff98cbef4033a3243f0d41ff287cbf9) check if all of the integration tests are in the test-integration workflow ### 📊 Changes **96 files changed** (+180 additions, -6400 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/check-tests.yaml` (+41 -0) ➖ `.github/workflows/test-integration-v2-TestACLAllowStarDst-postgres.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLAllowStarDst.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLAllowUser80Dst-postgres.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLAllowUser80Dst.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLAllowUserDst-postgres.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLAllowUserDst.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLDenyAllPort80-postgres.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLDenyAllPort80.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLDevice1CanAccessDevice2-postgres.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLDevice1CanAccessDevice2.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLHostsInNetMapTable-postgres.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLHostsInNetMapTable.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLNamedHostsCanReach-postgres.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLNamedHostsCanReach.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLNamedHostsCanReachBySubnet-postgres.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestACLNamedHostsCanReachBySubnet.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestApiKeyCommand-postgres.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestApiKeyCommand.yaml` (+0 -68) ➖ `.github/workflows/test-integration-v2-TestAuthKeyLogoutAndRelogin-postgres.yaml` (+0 -68) _...and 76 more files_ </details> ### 📄 Description <!-- Headscale is "Open Source, acknowledged contribution", this means that any contribution will have to be discussed with the Maintainers before being submitted. This model has been chosen to reduce the risk of burnout by limiting the maintenance overhead of reviewing and validating third-party code. Headscale is open to code contributions for bug fixes without discussion. If you find mistakes in the documentation, please submit a fix to the documentation. --> This PR significantly reduces the number of integration test workflow files. I modified the setup to use the GitHub matrix strategy instead of having 90+ generated workflow files. I also tried to keep the original go script that generated the workflow files, but now, instead of generating whole workflow files, it adds test names to a matrix strategy. This, in turn, improves readability and updates to the test structure. This will spawn a job for every combination, so if we fe. have `TestACLHostsInNetMapTable` and `database: [postgres, sqlite]` for the matrix strategy, this will create two jobs ``` (TestACLHostsInNetMapTable, postgres) (TestACLHostsInNetMapTable, sqlite) ``` ![Screenshot 2024-02-29 at 19 05 14](https://github.com/juanfont/headscale/assets/45185420/9f008b7d-92c1-4689-871a-bff554071c44) Or see how it will look in the PR for the already run tests. Caveats to this setup: - requires you to have yq installed so you can generate test names for the workflow - yq will remove the empty line formatting from the GitHub file, so either fix it manually or commit it with those changes (it does not affect the functionality, but it's not as convenient to read as the current formatting) - the naming of the test is not that clear but can be improved to reflect better what it does( especially in regards to 0 or 1 for the usage of postgres) I have checked that the failing tests are not connected to this change. The same issues are currently present with the previous setup. <!-- Please tick if the following things apply. You… --> - [x] read the [CONTRIBUTING guidelines](README.md#contributing) - [ ] raised a GitHub issue or discussed it on the projects chat beforehand - [ ] added unit tests - [ ] added integration tests - [ ] updated documentation if needed - [ ] updated CHANGELOG.md <!-- If applicable, please reference the issue using `Fixes #XXX` and add tests to cover your new code. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 03:20:46 +01:00
adam closed this issue 2025-12-29 03:20:46 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2323