Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR extends the upsert functionality to support Kubernetes Secret resources alongside ConfigMaps, and enhances tests by refactoring them to use parallel subtests.
- Added Secret support in UpsertResource
- Reset resource version during creation
- Refactored tests with parallel subtests and added Secret-specific test cases
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| k8s/resource.go | Adds a case for Secrets in UpsertResource and resets resource version for creation |
| k8s/resource_test.go | Refactors tests for parallel subtests and adds Secret resource test scenarios |
Comments suppressed due to low confidence (2)
k8s/resource.go:50
- [nitpick] For consistency with the ConfigMap case, consider using resource.GetNamespace() instead of v.Namespace when calling Secrets(v.Namespace).
case *corev1.Secret:
k8s/resource_test.go:22
- [nitpick] Standardize subtest naming conventions across tests (e.g., use 'ConfigMap' and 'Secret' consistently) for improved clarity.
t.Run("configmap", func(t *testing.T) {
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the Kubernetes upsert functionality by adding support for Secret resources alongside ConfigMap and updates the test suite for improved parallel execution and additional error-case coverage.
- Enhanced UpsertResource to support Secrets and reset the resource version during creation.
- Added comprehensive test cases for Secret resources covering create, update, and error scenarios.
- Refactored tests structure using subtests with t.Parallel for better organization.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| k8s/resource.go | Added Secret support to UpsertResource and reset resource version. |
| k8s/resource_test.go | Updated tests to include Secret scenarios and refactored for parallelism. |
Comments suppressed due to low confidence (1)
k8s/resource_test.go:129
- [nitpick] For consistency with the other subtest names (e.g., "secret"), consider using lowercase ("configmap") for the subtest name.
t.Run("ConfigMap", func(t *testing.T) {
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the UpsertResource functionality to add support for Kubernetes Secret resources alongside existing ConfigMap support. It also refactors the test structure to use subtests with parallel execution and adds comprehensive Secret-specific test cases.
- Added case handling for corev1.Secret and reset resource version during creation.
- Refactored tests to group ConfigMap and Secret scenarios and to run in parallel.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| k8s/resource.go | Added support for Secret resources and reset resource version on create. |
| k8s/resource_test.go | Refactored tests to use t.Run with parallel subtests and added Secret test cases. |
Comments suppressed due to low confidence (1)
k8s/resource.go:65
- Consider adding a test case to verify that the resource version is reset (i.e., becomes an empty string) upon creation for both ConfigMap and Secret resources. This extra assertion would help ensure that the intended behavior for conflict avoidance is maintained.
obj.SetResourceVersion("") // Reset resource version for creation
|
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. |
Describe your changes
This pull request enhances the
UpsertResourcefunctionality in thek8s/resource.gofile by adding support for KubernetesSecretresources, alongside the existing support forConfigMap. It also introduces comprehensive test cases forSecretresources, refactors the test structure for better parallelism, and includes a minor improvement to reset resource versions during resource creation.Core functionality updates:
corev1.Secretin theUpsertResourcefunction, enabling the upsert operation forSecretresources. (k8s/resource.go, k8s/resource.goR50-R51)k8s/resource.go, k8s/resource.goR65)Testing enhancements:
t.Runfor subtests, enabling parallel execution and improving test organization. (k8s/resource_test.go, [1] [2] [3]Secretresources to cover create, update, get error, create error, and update error scenarios. (k8s/resource_test.go, [1] [2] [3] [4] [5]