[PR #2936] [MERGED] [management] Add integration test for the setup-keys API endpoints #15849

Closed
opened 2026-08-05 03:08:32 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/2936
Author: @pascal-fischer
Created: 11/22/2024
Status: Merged
Merged: 1/2/2025
Merged by: @pascal-fischer

Base: mainHead: test/add-api-component-test


📝 Commits (10+)

  • 832e168 refactor jwtValidator and geo db to interfaces + first component test for setup-keys
  • 72157b5 unexport event store and add peerUpdateManager
  • bc6428c wait if network map update is received and allow validating network map + remove MocIntegrated Validator from tests
  • 0928382 add testdata
  • 5485b68 add more key creation tests
  • bcec9b4 Merge branch 'refs/heads/main' into test/add-api-component-test
  • b3f0959 add all setup keys tests
  • dcbadd4 fix linter
  • f2280ed unexport impl structs
  • 426b38a unexport impl structs

📊 Changes

23 files changed (+1919 additions, -150 deletions)

View changed files

📝 management/cmd/management.go (+2 -2)
📝 management/server/account.go (+2 -2)
📝 management/server/account_test.go (+0 -42)
📝 management/server/geolocation/geolocation.go (+32 -7)
📝 management/server/geolocation/geolocation_test.go (+1 -1)
📝 management/server/grpcserver.go (+2 -2)
📝 management/server/http/handler.go (+13 -27)
📝 management/server/http/handlers/policies/geolocations_handler.go (+3 -3)
📝 management/server/http/handlers/policies/policies_handler.go (+1 -1)
📝 management/server/http/handlers/policies/posture_checks_handler.go (+3 -3)
📝 management/server/http/handlers/policies/posture_checks_handler_test.go (+1 -1)
📝 management/server/http/handlers/setup_keys/setupkeys_handler.go (+4 -4)
📝 management/server/http/handlers/setup_keys/setupkeys_handler_test.go (+6 -7)
management/server/http/testing/benchmarks/setupkeys_handler_benchmark_test.go (+226 -0)
management/server/http/testing/integration/setupkeys_handler_integration_test.go (+1146 -0)
management/server/http/testing/testdata/setup_keys.sql (+24 -0)
management/server/http/testing/testing_tools/tools.go (+307 -0)
📝 management/server/integrated_validator.go (+43 -0)
📝 management/server/jwtclaims/jwtValidator.go (+34 -5)
📝 management/server/management_test.go (+1 -41)

...and 3 more files

📄 Description

Describe your changes

This PR adds integration tests to test the full flow from API endpoint down to the store layer back up to the API response and the peers update message.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 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/netbirdio/netbird/pull/2936 **Author:** [@pascal-fischer](https://github.com/pascal-fischer) **Created:** 11/22/2024 **Status:** ✅ Merged **Merged:** 1/2/2025 **Merged by:** [@pascal-fischer](https://github.com/pascal-fischer) **Base:** `main` ← **Head:** `test/add-api-component-test` --- ### 📝 Commits (10+) - [`832e168`](https://github.com/netbirdio/netbird/commit/832e16886984ece3191d41f8e7ba178514956bc4) refactor jwtValidator and geo db to interfaces + first component test for setup-keys - [`72157b5`](https://github.com/netbirdio/netbird/commit/72157b55301e52de3879a7ad93069958f539a03e) unexport event store and add peerUpdateManager - [`bc6428c`](https://github.com/netbirdio/netbird/commit/bc6428c859e163c5e3cc6eae545d0ceee48491b9) wait if network map update is received and allow validating network map + remove MocIntegrated Validator from tests - [`0928382`](https://github.com/netbirdio/netbird/commit/0928382ebcf1f626937b75a375d3299aeb3cf981) add testdata - [`5485b68`](https://github.com/netbirdio/netbird/commit/5485b68bbb7bb62e6cdb2e419a4c9b30d494ea99) add more key creation tests - [`bcec9b4`](https://github.com/netbirdio/netbird/commit/bcec9b44ef9096310654045409e5e7f6dbed0788) Merge branch 'refs/heads/main' into test/add-api-component-test - [`b3f0959`](https://github.com/netbirdio/netbird/commit/b3f09598ac0faf04ff96637f8fb39676f4e936ec) add all setup keys tests - [`dcbadd4`](https://github.com/netbirdio/netbird/commit/dcbadd47c0fc692311aeb97224cfc895443ab2d0) fix linter - [`f2280ed`](https://github.com/netbirdio/netbird/commit/f2280edecd6f0914ffaac71128ebd0c5d72333ef) unexport impl structs - [`426b38a`](https://github.com/netbirdio/netbird/commit/426b38a2e018e01f1f54405aac0a28f45f2916a4) unexport impl structs ### 📊 Changes **23 files changed** (+1919 additions, -150 deletions) <details> <summary>View changed files</summary> 📝 `management/cmd/management.go` (+2 -2) 📝 `management/server/account.go` (+2 -2) 📝 `management/server/account_test.go` (+0 -42) 📝 `management/server/geolocation/geolocation.go` (+32 -7) 📝 `management/server/geolocation/geolocation_test.go` (+1 -1) 📝 `management/server/grpcserver.go` (+2 -2) 📝 `management/server/http/handler.go` (+13 -27) 📝 `management/server/http/handlers/policies/geolocations_handler.go` (+3 -3) 📝 `management/server/http/handlers/policies/policies_handler.go` (+1 -1) 📝 `management/server/http/handlers/policies/posture_checks_handler.go` (+3 -3) 📝 `management/server/http/handlers/policies/posture_checks_handler_test.go` (+1 -1) 📝 `management/server/http/handlers/setup_keys/setupkeys_handler.go` (+4 -4) 📝 `management/server/http/handlers/setup_keys/setupkeys_handler_test.go` (+6 -7) ➕ `management/server/http/testing/benchmarks/setupkeys_handler_benchmark_test.go` (+226 -0) ➕ `management/server/http/testing/integration/setupkeys_handler_integration_test.go` (+1146 -0) ➕ `management/server/http/testing/testdata/setup_keys.sql` (+24 -0) ➕ `management/server/http/testing/testing_tools/tools.go` (+307 -0) 📝 `management/server/integrated_validator.go` (+43 -0) 📝 `management/server/jwtclaims/jwtValidator.go` (+34 -5) 📝 `management/server/management_test.go` (+1 -41) _...and 3 more files_ </details> ### 📄 Description ## Describe your changes This PR adds integration tests to test the full flow from API endpoint down to the store layer back up to the API response and the peers update message. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 03:08:32 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#15849