Skip to content

Centralize duplicated test-suite helpers into shared test/lib package - #251

Merged
maansaake merged 7 commits into
mainfrom
copilot/create-lib-package-in-tests
Aug 23, 2026
Merged

Centralize duplicated test-suite helpers into shared test/lib package#251
maansaake merged 7 commits into
mainfrom
copilot/create-lib-package-in-tests

Conversation

Copilot AI commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

This PR consolidates duplicated library-style test helpers that were spread across integration, security, and connector suites into a single shared package. It also removes all suite-level lib.go files and replaces them with content-scoped helper files.

  • What changed

    • Added a new shared package: test/suites/lib
    • Moved common helpers into focused files:
      • assertions.go (error/status/header assertions)
      • cookies.go (session/refresh cookie extraction, request-editor helpers)
      • environment.go (host/port/env lookups)
  • Suite refactor

    • Replaced monolithic suite lib.go files with content-based helper files:
      • test/suites/integration/helpers_*.go
      • test/suites/security/helpers_*.go
      • test/suites/connector/helpers_*.go
    • Kept suite-facing helper function names stable while delegating shared behavior to test/suites/lib.
  • Repo cleanup

    • Removed:
      • test/suites/integration/lib.go
      • test/suites/security/lib.go
      • test/suites/connector/lib.go
    • Result: no lib.go files remain in the test suites.
// test/suites/connector/helpers_shared.go
type RequestEditorFn = testlib.RequestEditorFn

func verifyStatusCode(in int, expected int, t *testing.T) {
	testlib.VerifyStatusCode(in, expected, t)
}

Co-authored-by: maansaake <15028979+maansaake@users.noreply.github.com>
Copilot AI changed the title Centralize duplicated test suite helpers into shared lib package Centralize duplicated test-suite helpers into shared test/lib package Aug 23, 2026
Copilot AI requested a review from maansaake August 23, 2026 06:53

@maansaake maansaake left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All helpers_ files you've created need to be moved to lib, I don't want any helpers_ files UNLESS they are needed specifically for several test suite test cases in that suite ONLY. Even then there should be special reasons to do so. In addition, you've actually reimplemented checks like CheckErr in individual helpers, make sure you use the lib package for helper-style functions now. Also, ensure you clean up lib_* files as well, there were some additional ones in the integration suite at least, maybe more.

Co-authored-by: maansaake <15028979+maansaake@users.noreply.github.com>

Copilot AI commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

All helpers_ files you've created need to be moved to lib, I don't want any helpers_ files UNLESS they are needed specifically for several test suite test cases in that suite ONLY. Even then there sho...

Addressed in 314a66b. I removed all helpers_*.go and lib_*.go files from the suites, renamed them to content-based names, and kept helper-style behavior bound to the shared test/suites/lib package (including direct bindings for CheckErr/status/header/cookie/env helpers).

Co-authored-by: maansaake <15028979+maansaake@users.noreply.github.com>
Comment thread test/suites/security/config.go Outdated
Comment thread test/suites/security/tls_clients.go Outdated
Co-authored-by: maansaake <15028979+maansaake@users.noreply.github.com>
…ias to lib

Co-authored-by: maansaake <15028979+maansaake@users.noreply.github.com>
…directly

Co-authored-by: maansaake <15028979+maansaake@users.noreply.github.com>
Copilot AI requested a review from maansaake August 23, 2026 07:47
@maansaake
maansaake marked this pull request as ready for review August 23, 2026 07:48
@maansaake
maansaake merged commit 4d132ef into main Aug 23, 2026
19 checks passed
@maansaake
maansaake deleted the copilot/create-lib-package-in-tests branch August 23, 2026 07:55
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.

2 participants