test: align integration/security test file organisation and naming - #252
Merged
Conversation
Reorganise the integration, security, and connector suites so each API resource group maps to a single test file, merge sub-resources into their parent resource files, and enforce a consistent Test<Api><Resource><Action> naming convention. Admin API: - add admin_api_auth_test.go (superuser + admin-user login/logout/refresh/ password/me), dissolving admin_api_test.go and admin_api_session_test.go - merge group bindings into admin_api_users_test.go - split flow and oas into admin_api_flow_test.go / admin_api_oas_test.go - move shared allPermissionIDs var into state.go - prefix debug/permissions tests (TestAdminDebug*, TestAdminPermissions*) Basic Auth API: - merge refresh into organisations, bindings into users - rename auth_basic_api_test.go -> auth_basic_api_access_control_test.go - prefix all tests with BasicAuth (TestBasicAuth*) Other: - rename auth_basic_test.go -> gateway_auth_basic_test.go (flow component) - de-snake-case cookies/cors test names across integration and security - remove empty security/csrf_test.go No test cases were deleted: a signature analysis confirmed the apparent overlaps are legitimate parallel coverage of two distinct APIs or RBAC vs plain-resource tests. Test function counts are unchanged (147 integration, 10 security). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Align the internal unit test names with the suite naming convention by dropping the Test<Type>_<Scenario> underscores: - TestAuthorizer_Authenticated -> TestAuthorizerAuthenticated - TestAuthorizer_AuthorizedGroup -> TestAuthorizerAuthorizedGroup - TestPostgres_NamedArgs -> TestPostgresNamedArgs - TestSQLite_ForeignKey -> TestSQLiteForeignKey - TestValidateDirPath_File -> TestValidateDirPathFile - TestResponseHandler_UnknownError -> TestResponseHandlerUnknownError - TestRequestHandler_UnknownError -> TestRequestHandlerUnknownError Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The admin permission-ID set is a shared test helper, so expose it as lib.AllPermissionIDs (in test/suites/lib/admin_user.go) instead of an unexported var in the integration suite's state.go. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cleans up and aligns the integration, security, and connector test suites so that each API resource group maps to a single test file, sub-resources are merged into their parent resource files, and test function names follow a consistent
Test<Api><Resource><Action>convention.This is a pure reorganisation — no test cases were deleted. A per-test signature analysis confirmed the apparent overlaps are legitimate parallel coverage of two distinct APIs (admin vs basic-auth) or RBAC-vs-plain-resource tests. Test function counts are unchanged (147 integration, 10 security).
Admin API
admin_api_auth_test.goconsolidates superuser + admin-user login/logout/refresh/password/me (dissolvesadmin_api_test.goandadmin_api_session_test.go).admin_api_users_test.go.flowandoassplit intoadmin_api_flow_test.go/admin_api_oas_test.go.allPermissionIDsmoved tostate.go.TestAdminDebug*,TestAdminPermissions*).Basic Auth API
auth_basic_api_test.go→auth_basic_api_access_control_test.go.BasicAuth(TestBasicAuth*).Other
auth_basic_test.go→gateway_auth_basic_test.go(it tests the basic-auth flow component, not the API — resolves the name collision).TestCookies_admin→TestCookiesAdmin, etc.).security/csrf_test.go.Validation
gofmt -l: cleango vet ./integration/ ./security/ ./connector/: cleanCo-authored-by: Copilot 223556219+Copilot@users.noreply.github.com