chore(tests): updating the test strategy to be more parrallel#85
Merged
Jacobbrewer1 merged 3 commits intomainfrom Jul 7, 2025
Merged
chore(tests): updating the test strategy to be more parrallel#85Jacobbrewer1 merged 3 commits intomainfrom
Jacobbrewer1 merged 3 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR restructures existing tests into subtests, enables parallel execution where appropriate, and removes redundant helper code to streamline the test suite.
- Converts standalone test functions into
t.Runsubtests for clearer organization - Adds
t.Parallel()calls to improve test parallelism - Removes the custom
setEnvhelper in favor of usingt.Setenvdirectly
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| slices/set_test.go | Consolidated multiple Test_Set_* functions into subtests under Test_Set, added t.Parallel() |
| logging/logger_test.go | Wrapped TestNewLogger cases in subtests with t.Parallel(), added parallelism to TestDuplicateKey |
| logging/config_test.go | Removed setEnv helper and replaced calls with direct t.Setenv |
| k8s/resource_test.go | Converted several top-level TestUpsertResource_* functions into subtests with consistent naming and parallelism |
| health/result_test.go | Added an explicit fatal check after length assertion in compareResult |
| cache/fixed_hash_bucket_test.go | Enabled parallel execution for Test_FixedHashBucket |
Comments suppressed due to low confidence (1)
k8s/resource_test.go:54
- [nitpick] Consider adding
t.Parallel()at the start ofTestUpsertResourceso that its subtests can run in parallel with other tests.
err := UpsertResource(ctx, kubeClient, secret)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Describe your changes
This pull request primarily focuses on improving test organization and parallelization across multiple files. It introduces subtests for better readability and structure, removes redundant helper methods, and ensures tests run in parallel where applicable.
Test organization improvements:
k8s/resource_test.go: Consolidated multiple test functions into subtests usingt.Runfor better organization and readability. Updated test names to reflect specific scenarios, such as "create configmap error" and "update secret error". [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]slices/set_test.go: Reorganized tests into subtests usingt.Runfor operations like "Difference", "Items", "Each", and "Union". This enhances test clarity and structure. [1] [2] [3] [4] [5]Parallelization enhancements:
cache/fixed_hash_bucket_test.go: Addedt.Parallel()to enable parallel execution of theTest_FixedHashBuckettest.logging/logger_test.go: Introducedt.Parallel()for theTestNewLoggerand its subtests, ensuring tests run concurrently. [1] [2] [3]slices/set_test.go: Enabled parallel execution for all subtests withinTest_Set. [1] [2] [3] [4] [5]Removal of redundant code:
logging/config_test.go: Removed thesetEnvhelper method and directly usedt.Setenvfor setting environment variables in tests. This simplifies the code and reduces unnecessary abstraction. [1] [2]