Skip to content

test: align integration/security test file organisation and naming - #252

Merged
maansaake merged 3 commits into
mainfrom
chore/align-test-naming
Aug 23, 2026
Merged

test: align integration/security test file organisation and naming#252
maansaake merged 3 commits into
mainfrom
chore/align-test-naming

Conversation

@maansaake

Copy link
Copy Markdown
Member

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

  • New admin_api_auth_test.go consolidates superuser + admin-user login/logout/refresh/password/me (dissolves admin_api_test.go and admin_api_session_test.go).
  • Group bindings merged into admin_api_users_test.go.
  • flow and oas split into admin_api_flow_test.go / admin_api_oas_test.go.
  • Shared allPermissionIDs moved to state.go.
  • Debug/permissions tests prefixed (TestAdminDebug*, TestAdminPermissions*).

Basic Auth API

  • Refresh merged into organisations; bindings merged into users.
  • auth_basic_api_test.goauth_basic_api_access_control_test.go.
  • All tests prefixed with BasicAuth (TestBasicAuth*).

Other

  • auth_basic_test.gogateway_auth_basic_test.go (it tests the basic-auth flow component, not the API — resolves the name collision).
  • De-snake-cased cookies/cors test names across integration and security (TestCookies_adminTestCookiesAdmin, etc.).
  • Removed empty security/csrf_test.go.

Validation

  • gofmt -l: clean
  • go vet ./integration/ ./security/ ./connector/: clean
  • All three suites compile; full suite execution requires a live Kerberos test environment.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

maansaake and others added 3 commits August 23, 2026 10:29
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>
@maansaake
maansaake merged commit 1d3ca78 into main Aug 23, 2026
19 checks passed
@maansaake
maansaake deleted the chore/align-test-naming branch August 23, 2026 08:45
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.

1 participant