Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/test e2e/add v2 e2e strategic testing #2884

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kpango
Copy link
Collaborator

@kpango kpango commented Mar 4, 2025

Overview

This PR introduces a new V2 E2E strategic testing framework for Vald, with significant refactoring and improvements to the testing infrastructure.

Key Changes

  1. New V2 E2E Testing Framework:

    • Created comprehensive test structure in tests/v2/e2e/
    • Implemented strategic testing with configurable operations
    • Added support for dataset handling, Kubernetes integration, and portforwarding
  2. Internal Package Refactoring:

    • Added new internal/iter package for iterator abstractions
    • Improved error handling in internal/errors
    • Enhanced internal/params for better argument parsing
    • Refactored internal/sync/errgroup for improved concurrency handling
  3. Configuration Changes:

    • Minor changes to internal/config/config.go in the Bind() method
    • Enhanced config package for E2E testing
  4. CI/Workflow Improvements:

    • Updated GitHub workflows for E2E testing
    • Modified Docker image building workflows

About the CI Warning

The CI system flagged changes in internal/config that might require Helm chart updates. After reviewing the changes, they appear to be relatively minor and focused on refactoring the Bind() method rather than changing the structure of configuration itself. No Helm chart changes were included in this PR.

Recommendations

  1. The code looks well-structured and the E2E testing framework is comprehensive
  2. Verify whether Helm charts require updates based on the config changes (seems unlikely from the review)
  3. Consider adding more documentation on how to use the new E2E testing framework

Overall, this PR significantly improves the testing infrastructure and should enhance the maintainability of the codebase.

Related Issue

Versions

  • Vald Version: v1.7.16
  • Go Version: v1.24.0
  • Rust Version: v1.84.1
  • Docker Version: v27.4.0
  • Kubernetes Version: v1.32.0
  • Helm Version: v3.16.3
  • NGT Version: v2.3.5
  • Faiss Version: v1.9.0

Checklist

Special notes for your reviewer

Summary by CodeRabbit

  • New Features

    • Expanded API documentation and configuration support for advanced end-to-end testing.
    • Enhanced CI/CD workflows with secure authentication for container registries.
  • Tests

    • Introduced a comprehensive set of end-to-end tests covering API operations, Kubernetes integration, and message handling.
    • Added new testing targets and frameworks for version 2 deployments.
  • Chores

    • Streamlined build scripts and Makefile variables for improved development and testing processes.
    • Refactored internal components to strengthen project structure and maintainability.

Copy link
Contributor

coderabbitai bot commented Mar 4, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a broad set of changes that modify the project structure and extend its capabilities. New files are added for API documentation, end-to-end tests, configuration management, generics in config functions, and iterative and noise-based processing. Multiple GitHub Actions workflows now include new credential steps and reorganized login procedures, while many Dockerfiles and Makefiles have been updated (mostly formatting and target improvements). Several internal packages and test files are also enhanced with new error handling, gRPC concurrency support, metadata fields, and Kubernetes client configuration.

Changes

File / Group Summary of Changes
Documentation & Config Files New API documentation and YAML config files added under apis/docs, introduction of configuration templates for versioned APIs, and new sample config files (e.g. cmd/agent/core/qbg/sample.yaml). Also updates in configuration management using generics in internal/config/config.go and new CRD error/message functions in internal/errors/….
Workflow Updates Multiple GitHub Actions workflow files (.github/workflows/*) now include new steps for DockerHub/GHCR login, new credentials sections with username/password fields from secrets, and a new Rust unit-test workflow file (unit-test-rust.yaml). Previous login steps have been removed/replaced and authentication is more uniformly enforced.
Dockerfile Formatting Changes Numerous Dockerfiles in directories such as dockers/agent/*, dockers/buildkit/*, etc., have been modified with formatting adjustments – typically adding or removing newline characters or reordering ENTRYPOINT directives without altering functionality.
Makefile and Makefile.d Enhancements The main Makefile now includes updates to linking flags (e.g. addition of -lm in HDF5_LDFLAGS), new variables (E2E_CONFIG, E2E_ADDR), conditional file creation for .gitfiles, and restructuring of Go formatting targets. New phony targets and functions were added in Makefile.d/e2e.mk and Makefile.d/functions.mk (e.g. run-v2-e2e-crud-test).
Internal Package Enhancements Introduction of generics in internal/config/config.go (for functions like Read, GetActualValue) and new error handling functions (ErrUnimplemented) in internal/errors/errors.go. A new iterator abstraction is provided in internal/iter/iter.go, and concurrency support is added to the gRPC streaming client in internal/net/grpc/stream.go.
Noise Generation & Option Files New noise generator implementation added in internal/test/data/vector/noise/noise.go along with a functional options file (option.go) to configure noise parameters.
gRPC and Network Enhancements Updated the signature of BidirectionalStreamClient in internal/net/grpc/stream.go by introducing a concurrency parameter and new asynchronous sending using goroutines and an error group. Additionally, a new HTTP client initializer with transport support is added in internal/net/http/client/client.go.
End-to-End Tests & Configurations Numerous new test files and configuration assets are added under tests/v2/e2e/ (e.g. rollout.yaml, unary_crud.yaml, and various Go test files for CRUD, index, search, strategy, HDF5 processing, and Kubernetes operations). These files establish comprehensive setups for end-to-end testing across different aspects of the project.
Test Files & Metadata Updates Many test files across internal and pkg directories have been updated to adjust function signatures, use pointers instead of values (e.g. updates in QUIC, gRPC pool, and client discovery tests), and include new fields (notably meta of type grpc.MD) in various job and benchmark tests. Renamings (e.g. dataProvider to sendDataProvider) and type modifications (returning pointers to any) are also applied.
Kubernetes Client & PortForward Enhancements New client implementations and option files for Kubernetes integration have been added in tests/v2/e2e/kubernetes/ (e.g. client.go, portforward/option.go, and portforward/portforward.go), providing improved configuration and error handling for managing Kubernetes resources and port-forwarding during e2e tests.
Benchmark & CLI Loadtest Updates In the pkg/tools/cli/loadtest/service/ directory, function signature adjustments (renaming and type changes of dataProvider to sendDataProvider, using pointer types) enhance the testing of loadtest functionalities for insert, search, and loader routines.
Additional Option & Server Test Updates New test files and functions are introduced for testing various server and client options in internal packages (internal/params/option_test.go, internal/servers/server/option_test.go, etc.) and many refactorings in gRPC option tests in internal/net/grpc/option_test.go.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant S as gRPC Stream
    participant EG as Error Group
    participant WG as WaitGroup
    C->>S: BidirectionalStreamClient(concurrency, sendDataProvider, callBack)
    Note right of S: For each message, a goroutine is spawned
    EG->>S: Asynchronously execute SendMsg(*data)
    WG-->>C: Wait for all send operations to complete
    C->>S: Proceed with bidirectional communication callback
Loading

Possibly related PRs

Suggested labels

size/XL, actions/e2e-deploy, actions/e2e-chaos, actions/e2e-profiling, actions/e2e-max-dim

Suggested reviewers

  • vankichi
  • kmrmt

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 golangci-lint (1.62.2)

level=warning msg="[config_reader] The configuration option run.skip-dirs is deprecated, please use issues.exclude-dirs."
level=warning msg="[config_reader] The configuration option output.format is deprecated, please use output.formats"
level=warning msg="[config_reader] The configuration option linters.govet.check-shadowing is deprecated. Please enable shadow instead, if you are not using enable-all."
Error: can't load config: the Go language version (go1.23) used to build golangci-lint is lower than the targeted Go version (1.24.0)
Failed executing command with error: can't load config: the Go language version (go1.23) used to build golangci-lint is lower than the targeted Go version (1.24.0)

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kpango kpango changed the base branch from main to refactor/test-e2e/add-v2-e2e-testing March 4, 2025 09:09
@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch from 0820ad1 to 5d57e38 Compare March 5, 2025 04:44
Copy link

cloudflare-workers-and-pages bot commented Mar 5, 2025

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: 18682c3
Status: ✅  Deploy successful!
Preview URL: https://5b092a43.vald.pages.dev
Branch Preview URL: https://refactor-test-e2e-add-v2-e2e-tc96.vald.pages.dev

View logs

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Mar 5, 2025

[WARNING:INTCFG] Changes in interal/config may require you to change Helm charts. Please check.

Copy link

codecov bot commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 0% with 69 lines in your changes missing coverage. Please review.

Project coverage is 13.02%. Comparing base (29272c4) to head (18682c3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/iter/iter.go 0.00% 67 Missing ⚠️
pkg/tools/cli/loadtest/service/loader.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2884      +/-   ##
==========================================
- Coverage   16.91%   13.02%   -3.90%     
==========================================
  Files         136      128       -8     
  Lines       15057    12761    -2296     
==========================================
- Hits         2547     1662     -885     
+ Misses      12213    10934    -1279     
+ Partials      297      165     -132     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch 2 times, most recently from dbd5e4d to 1836e7d Compare March 5, 2025 11:58
@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch 2 times, most recently from 014f707 to 64a29b5 Compare March 6, 2025 09:30
@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch 3 times, most recently from b15eb7d to dfc51f9 Compare March 6, 2025 09:44
deepsource-autofix bot added a commit that referenced this pull request Mar 6, 2025
This commit fixes the style issues introduced in 911bcae according to the output
from Gofumpt and Prettier.

Details: #2884
@github-actions github-actions bot added size/XXL and removed size/XXL labels Mar 6, 2025
@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch from e1f44e5 to 15e6211 Compare March 6, 2025 13:14
@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch from 15e6211 to eaff093 Compare March 6, 2025 13:14
@github-actions github-actions bot removed the size/XXL label Mar 6, 2025
@kpango kpango requested review from vankichi, hlts2 and datelier March 13, 2025 04:46
@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch from a8cbcb7 to 71d6ce2 Compare March 13, 2025 05:22
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🔭 Outside diff range comments (1)
internal/test/data/vector/noise/option_test.go (1)

3-262: 🛠️ Refactor suggestion

Implement real test logic
These functions are placeholders only. Consider adding actual test inputs and assertions to ensure thorough coverage of noise options.

♻️ Duplicate comments (12)
pkg/index/job/deletion/usecase/deletion_test.go (8)

1-2: ⚠️ Potential issue

Uncomment and implement the test functions for complete test coverage.

This is a new test file that currently has all test functions commented out. To ensure proper test coverage, you should implement each test function by uncommenting the code and adding specific test cases.

Based on previous review comments, some of these functions were marked as fixed in commit 57792a5, but they still appear commented out in this version.


3-93: ⚠️ Potential issue

Uncomment and implement test cases for TestNew function.

The TestNew function is commented out and lacks actual test cases. Since this tests the initialization of your runner, it's critical to ensure it properly handles various configurations.

Add at least these test cases:

  1. A case with valid configuration
  2. A case with nil configuration
  3. A case with invalid configuration parameters

95-208: ⚠️ Potential issue

Uncomment and implement test cases for Test_run_PreStart function.

The PreStart method is important for initialization, but the test is commented out with no actual test cases implemented.

Implement test cases for:

  1. Successful initialization
  2. Behavior with a nil context
  3. Error handling when dependencies fail to initialize

210-327: ⚠️ Potential issue

Uncomment and implement test cases for Test_run_Start function.

The Start function returns an error channel, which requires specific testing strategies. This test is commented out with no actual test cases.

Implement test cases for:

  1. Successful start that returns a valid error channel
  2. Failure scenarios (e.g., when server or indexer fails to start)
  3. Verification of error channel behavior

329-442: ⚠️ Potential issue

Uncomment and implement test cases for Test_run_PreStop function.

The PreStop function requires test coverage to ensure resources are properly prepared for shutdown. The test is commented out with no actual test cases.

Implement test cases for:

  1. Successful preparation for shutdown
  2. Error handling during preparation
  3. Edge cases with different component states

444-557: ⚠️ Potential issue

Uncomment and implement test cases for Test_run_Stop function.

The Stop function is critical for clean shutdown but its test is commented out with no actual test cases.

Implement test cases for:

  1. Graceful shutdown scenarios
  2. Error propagation when dependencies fail to stop
  3. Edge cases with different component states

559-672: ⚠️ Potential issue

Uncomment and implement test cases for Test_run_PostStop function.

The PostStop function requires test coverage to ensure proper cleanup after service shutdown. The test is commented out with no actual test cases.

Implement test cases for:

  1. Complete resource cleanup
  2. Error handling during cleanup
  3. Verification that no resources remain allocated

1-672: ⚠️ Potential issue

Add missing import statements for test compilation.

This test file is missing necessary import statements for packages like "testing", "context", "errors", "reflect", "golang.org/x/sync/errgroup", and likely others required for the tests to compile.

Add the import block at the top of the file:

 package usecase

+import (
+	"context"
+	"errors"
+	"reflect"
+	"testing"
+
+	"github.com/vdaas/vald/internal/config"
+	"github.com/vdaas/vald/internal/errors/errors"
+	"github.com/vdaas/vald/internal/observability"
+	"github.com/vdaas/vald/pkg/index/job/deletion/service"
+	"github.com/vdaas/vald/pkg/runner"
+	"github.com/vdaas/vald/pkg/starter"
+	"go.uber.org/goleak"
+	"golang.org/x/sync/errgroup"
+)
internal/net/http/client/client.go (1)

40-46: ⚠️ Potential issue

Missing function documentation and potential nil pointer dereference.

The new NewWithTransport function lacks documentation explaining its purpose and parameters. More critically, if the provided rt is not of type *http.Transport, the tr.Transport field remains nil, which could cause a nil pointer dereference when calling http2.ConfigureTransport(tr.Transport) on line 58.

Consider adding documentation and properly initializing tr.Transport when rt is not a *http.Transport:

+// NewWithTransport initializes the HTTP2 transport with the given RoundTripper and 
+// exponential backoff, returning the HTTP client for it, or any error that occurred.
func NewWithTransport(rt http.RoundTripper, opts ...Option) (*http.Client, error) {
	tr := new(transport)
	t, ok := rt.(*http.Transport)
	if ok {
		tr.Transport = t.Clone()
+	} else {
+		// Initialize with default transport if the provided one is not *http.Transport
+		tr.Transport = http.DefaultTransport.(*http.Transport).Clone()
	}
internal/net/http/client/client_test.go (1)

215-305: 🛠️ Refactor suggestion

Implement test cases for the new NewWithTransport function.

While the test structure is well-designed, the test is currently commented out and lacks actual test cases. Since NewWithTransport is now part of the public API, implementing at least some basic test cases is important to verify its functionality and prevent regressions.

Consider adding the following test cases:

  1. Basic test with default options
  2. Test with custom transport options
  3. Test with a non-*http.Transport implementation
  4. Error handling test for invalid options
internal/params/params_test.go (2)

452-570: 🛠️ Refactor suggestion

Implement test cases for parser.Restore() method

The test function is structured properly but currently commented out and lacks actual test cases. Testing the state restoration functionality is important for ensuring correct behavior when parser state needs to be reset.

Consider adding test cases that cover:

  1. Basic restoration with default state
  2. Restoration after various modifications
  3. Edge cases with nil or invalid fields
  4. Verification that all fields are correctly restored

572-689: 🛠️ Refactor suggestion

Implement test cases for parser.Override() method

The test function is structured properly but currently commented out and lacks actual test cases. Testing the override functionality is important for ensuring correct behavior when parser state needs to be modified.

Consider adding test cases that cover:

  1. Basic override with simple values
  2. Complex overrides with various field combinations
  3. Edge cases with nil or invalid fields
  4. Verification that all specified fields are correctly overridden
🧹 Nitpick comments (19)
pkg/index/job/deletion/service/options_test.go (1)

3-4: Consider removing or clarifying the NOT IMPLEMENTED BELOW comment

The comment "NOT IMPLEMENTED BELOW" is somewhat ambiguous. Consider either:

  1. Removing it once you implement the tests
  2. Adding more context like "// TODO: Implement test cases below"
  3. Adding a more descriptive comment about the current state and future implementation plans
pkg/index/job/deletion/usecase/deletion_test.go (1)

1-673: Consider adding mock implementations for dependencies.

To effectively test the deletion job runner, you'll need mock implementations of dependencies like starter.Server, service.Deleter, and observability.Observability. This will allow you to test specific behavior without relying on actual implementations.

Consider using a mocking library like gomock or creating simple mock implementations that record method calls and return predefined values.

internal/net/grpc/stream_test.go (1)

204-296: Consider implementing the commented test cases.

Similar to the TestNewMetadata function, this test case is commented out with placeholder TODOs. While the parameter updates are correct, the test itself doesn't contribute to actual test coverage.

Consider implementing actual test cases for the BidirectionalStreamClient function to verify the new concurrency functionality. At minimum, tests should cover:

  1. Basic functionality with concurrency = 0 (no limit)
  2. Functionality with a specific concurrency limit
  3. Error handling scenarios

If implementation is planned for a future PR, adding an explanatory comment would be helpful.

pkg/tools/cli/loadtest/service/insert_test.go (1)

18-557: Consider implementing the commented test cases.

Similar to the other test files, this file contains multiple commented-out test functions with TODO placeholders. While the type and variable name updates are correct, the tests themselves don't contribute to actual test coverage.

For a more comprehensive E2E testing framework as mentioned in the PR objectives, consider implementing these test cases to validate the functionality of the loadtest service. If implementation is planned for a future PR, adding an explanatory comment would be helpful.

internal/errors/errors.go (1)

86-88: Add documentation comment for consistency.

The new ErrUnimplemented function lacks a documentation comment unlike other error functions in this file.

Add a comment following the established pattern:

+	// ErrUnimplemented represents a function to generate an error for unimplemented features.
	ErrUnimplemented = func(name string) error {
		return Errorf("%s is unimplemented", name)
	}
internal/info/info_test.go (1)

996-1094: New test function added for ShortString method.

The TestStackTrace_ShortString function has been added to test the ShortString method on the StackTrace struct. The test structure follows the established pattern in the file but is currently a placeholder with TODO comments.

Consider implementing the actual test cases when the ShortString method implementation is finalized.

internal/timeutil/time_test.go (2)

185-263: New test function for DurationString.Duration added as a placeholder.

This test function follows the established testing pattern in the file. It's currently commented out with TODO placeholders.

Consider implementing the actual test cases once the DurationString type and its Duration method implementation are finalized.


265-349: New test function for DurationString.DurationWithDefault added as a placeholder.

The test function structure follows the existing pattern in the file and is currently commented out with TODO placeholders.

Consider implementing the actual test cases when the DurationString type and its DurationWithDefault method implementation are finalized.

tests/v2/e2e/kubernetes/client.go (3)

36-39: Rename GetRESRConfig for clarity.

The method name slightly deviates from standard naming conventions (e.g., GetRESTConfig). Renaming it can improve readability and more accurately reflect that it returns a REST configuration.

-func (c *client) GetRESRConfig() *rest.Config {
+func (c *client) GetRESTConfig() *rest.Config {

41-46: Remove or utilize the manager field to avoid dead code.

Although a manager.Manager is stored, this field is never referenced. Consider removing it if it’s unused or adding relevant integrations to avoid confusion.

type client struct {
	rest      *rest.Config
	clientset *kubernetes.Clientset
-	manager   manager.Manager
	client    kclient.WithWatch
}

93-108: Provide a mechanism for custom QPS/Burst.

If users require different values than the defaults cfg.QPS = 20.0 and cfg.Burst = 30, consider exposing parameters or an option in NewClient. This approach supports various load scenarios.

tests/v2/e2e/kubernetes/status.go (2)

83-114: Consider an upper bound or configurable interval for periodic status checks.

While the ticker-based approach works, an indefinite loop with a fixed 5-second interval could lead to infinite waiting under certain conditions. Provide a configurable or default timeout to prevent potential resource-consuming loops.


121-144: Future-proof the resource-type switch case.

The type-switch for resource statuses looks fine for now. Consider a single approach (e.g., reflecting GVK or dynamic checks) if you expect frequent additions of resource types.

tests/v2/e2e/config/config.go (1)

750-765: Add dedicated test coverage for the Load function
Verifying file reading, environment variable expansion, and binding logic can help catch potential misconfigurations or regressions early.

internal/test/data/vector/noise/noise_test.go (1)

1-197: Tests not implemented.

Most of the test logic is commented out, leaving the file with placeholders. This may cause confusion and does not guarantee coverage for your noise functionality.

Would you like assistance implementing these tests or do you plan to add them in a future commit?

tests/v2/e2e/kubernetes/portforward/portforward.go (2)

172-199: Consider adding a maximum retry limit or backoff for endpoint watcher restarts.
Currently, if the watcher’s channel closes repeatedly, the loop attempts immediate re-watching with minimal checks, which can lead to infinite restarts and potential resource leaks if the issue is persistent.


158-159: Use a larger buffer for the error channel or handle channel blocking scenarios.
The error channel pf.ech is buffered with size 2, which might lead to blocked writes if multiple errors occur quickly. Ensure that higher concurrency or frequent errors won't stall the port forwarding goroutines.

tests/v2/e2e/crud/search_test.go (1)

290-292: Return an actionable error from bulk search if desired.
Currently, when call fails, the error is only logged. If you want the entire test to fail upon gRPC errors, consider returning an error from this function (or calling t.Fatalf).

tests/v2/e2e/crud/modification_test.go (1)

127-180: Consider streamlining the switch logic.

The broad switch statement for plan.Type and nested requests is correct, but you could simplify or reduce repetition by mapping (plan.Type, plan.Mode) to handler functions in a lookup. This would keep your processModification method slimmer and easier to maintain.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8cbcb7 and 71d6ce2.

📒 Files selected for processing (134)
  • .gitfiles (13 hunks)
  • .github/workflows/_docker-image.yaml (1 hunks)
  • .github/workflows/_release-pr.yaml (1 hunks)
  • .github/workflows/build-binaries.yaml (1 hunks)
  • .github/workflows/build-protobuf.yaml (1 hunks)
  • .github/workflows/chatops.yaml (5 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/coverage.yaml (1 hunks)
  • .github/workflows/e2e-chaos.yaml (4 hunks)
  • .github/workflows/e2e-code-bench-agent.yaml (2 hunks)
  • .github/workflows/e2e-max-dim.yaml (1 hunks)
  • .github/workflows/e2e-profiling.yaml (1 hunks)
  • .github/workflows/e2e.yaml (8 hunks)
  • .github/workflows/format.yaml (2 hunks)
  • .github/workflows/fossa.yaml (1 hunks)
  • .github/workflows/helm-lint.yaml (3 hunks)
  • .github/workflows/helm.yaml (2 hunks)
  • .github/workflows/reviewdog-k8s.yaml (3 hunks)
  • .github/workflows/reviewdog.yaml (2 hunks)
  • .github/workflows/test-hack.yaml (1 hunks)
  • .github/workflows/unit-test-rust.yaml (1 hunks)
  • .github/workflows/unit-test.yaml (3 hunks)
  • .github/workflows/update-deps.yaml (1 hunks)
  • Makefile (5 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • buf.gen.yaml (1 hunks)
  • cmd/index/job/deletion/main_test.go (1 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/example/client/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/deletion/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • internal/backoff/option.go (0 hunks)
  • internal/client/v1/client/discoverer/discover_test.go (5 hunks)
  • internal/config/benchmark_test.go (4 hunks)
  • internal/config/config.go (2 hunks)
  • internal/config/index_deleter_test.go (1 hunks)
  • internal/core/algorithm/usearch/usearch_test.go (16 hunks)
  • internal/errors/errors.go (1 hunks)
  • internal/errors/errors_test.go (1 hunks)
  • internal/errors/k8s.go (1 hunks)
  • internal/info/info_test.go (17 hunks)
  • internal/iter/iter.go (1 hunks)
  • internal/net/dialer_test.go (1 hunks)
  • internal/net/grpc/errdetails/errdetails.go (6 hunks)
  • internal/net/grpc/metadata_test.go (1 hunks)
  • internal/net/grpc/option_test.go (44 hunks)
  • internal/net/grpc/pool/pool_test.go (5 hunks)
  • internal/net/grpc/server_test.go (2 hunks)
  • internal/net/grpc/stream.go (2 hunks)
  • internal/net/grpc/stream_test.go (4 hunks)
  • internal/net/http/client/client.go (1 hunks)
  • internal/net/http/client/client_test.go (1 hunks)
  • internal/net/net.go (1 hunks)
  • internal/net/net_test.go (1 hunks)
  • internal/net/quic/conn_test.go (1 hunks)
  • internal/net/quic/listener_test.go (1 hunks)
  • internal/params/option.go (2 hunks)
  • internal/params/option_test.go (1 hunks)
  • internal/params/params.go (5 hunks)
  • internal/params/params_test.go (1 hunks)
  • internal/rand/rand.go (1 hunks)
  • internal/servers/server/option_test.go (1 hunks)
  • internal/sync/errgroup/group.go (7 hunks)
  • internal/sync/errgroup/group_test.go (16 hunks)
  • internal/test/data/vector/gen.go (0 hunks)
  • internal/test/data/vector/noise/noise.go (1 hunks)
  • internal/test/data/vector/noise/noise_test.go (1 hunks)
  • internal/test/data/vector/noise/option.go (1 hunks)
  • internal/test/data/vector/noise/option_test.go (1 hunks)
  • internal/timeutil/time.go (1 hunks)
  • internal/timeutil/time_test.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (9 hunks)
  • pkg/discoverer/k8s/service/discover_test.go (4 hunks)
  • pkg/gateway/lb/handler/grpc/aggregation_test.go (2 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (2 hunks)
  • pkg/index/job/deletion/config/config_test.go (1 hunks)
  • pkg/index/job/deletion/service/deleter_test.go (1 hunks)
  • pkg/index/job/deletion/service/options_test.go (1 hunks)
  • pkg/index/job/deletion/usecase/deletion_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/insert_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/job_test.go (12 hunks)
  • pkg/tools/benchmark/job/service/object_test.go (8 hunks)
  • pkg/tools/benchmark/job/service/option_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/remove_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/search_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/update_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/upsert_test.go (4 hunks)
  • pkg/tools/cli/loadtest/service/insert_test.go (11 hunks)
  • pkg/tools/cli/loadtest/service/loader.go (1 hunks)
  • pkg/tools/cli/loadtest/service/loader_test.go (13 hunks)
  • pkg/tools/cli/loadtest/service/search_test.go (9 hunks)
  • tests/v2/e2e/assets/rollout.yaml (1 hunks)
  • tests/v2/e2e/assets/unary_crud.yaml (1 hunks)
  • tests/v2/e2e/config/config.go (1 hunks)
  • tests/v2/e2e/config/enums.go (1 hunks)
  • tests/v2/e2e/crud/crud_test.go (1 hunks)
  • tests/v2/e2e/crud/dataset_test.go (1 hunks)
  • tests/v2/e2e/crud/grpc_test.go (1 hunks)
  • tests/v2/e2e/crud/index_test.go (1 hunks)
  • tests/v2/e2e/crud/modification_test.go (1 hunks)
  • tests/v2/e2e/crud/object_test.go (1 hunks)
  • tests/v2/e2e/crud/search_test.go (1 hunks)
  • tests/v2/e2e/crud/strategy_test.go (1 hunks)
  • tests/v2/e2e/hdf5/hdf5.go (1 hunks)
  • tests/v2/e2e/kubernetes/client.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/option.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/portforward.go (1 hunks)
  • tests/v2/e2e/kubernetes/resources.go (1 hunks)
  • tests/v2/e2e/kubernetes/rollout.go (1 hunks)
  • tests/v2/e2e/kubernetes/status.go (1 hunks)
💤 Files with no reviewable changes (2)
  • internal/backoff/option.go
  • internal/test/data/vector/gen.go
🚧 Files skipped from review as they are similar to previous changes (91)
  • dockers/buildbase/Dockerfile
  • .github/workflows/codeql-analysis.yml
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/ci/base/Dockerfile
  • .github/workflows/fossa.yaml
  • .github/workflows/coverage.yaml
  • dockers/tools/benchmark/operator/Dockerfile
  • .github/workflows/e2e-profiling.yaml
  • dockers/operator/helm/Dockerfile
  • .github/workflows/helm.yaml
  • pkg/tools/benchmark/job/service/search_test.go
  • internal/rand/rand.go
  • dockers/index/job/readreplica/rotate/Dockerfile
  • .github/workflows/helm-lint.yaml
  • .github/workflows/format.yaml
  • dockers/dev/Dockerfile
  • dockers/index/job/creation/Dockerfile
  • .github/workflows/unit-test.yaml
  • dockers/index/job/correction/Dockerfile
  • dockers/binfmt/Dockerfile
  • pkg/tools/benchmark/job/service/insert_test.go
  • .github/workflows/e2e-max-dim.yaml
  • pkg/tools/benchmark/job/service/job_test.go
  • dockers/buildkit/Dockerfile
  • .github/workflows/e2e-chaos.yaml
  • dockers/manager/index/Dockerfile
  • dockers/gateway/lb/Dockerfile
  • dockers/agent/core/faiss/Dockerfile
  • .github/workflows/build-protobuf.yaml
  • internal/net/quic/listener_test.go
  • .github/workflows/test-hack.yaml
  • tests/v2/e2e/assets/rollout.yaml
  • .github/workflows/reviewdog.yaml
  • .github/workflows/chatops.yaml
  • internal/net/grpc/errdetails/errdetails.go
  • pkg/index/job/deletion/config/config_test.go
  • dockers/tools/cli/loadtest/Dockerfile
  • dockers/example/client/Dockerfile
  • internal/errors/errors_test.go
  • .github/workflows/_release-pr.yaml
  • internal/config/benchmark_test.go
  • .github/workflows/build-binaries.yaml
  • pkg/tools/cli/loadtest/service/loader.go
  • internal/net/net.go
  • buf.gen.yaml
  • pkg/agent/core/ngt/service/ngt.go
  • .github/workflows/_docker-image.yaml
  • .github/workflows/e2e.yaml
  • internal/timeutil/time.go
  • tests/v2/e2e/kubernetes/rollout.go
  • .github/workflows/update-deps.yaml
  • Makefile.d/functions.mk
  • .github/workflows/unit-test-rust.yaml
  • dockers/discoverer/k8s/Dockerfile
  • dockers/index/job/deletion/Dockerfile
  • dockers/agent/sidecar/Dockerfile
  • .github/workflows/reviewdog-k8s.yaml
  • dockers/agent/core/agent/Dockerfile
  • pkg/tools/benchmark/job/service/upsert_test.go
  • pkg/tools/benchmark/job/service/update_test.go
  • dockers/agent/core/ngt/Dockerfile
  • tests/v2/e2e/crud/dataset_test.go
  • internal/config/index_deleter_test.go
  • internal/core/algorithm/usearch/usearch_test.go
  • dockers/tools/benchmark/job/Dockerfile
  • pkg/tools/benchmark/job/service/object_test.go
  • tests/v2/e2e/crud/crud_test.go
  • .github/workflows/e2e-code-bench-agent.yaml
  • internal/net/quic/conn_test.go
  • dockers/index/operator/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • dockers/index/job/save/Dockerfile
  • cmd/index/job/deletion/main_test.go
  • internal/net/grpc/server_test.go
  • pkg/tools/cli/loadtest/service/search_test.go
  • pkg/tools/benchmark/job/service/remove_test.go
  • Makefile.d/e2e.mk
  • tests/v2/e2e/crud/grpc_test.go
  • internal/test/data/vector/noise/option.go
  • pkg/discoverer/k8s/service/discover_test.go
  • internal/config/config.go
  • internal/client/v1/client/discoverer/discover_test.go
  • pkg/agent/core/ngt/service/ngt_test.go
  • internal/net/grpc/pool/pool_test.go
  • pkg/gateway/lb/handler/grpc/aggregation_test.go
  • Makefile
  • internal/servers/server/option_test.go
  • pkg/tools/cli/loadtest/service/loader_test.go
  • pkg/index/job/deletion/service/deleter_test.go
  • internal/net/grpc/option_test.go
🧰 Additional context used
🧠 Learnings (1)
.gitfiles (1)
Learnt from: datelier
PR: vdaas/vald#2807
File: rust/bin/agent/src/handler/object.rs:36-38
Timestamp: 2025-03-13T04:50:01.551Z
Learning: In Rust code for Vald handlers, avoid using unwrap() on Option types. Instead, handle None values explicitly by returning appropriate error statuses to maintain robustness.
🪛 YAMLlint (1.35.1)
tests/v2/e2e/assets/unary_crud.yaml

[error] 202-202: duplication of key "name" in mapping

(key-duplicates)

🔇 Additional comments (96)
internal/net/net_test.go (1)

1199-1369: Implement test cases for IsUDP and IsTCP functions.

Both test functions are well-structured but currently commented out and lack actual test cases. Network type checking functions are critical for reliability and deserve thorough testing.

Consider adding test cases for:

  1. Standard network types (e.g., "udp", "tcp")
  2. Variant types (e.g., "udp4", "udp6", "tcp4", "tcp6")
  3. Case sensitivity (e.g., "UDP", "Udp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings
pkg/tools/benchmark/job/service/option_test.go (1)

1654-1692: Consider implementing actual test cases to verify functionality

The test cases section contains only TODOs and commented placeholder templates. While the structure is in place, there are no actual test cases to verify the WithMetadata functionality.

I recommend implementing at least these test cases:

  1. Test with nil map
  2. Test with empty map
  3. Test with populated map
  4. Test with map containing special characters
 	tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       args: args {
-		           m:nil,
-		       },
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+			name: "nil map",
+			args: args{
+				m: nil,
+			},
+			want: want{
+				want: WithMetadata(nil),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "empty map",
+			args: args{
+				m: map[string]string{},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "populated map",
+			args: args{
+				m: map[string]string{"key1": "value1", "key2": "value2"},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{"key1": "value1", "key2": "value2"}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
pkg/gateway/lb/handler/grpc/handler_test.go (4)

805-807: Updated the want struct to include attribute testing support

The addition of wantAttrs []attribute.KeyValue extends the test structure to validate telemetry attributes returned by the doSearch method.


814-814: Function signature updated to support attribute validation

The checkFunc signature now includes []attribute.KeyValue as a parameter, aligning with the updated return values from the doSearch method.


818-828: Enhanced test validation logic to verify returned attributes

The defaultCheckFunc implementation now correctly compares the telemetry attributes returned from doSearch against the expected values, improving test coverage for observability features.


923-924: Updated method invocation to capture and validate attribute values

The test now captures the gotAttrs return value from doSearch and passes it to the check function, completing the implementation of attribute validation in the test.

pkg/index/job/deletion/service/options_test.go (5)

1-348: Implementation placeholder with commented-out test code.

This file appears to be a placeholder for service option tests with all test functions commented out. While the structure is in place, none of the tests are actually functional in their current state.

For the file to be useful, the tests need to be uncommented and properly implemented. Also note that required import statements are missing (such as reflect, errors, and goleak).


5-89: Please uncomment and add concrete test cases for WithDiscoverer

The test template for TestWithDiscoverer is commented out. While the function structure is well designed with parallel execution and goroutine leak detection, it needs to be uncommented and implemented with actual test cases. Consider scenarios with valid discoverer clients, nil clients, and edge cases.


91-175: Action Required: Implement Comprehensive Test Cases for WithIndexingConcurrency

The test function for WithIndexingConcurrency is commented out and remains as placeholder code. Please implement test cases covering:

  • Zero concurrency values
  • Negative concurrency values
  • Standard/expected concurrency values
  • Excessively high concurrency values

This will ensure proper validation of the concurrency options.


177-261: Action Required: Implement Test Cases for WithTargetAddrs

The TestWithTargetAddrs function should be uncommented and implemented with proper test cases covering:

  • Empty address slice
  • Single address
  • Multiple addresses
  • Invalid address format (if validation is performed)
  • Duplicate addresses (if deduplication is expected)

263-347: Action Required: Implement Test Cases for WithTargetIndexID

The current test function for WithTargetIndexID is commented out. Please uncomment and implement test cases covering:

  • Empty index ID
  • Valid index ID
  • Special characters (if applicable)
  • Edge cases for length (if there are length constraints)
internal/net/grpc/metadata_test.go (1)

18-101: Consider implementing or clarifying the status of the commented test template.

The TestNewMetadata function is present but commented out, with placeholder TODO markers for test cases. This pattern creates a test skeleton but doesn't contribute to actual test coverage.

As previously noted in the past review, please either:

  1. Implement concrete test cases for the NewMetadata function, or
  2. Add an explicit comment explaining why this test remains commented out (e.g., "// Test template for future implementation" or "// Pending implementation after X feature")

Having a clear indication of the test's status would help other developers understand your intentions.

internal/net/grpc/stream.go (4)

171-172: Function signature updated to support concurrent message sending.

The addition of the concurrency parameter provides a useful way to control the number of concurrent operations in the bidirectional stream client. This enhancement aligns with the PR's objective of improving the E2E testing framework.


179-181: Well-implemented concurrency control for the error group.

The conditional check to set the limit on the error group is properly implemented, allowing flexibility by only applying limits when the concurrency parameter is greater than zero.


212-213: Added wait group for coordinating goroutine completion.

The addition of a sync.WaitGroup is a good practice for ensuring that all send operations complete before closing the stream.


228-236: Enhanced message sending with concurrent goroutines.

The refactoring of the message sending logic to use goroutines managed by the error group is a significant improvement. This allows for concurrent message sending while maintaining proper error handling.

The implementation is robust:

  • Properly increments/decrements the wait group for synchronization
  • Maintains consistent error handling
  • Returns early on error conditions
  • Preserves the original functionality while adding concurrency
internal/net/grpc/stream_test.go (2)

206-209: Updated test argument structure to match new function signature.

The args structure has been correctly updated to include the new concurrency parameter and renamed parameters, ensuring the test structure aligns with the implementation changes.


290-290: Updated function call with proper parameter ordering.

The call to BidirectionalStreamClient has been updated to include the new concurrency parameter in the correct position, maintaining consistency with the implementation changes.

pkg/tools/cli/loadtest/service/insert_test.go (2)

24-25: Updated function type to use pointers for improved type safety.

The change from func() any to func() *any enhances type safety by explicitly indicating that the function returns a pointer. This is a good practice that helps prevent potential nil dereference issues.


297-347: Renamed variable for consistency across the codebase.

The renaming of dataProvider to sendDataProvider throughout the file ensures consistency with related changes in other files. This consistent naming makes the codebase more maintainable and easier to understand.

internal/net/http/client/client.go (1)

37-38: Function refactored to use the new NewWithTransport.

The refactoring to use the new NewWithTransport function improves code reuse.

internal/info/info_test.go (2)

341-341: Added valdReplacer field aligns with updated info struct implementation.

The new valdReplacer field of type *strings.Replacer has been properly added to the fields struct in test functions. This change indicates that the underlying info struct implementation now includes this field.


370-370: Consistent initialization of valdReplacer field across test fixtures.

The valdReplacer field is consistently set to nil in the commented test cases, maintaining a uniform pattern throughout the test file.

Also applies to: 393-393, 428-428, 622-622, 645-645, 726-726, 749-749, 783-783, 825-825, 848-848, 883-883

internal/sync/errgroup/group_test.go (2)

946-946: Renamed test function from Test_group_TryGo to Test_group_exec with updated signature.

The Test_group_exec function replaces the previous Test_group_TryGo function. The significant changes include:

  1. Changed want struct from containing a boolean to an empty struct
  2. Updated the checkFunc signature to remove the boolean parameter
  3. Updated the field handling to use atomic.Int64 for the limit field

These changes align with what appears to be an underlying implementation change from the TryGo method to an exec method that doesn't return a boolean.

Also applies to: 951-1051


953-953: Changed limit field type to atomic.Int64 for improved thread safety.

The limit field in the fields struct has been updated to use atomic.Int64 instead of a regular integer type. This change improves thread safety for concurrent operations on this field.

Also applies to: 1066-1066, 1179-1179, 1297-1297, 1407-1407, 1492-1492

internal/params/option.go (6)

20-23: Added imports for OS path handling.

The addition of os and filepath imports supports the new functionality to retrieve the executable's base name for the parser.


28-28: Enhanced default parser name with executable's basename.

Setting the default parser name to the executable's basename through WithName(filepath.Base(os.Args[0])) improves user experience by providing a contextually relevant name in help messages and logs.


35-35: Added WithOverrideDefault option to defaults.

The new option WithOverrideDefault(false) has been added to the default options, which will control whether the parser overrides the default flag behavior.


38-45: Added WithName function to customize parser name.

The WithName function allows for customization of the parser's name. The implementation correctly handles empty strings by not applying the change in that case.


89-94: Added WithOverrideDefault function for flag override control.

The WithOverrideDefault function provides control over whether the parser should override the default flag.CommandLine behavior, enhancing configurability.


96-109: Added WithArgumentFilters for argument filtering capability.

The WithArgumentFilters function is well-implemented with:

  1. Clear documentation explaining its purpose and behavior
  2. Early return if no filters are provided
  3. Lazy initialization of the filters slice
  4. Proper append operation for the provided filters

This enhancement provides flexible argument filtering capability to the parser.

internal/net/dialer_test.go (1)

1992-2079: Consider removing or implementing the placeholder test for isQUICDial.

This commented-out test function remains entirely unimplemented, similar to previous revisions. Leaving it in the codebase can lead to confusion and technical debt if never completed.

internal/params/option_test.go (3)

451-535: Implement or remove the placeholder TestWithName function.

This test function is still fully commented out and lacks meaningful implementation. As previously noted, consider providing concrete test cases or removing it until ready.


537-620: Implement or remove the placeholder TestWithOverrideDefault function.

This test function remains commented out with no active test logic. It risks technical debt if left indefinitely. Please provide working test cases or remove the placeholder code.


622-705: Implement or remove the placeholder TestWithArgumentFilters function.

This skeleton function is entirely commented out. Similar to earlier feedback, uncomment and add valid test scenarios or remove it until full implementation is feasible.

internal/params/params.go (1)

135-145: Document or avoid reliance on global flag.CommandLine for concurrency safety.

Overriding the global flag.CommandLine in Override() and restoring it in Restore() introduces shared-state risks if multiple parser instances run concurrently. As previously recommended, either protect these calls or fully decouple them from global state.

internal/errors/k8s.go (1)

20-46: Well-organized error definitions for Kubernetes operations.

The grouping of error variables within a var block enhances code readability and maintainability. The new error variables provide appropriate error types for various Kubernetes operations, including pod status checking, port forwarding, and resource type validation.

I particularly like the use of error functions like ErrPodIsNotRunning and ErrUnsupportedKubernetesResourceType which allow for contextual information to be included in the error messages, making debugging easier.

internal/sync/errgroup/group.go (9)

17-19: Improved package documentation clarifies purpose.

The enhanced documentation clearly explains that this package provides a global wait group for gracefully terminating goroutines and notes its similarity to sync/errgroup.


31-41: Enhanced interface documentation provides better clarity.

The improved documentation for the Group interface and its methods makes the API more understandable for developers. Each method now has a clear description of its purpose and behavior.


121-134: Performance optimization for serial execution mode.

The updated SetLimit method now handles the special case where limit <= 1 differently, optimizing for serial execution by avoiding semaphore usage. This should reduce overhead when running tasks sequentially.


136-153: New inline execution method improves performance.

The new exec method allows for synchronous execution of tasks when operating in serial mode, avoiding the overhead of goroutine scheduling and context switching. This is an excellent optimization for small tasks.


155-164: Clean separation of execution strategies.

The new run method encapsulates the logic for asynchronous execution, keeping the code DRY by providing a reusable implementation for both Go and TryGo methods.


166-190: Smart execution path selection based on limit.

The refactored Go method now intelligently chooses between inline and goroutine-based execution based on the limit value, which should improve performance in applications with mixed workloads.


192-210: Consistent optimization applied to TryGo method.

The same performance optimization pattern is consistently applied to the TryGo method, ensuring uniform behavior and performance benefits across the API.


243-259: Clarified behavior of Wait method.

The updated documentation for the Wait method better explains its behavior, specifically that it blocks until all tasks complete and cancels the context afterward.


261-267: Added convenience function for global instance.

The new package-level Wait function provides a convenient way to wait for all tasks started with the global instance, with proper nil-checking to prevent panics.

internal/iter/iter.go (5)

28-38: Well-designed iterator interface with comprehensive methods.

The Cycle interface provides a robust set of methods for iteration, including direct element access (At), iterating with callbacks (ForEach), and various sequence generators (Seq, Seq2, Values, Indexes). This flexibility allows consumers to choose the most appropriate iteration pattern for their use case.


40-49: Clear struct design with effective documentation.

The implementation struct has well-named fields and a clear comment explaining its purpose. The use of an optional modFunc allows for on-the-fly transformation of elements, which is a powerful pattern for avoiding unnecessary memory allocations.


51-59: Consider returning a non-op iterator for empty slices.

Returning nil when len(array) == 0 may cause downstream panics if methods are called on the returned value. Consider returning a no-op iterator instead to improve safety and provide consistent behavior.

func NewCycle[S ~[]E, E any](array S, num, offset uint64, mod func(uint64, E) E) Cycle[S, E] {
  if array == nil {
    return nil
  }
  size := uint64(len(array))
  if size == 0 {
-   return nil
+   // Return a no-op cycle with zero length to avoid panics
+   return &cycle[S, E]{array: array, num: 0}
  }

80-94: Excellent context cancellation support in iteration methods.

All iteration methods properly check for context cancellation, which allows for graceful termination of long-running iterations. This is critical for applications that need to manage resources efficiently and respond to shutdown signals promptly.

Also applies to: 100-143


145-152: Simple accessor methods complete the API.

The Raw() and Len() methods provide essential access to the original data and size information, completing the interface with straightforward but necessary functionality.

tests/v2/e2e/config/enums.go (5)

19-21: Clear package documentation establishes purpose.

The package documentation clearly explains the purpose of the config package and this specific file's role in the configuration system.


23-52: Comprehensive set of operation types for E2E testing.

The OperationType enum provides a thorough set of constants covering various API operations that can be tested, including search, insertion, update, and administrative operations. This allows for flexible test configuration and clear identification of test scenarios.


54-76: Complete coverage of gRPC status codes.

The StatusCode enum maps to all standard gRPC status codes, which will be valuable for validating expected error conditions in tests. The string values use lowercase with no spaces, making them suitable for configuration files.


78-85: Operation modes reflect common API patterns.

The OperationMode enum captures the common API patterns (unary, stream, multiple) that need to be tested differently, which will help in organizing test cases appropriately.


87-112: Kubernetes enums facilitate comprehensive testing.

The KubernetesAction and KubernetesKind enums provide the necessary vocabulary for testing Kubernetes integration, covering all the common actions and resource types that the application might interact with.

.gitfiles (9)

126-126: Introduce configurable Rust unit test workflow.

A new workflow reference for Rust unit tests is introduced. Looks good overall. Ensure it aligns with any existing Rust configuration in your project (e.g., matching the Rust version in rust-toolchain).


161-177: Add references to new API docs and templates.

These doc file references appear to be properly listed. No functional or security concerns here.


488-488: Add sample YAML for qbg agent core.

This sample config reference is clear. No concerns from a correctness standpoint.


512-512: Add test file for index deletion job.

The newly referenced test file can help ensure coverage. Good addition.


863-863: Add test coverage for index deleter config.

This reference to test code is beneficial for validation. It should bolster reliability.


1087-1087: New internal/iter package.

If concurrency methods are introduced within iter.go, confirm thread-safety and performance. Otherwise, no issues.


1273-1273: Add QUIC conn test.

The new conn_test file reference is a welcome addition for transport layer verification.


1275-1275: Add QUIC listener test.

The new listener_test file reference is a solid step to ensure robust QUIC handling.


1406-1409: Add vector noise data & tests.

These references suggest more extensive test coverage for vector noise generation. No concerns.

tests/v2/e2e/kubernetes/status.go (9)

1-18: File header & package declaration.

Standard license header and package statement. Everything is in order here.


146-175: Central resource checker logic.

The switch-based approach is clear and well-structured. No immediate concerns about correctness.


255-301: StatefulSet status checks look consistent.

All typical conditions—observed generation, updated replicas, current vs. desired replicas—are addressed correctly.


348-374: Job status checks.

Active, succeeded, and failed counts are handled logically. This method handles standard Kubernetes job flows.


382-400: CronJob evaluation is concise.

Suspension handling and last schedule timing appear sound.


409-451: Pod phase and ready condition checks are thorough.

Integrating readiness checks and a watch for deletion timestamps covers typical Pod lifecycle states.


459-475: PVC phase handling.

Bound, pending, and lost states are properly differentiated.


483-497: Service type awareness.

LoadBalancer provisioning is tracked; returning a “LoadBalancing” status is a nice touch.


505-518: Ingress external IP checks.

The logic for pending vs. assigned IPs or hostnames is straightforward and effective.

tests/v2/e2e/config/config.go (1)

185-193: Add stricter validation for metadata inputs
Currently, there's no explicit check for length or allowed characters, which could allow malicious or invalid values.

tests/v2/e2e/kubernetes/resources.go (2)

562-608: Avoid overshadowing errors when updating annotations
Ensure that failures in creating or updating resources aren’t losing context from the original error.


307-314: Concurrency strategy looks good
Utilizing a sync.RWMutex ensures thread-safe read/write operations on shared fields in baseClient.

tests/v2/e2e/assets/unary_crud.yaml (1)

191-202: Duplicate key "name" potential issue.

The static analysis tool flags a duplicate key “name” in this block. This can cause parsing errors in YAML because identical keys—within the same mapping context—overwrite each other or fail to parse.

To fix, consider removing or renaming one of the keys, for example:

-      name: Insert -> IndexInfo
+      step: Insert -> IndexInfo
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 202-202: duplication of key "name" in mapping

(key-duplicates)

tests/v2/e2e/crud/index_test.go (2)

1-33: LGTM on the processIndex function.

The processIndex function cleanly dispatches unary index operations based on config types. No critical issues found here.


57-76: Generic unaryIndex function usage improvement.

This implementation doesn’t yet make full use of the generic type parameters, which can lead to unexpected behavior if the operation requires data in the request object. This was previously noted by a reviewer.

Consider initializing the request based on the plan configuration, for example:

func unaryIndex[Q, R proto.Message](
    t *testing.T, ctx context.Context, plan *config.Execution, call grpcCall[Q, R],
) {
    t.Helper()
    var req Q
+   // e.g., initialize req with plan-specific data if needed

    res, err := call(ctx, req)
    ...
}
internal/test/data/vector/noise/noise.go (3)

105-105: Potential division by zero issue.

If all vectors are empty or skipped, count remains zero, leading to a division by zero at line 105.

Consider a safe fallback:

if count == 0 {
-  return float32(totalStd/float64(count)) * ng.noiseLevelFactor
+  return 0.01 // fallback value
}

122-123: Edge case check for bits.Len64(required-1).

When required == minNoiseTableSize equals 1, subtracting 1 yields 0, which is safe. If required somehow becomes 0, though, this would be problematic. The current fallback paths seem to avoid that scenario, but remain wary of this edge case.


180-181:

✅ Verification successful

Ensure Go 1.21+ if using slices.Clone.

slices.Clone is part of the standard library as of Go 1.21. Verify your build environment is updated accordingly.

You can confirm your Go version with:


🏁 Script executed:

#!/bin/bash
go version

Length of output: 83


Go Version Compliance Confirmed

The build environment is using Go 1.24.0, which meets the requirement for using slices.Clone (introduced in Go 1.21). No changes are needed to this section of the code.

tests/v2/e2e/crud/object_test.go (2)

77-136: Refine large switch-case logic.


142-176: Surface of potential partial completion.

tests/v2/e2e/kubernetes/portforward/option.go (1)

95-101: Validate ports mapping.

tests/v2/e2e/hdf5/hdf5.go (1)

100-127: Validate dataset dimensionality before reading.

tests/v2/e2e/crud/strategy_test.go (3)

60-61: Switch to t.Fatalf to short-circuit upon Kubernetes client creation failure.
Logging the error with t.Errorf allows the test to continue, which can produce additional failures downstream if the Kubernetes client is essential.


153-155: Return errors from processOperation to fail fast.
This method unconditionally returns nil, swallowing errors and risking silent test failures or ambiguous outcomes.


159-162: Avoid continuing the test after failing to process operations.
Consider using tt.Fatalf instead of tt.Errorf to halt execution when executeWithTimings returns an error, preventing unnecessary follow-on failures.

tests/v2/e2e/kubernetes/portforward/portforward.go (1)

244-250:

✅ Verification successful

Validate goroutine completion before closing the error channel.
Although pf.eg.Wait() will complete when all goroutines return, confirm that no other goroutine can write to pf.ech after Stop(). This avoids potential sends on a closed channel.

Would you like to run a script verifying no goroutine references pf.ech after Stop() completes?


🏁 Script executed:

#!/bin/bash
# Searching for references to pf.ech usage after potential Stop calls
rg --context 5 "pf\.ech" 

Length of output: 4118


Goroutine Completion for pf.ech is Safely Ensured
After verifying with a repository-wide search, all writes to pf.ech occur within goroutines managed by pf.eg. Since pf.eg.Wait() guarantees that these goroutines have finished executing before Stop() closes pf.ech, there are no writes to the channel after it’s closed. No additional synchronization is required.

tests/v2/e2e/crud/search_test.go (3)

58-58: Check for possible zero-length neighbors to avoid division by zero.
When neighbors is empty, float64(len(neighbors)) becomes 0, leading to a NaN or Inf recall value.


76-78: Validate slice boundaries before slicing neighbors.
neighbors[:len(topKIDs)] can panic if len(topKIDs) exceeds the length of neighbors. Safeguard the slice operation to prevent out-of-bounds errors.


283-327: Properly handles leftover requests in multiSearch.
The final call to exec(reqs) ensures any unsent requests get processed. This prevents silent drops of incomplete batches.

tests/v2/e2e/crud/modification_test.go (2)

182-228: Confirm if ignoring gRPC call errors is intentional.

Currently, handleGRPCCallError(...) is invoked, but your goroutine always returns nil, meaning the test itself continues even if an error occurs. If you want to fail the test on any error, consider returning the wrapped error from the goroutine or calling t.Fatal(...) directly in handleGRPCCallError(...).


230-285: Leftover batch of requests is handled properly.

Your final exec(reqs) call (line 283) ensures leftover requests are processed — addressing past concerns about unprocessed leftover items in multiModify. Good job! If you wish to keep concurrency consistent, consider placing that final batch execution in a goroutine as well.

kmrmt
kmrmt previously approved these changes Mar 14, 2025
@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch from 71d6ce2 to 9f7ad77 Compare March 14, 2025 08:38
deepsource-autofix bot added a commit that referenced this pull request Mar 14, 2025
This commit fixes the style issues introduced in 08f1a47 according to the output
from Gofumpt and Prettier.

Details: #2884
@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch 2 times, most recently from afd77c1 to ff0676b Compare March 14, 2025 08:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🔭 Outside diff range comments (3)
pkg/index/job/deletion/service/deleter_test.go (1)

1-520: ⚠️ Potential issue

Implement the test functions to improve test coverage

This file contains commented-out test templates for the Deleter component but doesn't actually implement any tests. While the structure follows good Go testing practices (table-driven tests with proper setup/teardown, parallel test execution, and goroutine leak detection), the file doesn't contribute to test coverage in its current state.

Consider implementing at least a few basic test cases for each function to validate the core functionality:

  • TestNew: Test creation with valid and invalid options
  • Test_delDuplicateAddrs: Test with empty, single, and duplicate entries
  • Test_index_StartClient, Test_index_Start, Test_index_doDeleteIndex: Test happy path and error conditions

Would you like me to help implement some basic test cases for any of these functions?

internal/sync/errgroup/group_test.go (1)

946-1057: 🛠️ Refactor suggestion

Complete implementation of Test_group_exec.

The test function has been refactored from Test_group_TryGo to Test_group_exec with appropriate signature changes. However, the test cases are still marked as TODOs and not implemented.

Implement proper test cases to verify the behavior of the exec method, especially considering the change from the boolean-returning TryGo method to the void exec method.

tests/v2/e2e/kubernetes/resources.go (1)

316-610: ⚠️ Potential issue

Avoid potential nil-pointer dereference before mutex locks.
All methods call b.mu.RLock() or b.mu.Lock() even when b could be nil. Checking b == nil after the lock leads to a panic if b is actually nil. Reorder the checks to avoid locking on a nil pointer:

 func (b *baseClient[T, L, C]) Create(
   ctx context.Context, resource T, opts metav1.CreateOptions,
 ) (t T, err error) {
-  b.mu.RLock()
-  defer b.mu.RUnlock()
-  if b == nil || b.Interface == nil {
+  if b == nil {
     return t, errors.ErrKubernetesClientNotFound
   }
+  b.mu.RLock()
+  defer b.mu.RUnlock()
+  if b.Interface == nil {
+    return t, errors.ErrKubernetesClientNotFound
+  }
   return b.Interface.Create(ctx, resource, opts)
 }
 
 // Repeat the same pattern fix across other methods in baseClient[...].
♻️ Duplicate comments (9)
pkg/index/job/deletion/usecase/deletion_test.go (7)

1-93: ⚠️ Potential issue

Uncomment and implement the TestNew function

This test file contains several test functions that are currently commented out. The TestNew function has a well-structured table-driven test design, but it's not active and has no actual test cases.

I see from previous reviews that this was marked as fixed in commit 57792a5, but the implementation is still commented out. Please uncomment this function and add proper test cases to validate the New function behavior.

You should add at least the following test cases:

  1. A test with valid configuration parameters
  2. A test with nil configuration to verify error handling
  3. A test with invalid configuration parameters to test the validation logic

95-208: ⚠️ Potential issue

Uncomment and implement Test_run_PreStart function

The PreStart function is critical as it initializes the run prerequisites. This test function is well-structured but inactive and missing actual test cases.

When implementing, consider test cases for:

  1. Successful initialization with valid dependencies
  2. Error handling when passed a nil context
  3. Handling of dependency initialization failures

210-327: ⚠️ Potential issue

Uncomment and implement Test_run_Start function

The Start method is an important component that returns an error channel. This test must verify both the channel behavior and error propagation.

I notice this was marked as fixed in commit 57792a5, but the implementation is still commented out. Please uncomment and add proper test cases to validate error conditions and channel functionality.


329-442: ⚠️ Potential issue

Improve parameter naming in Test_run_PreStop and uncomment implementation

The parameter name in0 in the args struct is not descriptive. Rename it to ctx for better readability. Also, this test function remains commented out and requires implementation.

 type args struct {
-    in0 context.Context
+    ctx context.Context
 }

When implementing, ensure test cases verify proper resource preparation before shutdown.


444-557: ⚠️ Potential issue

Uncomment and implement Test_run_Stop function

The Stop function requires thorough testing to ensure proper resource cleanup. This test function is commented out despite being marked as fixed in a previous commit.

Please uncomment this function and add test cases for:

  1. Successful graceful shutdown
  2. Error propagation when dependencies fail to stop properly
  3. Handling of timeout scenarios

559-672: ⚠️ Potential issue

Improve parameter naming in Test_run_PostStop and uncomment implementation

Similar to PreStop, the parameter name in0 should be renamed to ctx for better readability. This test function needs to be uncommented and implemented.

 type args struct {
-    in0 context.Context
+    ctx context.Context
 }

Add test cases that verify complete resource cleanup after shutdown.


1-672: ⚠️ Potential issue

Add missing import statements for the test file

The test file is missing necessary import statements for packages like "errors", "reflect", "testing", "context", "golang.org/x/sync/errgroup", etc.

Add the following imports at the top of the file:

 package usecase

+import (
+	"context"
+	"errors"
+	"reflect"
+	"testing"
+
+	"github.com/vdaas/vald/internal/config"
+	"github.com/vdaas/vald/internal/observability"
+	"github.com/vdaas/vald/pkg/index/job/deletion/service"
+	"github.com/vdaas/vald/pkg/manager/runner"
+	"github.com/vdaas/vald/pkg/manager/starter"
+	"go.uber.org/goleak"
+	"golang.org/x/sync/errgroup"
+)
tests/v2/e2e/hdf5/hdf5.go (1)

110-114: ⚠️ Potential issue

Handle unexpected dataset dimensions.
The code directly indexes dims[0] and dims[1] without verifying that len(dims) >= 2. In the event that the dataset is not strictly 2D, this can lead to out-of-range panics. Consider returning an error whenever len(dims) != 2 to avoid potential runtime failures.

Example patch:

 if err != nil {
     return nil, err
 }

+ if len(dims) != 2 {
+     return nil, fmt.Errorf("expected 2D data, got %d dimensions", len(dims))
+ }

 height, width := int(dims[0]), int(dims[1])
tests/v2/e2e/crud/search_test.go (1)

76-78: ⚠️ Potential issue

Validate slice boundaries to avoid panics.
Using neighbors[:len(topKIDs)] may panic if len(topKIDs) exceeds len(neighbors). Consider min-bounding the slice to avoid runtime errors:

- return recall(t, topKIDs, neighbors[:len(topKIDs)])
+ length := len(topKIDs)
+ if length > len(neighbors) {
+     length = len(neighbors)
+ }
+ return recall(t, topKIDs, neighbors[:length])
🧹 Nitpick comments (24)
internal/test/data/vector/noise/option_test.go (2)

5-89: Implement the test logic or remove the placeholder.

The entire TestWithLevelFactor function is commented out, preventing coverage of the option functionality. Please add real test cases or remove this placeholder to keep the codebase clean and maintainable.

Would you like me to scaffold a few example test cases to jumpstart implementation?


177-261: Provide actual tests or remove unused stubs.

TestWithMinTableSize remains a placeholder. Having comprehensive tests here will help confirm correctness of minimum table size logic. If not immediately needed, removal might be preferable.

internal/test/data/vector/noise/noise_test.go (1)

97-196: Implement or remove Test_noiseGenerator_Mod.

This placeholder test is crucial for verifying that noise additions happen correctly on vectors. Avoid leaving this untested; either implement meaningful coverage or eliminate dead code.

internal/net/grpc/option_test.go (1)

1722-1805: Consider implementing the test cases rather than using TODOs.

Most tests in this file have placeholder TODO comments instead of actual test implementations. Since this is part of a broader testing framework enhancement, consider implementing these test cases to improve coverage.

 	tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       args: args {
-		           opts:nil,
-		       },
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+		    name: "with_empty_dial_options",
+		    args: args {
+		        opts:nil,
+		    },
+		    want: want{
+		        want: func() Option {
+		            return func(opts *options) {
+		                opts.dialOptions = make([]grpc.DialOption, 0)
+		            }
+		        }(),
+		    },
+		    checkFunc: defaultCheckFunc,
+		},
+		{
+		    name: "with_custom_dial_options",
+		    args: args {
+		        opts:[]grpc.DialOption{grpc.WithBlock()},
+		    },
+		    want: want{
+		        want: func() Option {
+		            return func(opts *options) {
+		                opts.dialOptions = []grpc.DialOption{grpc.WithBlock()}
+		            }
+		        }(),
+		    },
+		    checkFunc: defaultCheckFunc,
+		},
pkg/index/job/deletion/usecase/deletion_test.go (1)

1-672: Implement or remove the goleak verification in tests

Each test uses goleak.VerifyNone(tt, goleak.IgnoreCurrent()) to detect goroutine leaks, but since the tests are commented out, this functionality isn't active.

When uncommenting the tests, make sure to properly handle the goleak verification to detect any resource leaks. Would you like me to provide example implementations for the tests that properly utilize goleak verification?

internal/errors/errors.go (1)

86-88: Add documentation comment for ErrUnimplemented function

The newly added ErrUnimplemented function follows the pattern of other error functions in this file but lacks documentation explaining its purpose. Consider adding a comment following the established pattern of other error functions.

+	// ErrUnimplemented represents a function to generate an error that indicates a feature is not implemented.
 	ErrUnimplemented = func(name string) error {
 		return Errorf("%s is unimplemented", name)
 	}
internal/net/grpc/errdetails/errdetails.go (1)

80-82: Add documentation for the new Details struct

The newly added Details struct lacks documentation explaining its purpose and usage. Consider adding a comment to explain that it's used for encapsulating multiple Detail objects.

+// Details represents a collection of error details that can be marshaled to JSON/YAML.
 type Details struct {
 	Details []Detail `json:"details,omitempty" yaml:"details"`
 }
internal/info/info_test.go (1)

340-342: Add tests for the new valdReplacer field.

The valdReplacer field has been added to the fields struct but all test instances initialize it to nil. Consider adding test cases that properly initialize and test this field with different values to ensure it functions correctly.

internal/net/grpc/stream_test.go (1)

204-296: Implement the commented-out test

The TestBidirectionalStreamClient function is still commented out and lacks concrete test cases. This could lead to technical debt if left unimplemented for an extended period.

Consider implementing actual test cases that validate the concurrent message sending behavior and error handling of the modified function, especially testing how the concurrency parameter affects execution.

internal/errors/k8s.go (1)

20-46: Standardize error messages
All newly introduced error variables are clear and descriptive. Minor nitpick: some errors (e.g., ErrUndefinedNamespace, ErrUndefinedService) begin with uppercase while others are lowercase. For consistency, consider a uniform style (e.g., all lowercase).

tests/v2/e2e/config/enums.go (6)

19-21: Consider revising the package documentation.

The package comment mentions "detailed Bind methods for all configuration types" but this file doesn't contain any Bind methods. Consider updating the documentation to accurately reflect the purpose of this file - defining enumeration types for E2E testing configuration.

-// Package config provides configuration types and logic for loading and binding configuration values.
-// This file includes detailed Bind methods for all configuration types with extensive comments.
+// Package config provides configuration types and logic for E2E testing.
+// This file defines enumeration types used across the E2E testing framework.
 package config

23-52: Add documentation for the OperationType constants.

Consider adding godoc-style comments to describe the purpose of this type and its constants to improve code maintainability. This would help other developers understand how each operation type is used in the E2E testing framework.

+// OperationType defines the types of operations supported in the E2E testing framework.
 type OperationType string
 
 const (
+	// OpSearch represents a vector search operation.
 	OpSearch           OperationType = "search"
+	// OpSearchByID represents a search operation using a vector ID.
 	OpSearchByID       OperationType = "search_by_id"
+	// OpLinearSearch represents a linear (brute force) search operation.
 	OpLinearSearch     OperationType = "linear_search"
+	// OpLinearSearchByID represents a linear search operation using a vector ID.
 	OpLinearSearchByID OperationType = "linear_search_by_id"
 
+	// OpInsert represents a vector insertion operation.
 	OpInsert            OperationType = "insert"
 	// Remaining comments for other operations...

54-76: Add documentation for StatusCode type and constants.

Similar to the previous comment, consider adding godoc-style comments to describe the purpose of the StatusCode type and its constants. This would make the code more maintainable and self-documenting.

+// StatusCode represents the possible status codes returned by operations.
 type StatusCode string
 
+// StatusCodes is a collection of StatusCode values.
 type StatusCodes []StatusCode
 
 const (
+	// StatusCodeOK indicates a successful operation.
 	StatusCodeOK                 StatusCode = "ok"
+	// StatusCodeCanceled indicates that the operation was canceled.
 	StatusCodeCanceled           StatusCode = "canceled"
 	// Additional comments for other status codes...

78-85: Add documentation for OperationMode type and constants.

Consider adding godoc-style comments for the OperationMode type and its constants to improve code readability and documentation.

+// OperationMode defines the supported modes of operation in the E2E testing framework.
 type OperationMode string
 
 const (
+	// OperationUnary represents a unary (single request-response) operation.
 	OperationUnary    OperationMode = "unary"
+	// OperationStream represents a streaming operation.
 	OperationStream   OperationMode = "stream"
+	// OperationMultiple represents an operation that involves multiple requests/responses.
 	OperationMultiple OperationMode = "multiple"
+	// OperationOther represents any other type of operation.
 	OperationOther    OperationMode = "other"
 )

87-98: Add documentation for KubernetesAction type and constants.

Adding godoc-style comments for the KubernetesAction type and its constants would improve code documentation and maintainability.

+// KubernetesAction defines the supported Kubernetes actions in the E2E testing framework.
 type KubernetesAction string
 
 const (
+	// KubernetesActionRollout represents a Kubernetes rollout action.
 	KubernetesActionRollout KubernetesAction = "rollout"
+	// KubernetesActionDelete represents a Kubernetes delete action.
 	KubernetesActionDelete  KubernetesAction = "delete"
 	// Additional comments for other Kubernetes actions...

100-112: Add documentation for KubernetesKind type and constants.

Consider adding godoc-style comments for the KubernetesKind type and its constants to improve code documentation and readability.

+// KubernetesKind defines the types of Kubernetes resources used in the E2E testing framework.
 type KubernetesKind string
 
 const (
+	// ConfigMap represents a Kubernetes ConfigMap resource.
 	ConfigMap   KubernetesKind = "configmap"
+	// CronJob represents a Kubernetes CronJob resource.
 	CronJob     KubernetesKind = "cronjob"
 	// Additional comments for other Kubernetes kinds...
tests/v2/e2e/assets/unary_crud.yaml (1)

125-180: Remove large commented-out sections if they are no longer required.

These lines contain significant commented-out content, which may confuse maintainers. Consider deleting them or converting them into reference documentation if still relevant.

tests/v2/e2e/kubernetes/client.go (1)

122-124: Rename method for clarity.
The method name GetRESRConfig() appears to be a typo. Consider renaming it to GetRESTConfig() to avoid confusion.

-func (c *client) GetRESRConfig() *rest.Config {
+func (c *client) GetRESTConfig() *rest.Config {
     return c.rest
 }
tests/v2/e2e/crud/object_test.go (1)

175-176: Check the outcome of concurrent requests.
You call eg.Wait() but ignore its returned error. If you expect concurrency errors to fail the test, capture and handle that error instead of discarding it.

-eg.Wait()
+if err := eg.Wait(); err != nil {
+    t.Errorf("one or more object requests failed: %v", err)
+}
tests/v2/e2e/kubernetes/portforward/option.go (1)

30-31: Correct comment to describe port forwarding.
This doc comment references “backoff,” but the Option is more broadly for configuring the portForward struct. Consider updating it for accuracy.

-// Option represents the functional option for backoff.
+// Option represents the functional option for portForward.
tests/v2/e2e/crud/strategy_test.go (2)

60-60: Consider halting the test when Kubernetes client creation fails.
Invoking t.Errorf allows the test to continue even though a valid Kubernetes client is not available. If the client is mandatory for subsequent steps, switching to t.Fatalf ensures immediate termination and prevents cascading errors.

- t.Errorf("failed to create kubernetes client: %v", err)
+ t.Fatalf("failed to create kubernetes client: %v", err)

161-161: Fail the test if operations cannot be processed.
Currently, the code logs the error using tt.Errorf("failed to process operations: %v", err) but continues. If failing fast is preferred upon operation failures, replace tt.Errorf with tt.Fatalf.

tests/v2/e2e/crud/modification_test.go (2)

210-225: Consider stopping test execution or propagating errors on gRPC call failures.
Currently, any error from call(ctx, req) is handled by handleGRPCCallError(t, err, plan), and the goroutine returns nil. As a result, subsequent modifications continue even if critical operations fail. If you require strict test termination on failure, consider returning the error to the error group so the test can fail promptly:

- _, err := call(ctx, req)
- if err != nil {
-   handleGRPCCallError(t, err, plan)
-   return nil
- }
- return nil
+ _, callErr := call(ctx, req)
+ if callErr != nil {
+   handleGRPCCallError(t, callErr, plan)
+   return callErr
+ }
+ return nil

268-285: Align concurrency handling for the leftover batch in multiModify.
You send complete batches in separate goroutines but call exec(reqs) for the leftover batch on the main goroutine. This can block until leftover processing finishes. To keep it consistent with the rest of the bulk calls and potentially reduce total time, consider invoking it within the errgroup as well:

     ...
     reqs = reqs[:0]
     eg.Go(func() error {
       exec(batch)
       return nil
     })
   }
 }
- exec(reqs)
+ if len(reqs) > 0 {
+   leftover := slices.Clone(reqs)
+   reqs = reqs[:0]
+   eg.Go(func() error {
+     exec(leftover)
+     return nil
+   })
+ }
 eg.Wait()
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71d6ce2 and ff0676b.

📒 Files selected for processing (134)
  • .gitfiles (14 hunks)
  • .github/workflows/_docker-image.yaml (1 hunks)
  • .github/workflows/_release-pr.yaml (1 hunks)
  • .github/workflows/build-binaries.yaml (1 hunks)
  • .github/workflows/build-protobuf.yaml (1 hunks)
  • .github/workflows/chatops.yaml (5 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/coverage.yaml (1 hunks)
  • .github/workflows/e2e-chaos.yaml (4 hunks)
  • .github/workflows/e2e-code-bench-agent.yaml (2 hunks)
  • .github/workflows/e2e-max-dim.yaml (1 hunks)
  • .github/workflows/e2e-profiling.yaml (1 hunks)
  • .github/workflows/e2e.yaml (8 hunks)
  • .github/workflows/format.yaml (2 hunks)
  • .github/workflows/fossa.yaml (1 hunks)
  • .github/workflows/helm-lint.yaml (3 hunks)
  • .github/workflows/helm.yaml (2 hunks)
  • .github/workflows/reviewdog-k8s.yaml (3 hunks)
  • .github/workflows/reviewdog.yaml (2 hunks)
  • .github/workflows/test-hack.yaml (1 hunks)
  • .github/workflows/unit-test-rust.yaml (1 hunks)
  • .github/workflows/unit-test.yaml (3 hunks)
  • .github/workflows/update-deps.yaml (1 hunks)
  • Makefile (5 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • buf.gen.yaml (1 hunks)
  • cmd/index/job/deletion/main_test.go (1 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/example/client/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/deletion/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • internal/backoff/option.go (0 hunks)
  • internal/client/v1/client/discoverer/discover_test.go (5 hunks)
  • internal/config/benchmark_test.go (4 hunks)
  • internal/config/config.go (2 hunks)
  • internal/config/index_deleter_test.go (1 hunks)
  • internal/core/algorithm/usearch/usearch_test.go (16 hunks)
  • internal/errors/errors.go (1 hunks)
  • internal/errors/errors_test.go (1 hunks)
  • internal/errors/k8s.go (1 hunks)
  • internal/info/info_test.go (17 hunks)
  • internal/iter/iter.go (1 hunks)
  • internal/net/dialer_test.go (1 hunks)
  • internal/net/grpc/errdetails/errdetails.go (6 hunks)
  • internal/net/grpc/metadata_test.go (1 hunks)
  • internal/net/grpc/option_test.go (44 hunks)
  • internal/net/grpc/pool/pool_test.go (5 hunks)
  • internal/net/grpc/server_test.go (2 hunks)
  • internal/net/grpc/stream.go (2 hunks)
  • internal/net/grpc/stream_test.go (4 hunks)
  • internal/net/http/client/client.go (1 hunks)
  • internal/net/http/client/client_test.go (1 hunks)
  • internal/net/net.go (1 hunks)
  • internal/net/net_test.go (1 hunks)
  • internal/net/quic/conn_test.go (1 hunks)
  • internal/net/quic/listener_test.go (1 hunks)
  • internal/params/option.go (2 hunks)
  • internal/params/option_test.go (1 hunks)
  • internal/params/params.go (5 hunks)
  • internal/params/params_test.go (1 hunks)
  • internal/rand/rand.go (1 hunks)
  • internal/servers/server/option_test.go (1 hunks)
  • internal/sync/errgroup/group.go (7 hunks)
  • internal/sync/errgroup/group_test.go (16 hunks)
  • internal/test/data/vector/gen.go (0 hunks)
  • internal/test/data/vector/noise/noise.go (1 hunks)
  • internal/test/data/vector/noise/noise_test.go (1 hunks)
  • internal/test/data/vector/noise/option.go (1 hunks)
  • internal/test/data/vector/noise/option_test.go (1 hunks)
  • internal/timeutil/time.go (1 hunks)
  • internal/timeutil/time_test.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (9 hunks)
  • pkg/discoverer/k8s/service/discover_test.go (4 hunks)
  • pkg/gateway/lb/handler/grpc/aggregation_test.go (2 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (2 hunks)
  • pkg/index/job/deletion/config/config_test.go (1 hunks)
  • pkg/index/job/deletion/service/deleter_test.go (1 hunks)
  • pkg/index/job/deletion/service/options_test.go (1 hunks)
  • pkg/index/job/deletion/usecase/deletion_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/insert_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/job_test.go (12 hunks)
  • pkg/tools/benchmark/job/service/object_test.go (8 hunks)
  • pkg/tools/benchmark/job/service/option_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/remove_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/search_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/update_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/upsert_test.go (4 hunks)
  • pkg/tools/cli/loadtest/service/insert_test.go (11 hunks)
  • pkg/tools/cli/loadtest/service/loader.go (1 hunks)
  • pkg/tools/cli/loadtest/service/loader_test.go (13 hunks)
  • pkg/tools/cli/loadtest/service/search_test.go (9 hunks)
  • tests/v2/e2e/assets/rollout.yaml (1 hunks)
  • tests/v2/e2e/assets/unary_crud.yaml (1 hunks)
  • tests/v2/e2e/config/config.go (1 hunks)
  • tests/v2/e2e/config/enums.go (1 hunks)
  • tests/v2/e2e/crud/crud_test.go (1 hunks)
  • tests/v2/e2e/crud/dataset_test.go (1 hunks)
  • tests/v2/e2e/crud/grpc_test.go (1 hunks)
  • tests/v2/e2e/crud/index_test.go (1 hunks)
  • tests/v2/e2e/crud/modification_test.go (1 hunks)
  • tests/v2/e2e/crud/object_test.go (1 hunks)
  • tests/v2/e2e/crud/search_test.go (1 hunks)
  • tests/v2/e2e/crud/strategy_test.go (1 hunks)
  • tests/v2/e2e/hdf5/hdf5.go (1 hunks)
  • tests/v2/e2e/kubernetes/client.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/option.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/portforward.go (1 hunks)
  • tests/v2/e2e/kubernetes/resources.go (1 hunks)
  • tests/v2/e2e/kubernetes/rollout.go (1 hunks)
  • tests/v2/e2e/kubernetes/status.go (1 hunks)
💤 Files with no reviewable changes (2)
  • internal/backoff/option.go
  • internal/test/data/vector/gen.go
🚧 Files skipped from review as they are similar to previous changes (91)
  • dockers/ci/base/Dockerfile
  • dockers/example/client/Dockerfile
  • dockers/agent/core/agent/Dockerfile
  • dockers/index/operator/Dockerfile
  • .github/workflows/build-binaries.yaml
  • tests/v2/e2e/assets/rollout.yaml
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/index/job/creation/Dockerfile
  • .github/workflows/update-deps.yaml
  • dockers/binfmt/Dockerfile
  • dockers/dev/Dockerfile
  • .github/workflows/unit-test.yaml
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/manager/index/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • .github/workflows/e2e-max-dim.yaml
  • pkg/tools/benchmark/job/service/search_test.go
  • .github/workflows/helm.yaml
  • .github/workflows/helm-lint.yaml
  • .github/workflows/coverage.yaml
  • pkg/tools/cli/loadtest/service/loader.go
  • dockers/tools/cli/loadtest/Dockerfile
  • internal/rand/rand.go
  • dockers/buildkit/Dockerfile
  • pkg/tools/benchmark/job/service/update_test.go
  • cmd/index/job/deletion/main_test.go
  • .github/workflows/chatops.yaml
  • dockers/gateway/lb/Dockerfile
  • tests/v2/e2e/crud/dataset_test.go
  • dockers/tools/benchmark/operator/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • dockers/index/job/deletion/Dockerfile
  • .github/workflows/build-protobuf.yaml
  • dockers/index/job/save/Dockerfile
  • dockers/agent/core/faiss/Dockerfile
  • Makefile.d/e2e.mk
  • pkg/tools/benchmark/job/service/job_test.go
  • .github/workflows/e2e-profiling.yaml
  • dockers/buildbase/Dockerfile
  • tests/v2/e2e/crud/crud_test.go
  • pkg/tools/benchmark/job/service/remove_test.go
  • pkg/tools/benchmark/job/service/object_test.go
  • internal/net/net.go
  • dockers/operator/helm/Dockerfile
  • .github/workflows/e2e-chaos.yaml
  • .github/workflows/unit-test-rust.yaml
  • .github/workflows/reviewdog-k8s.yaml
  • buf.gen.yaml
  • internal/net/quic/conn_test.go
  • .github/workflows/e2e.yaml
  • tests/v2/e2e/crud/index_test.go
  • .github/workflows/format.yaml
  • dockers/discoverer/k8s/Dockerfile
  • internal/errors/errors_test.go
  • dockers/agent/sidecar/Dockerfile
  • tests/v2/e2e/kubernetes/rollout.go
  • internal/config/benchmark_test.go
  • internal/params/params_test.go
  • Makefile.d/functions.mk
  • .github/workflows/_release-pr.yaml
  • dockers/gateway/filter/Dockerfile
  • .github/workflows/fossa.yaml
  • .github/workflows/codeql-analysis.yml
  • dockers/tools/benchmark/job/Dockerfile
  • internal/config/index_deleter_test.go
  • internal/timeutil/time.go
  • .github/workflows/e2e-code-bench-agent.yaml
  • pkg/tools/benchmark/job/service/insert_test.go
  • internal/test/data/vector/noise/option.go
  • .github/workflows/test-hack.yaml
  • internal/net/grpc/server_test.go
  • internal/core/algorithm/usearch/usearch_test.go
  • internal/net/http/client/client_test.go
  • pkg/tools/benchmark/job/service/upsert_test.go
  • tests/v2/e2e/crud/grpc_test.go
  • .github/workflows/reviewdog.yaml
  • pkg/index/job/deletion/config/config_test.go
  • pkg/tools/cli/loadtest/service/insert_test.go
  • dockers/index/job/correction/Dockerfile
  • .github/workflows/_docker-image.yaml
  • Makefile
  • internal/client/v1/client/discoverer/discover_test.go
  • pkg/tools/cli/loadtest/service/search_test.go
  • pkg/agent/core/ngt/service/ngt_test.go
  • internal/config/config.go
  • pkg/tools/cli/loadtest/service/loader_test.go
  • pkg/agent/core/ngt/service/ngt.go
  • pkg/discoverer/k8s/service/discover_test.go
  • internal/sync/errgroup/group.go
  • pkg/gateway/lb/handler/grpc/aggregation_test.go
  • tests/v2/e2e/kubernetes/portforward/portforward.go
🧰 Additional context used
🧠 Learnings (1)
.gitfiles (1)
Learnt from: datelier
PR: vdaas/vald#2807
File: rust/bin/agent/src/handler/object.rs:36-38
Timestamp: 2025-03-13T04:50:01.551Z
Learning: In Rust code for Vald handlers, avoid using unwrap() on Option types. Instead, handle None values explicitly by returning appropriate error statuses to maintain robustness.
🪛 YAMLlint (1.35.1)
tests/v2/e2e/assets/unary_crud.yaml

[error] 202-202: duplication of key "name" in mapping

(key-duplicates)

🔇 Additional comments (75)
internal/net/quic/listener_test.go (1)

1-196: Test skeletons should be implemented or removed

The file contains well-structured test skeletons for QUIC listener functionality, but they're entirely commented out with an explicit "NOT IMPLEMENTED BELOW" note. While the structure follows good testing practices with proper setup for test cases, check functions, and leak detection, they lack actual implementation.

I recommend either:

  1. Implementing at least basic test cases to provide real test coverage for the QUIC listener components, which would align with the PR's focus on improving the E2E testing framework, or
  2. Removing these commented-out skeletons until they're ready to be implemented

Commented-out code in the codebase can lead to confusion and maintenance challenges over time.

pkg/index/job/deletion/service/options_test.go (1)

1-347: File still contains only commented-out test code.

This file appears to be a placeholder with commented-out test functions. While the structure is well-designed with proper argument types, expected results, and test setup, none of the tests are actually executable in their current state.

For this file to be useful as part of the new V2 E2E testing framework, the tests need to be uncommented and properly implemented. This includes adding:

  • Required import statements (reflect, errors, goleak)
  • Concrete test cases for each function
  • Proper expectations based on the actual implementations
#!/bin/bash
# Check for the implementations of the functions being tested
echo "Looking for the option functions that should be tested:"
rg -A 2 "func With(Discoverer|IndexingConcurrency|TargetAddrs|TargetIndexID)" pkg/index/job/deletion/service/
pkg/tools/benchmark/job/service/option_test.go (1)

1655-1692: Consider implementing actual test cases to verify functionality

The test cases section contains only TODOs and commented placeholder templates. While the structure is in place, there are no actual test cases to verify the WithMetadata functionality.

I recommend implementing at least these test cases:

  1. Test with nil map
  2. Test with empty map
  3. Test with populated map
  4. Test with map containing special characters
 	tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       args: args {
-		           m:nil,
-		       },
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+			name: "nil map",
+			args: args{
+				m: nil,
+			},
+			want: want{
+				want: WithMetadata(nil),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "empty map",
+			args: args{
+				m: map[string]string{},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "populated map",
+			args: args{
+				m: map[string]string{"key1": "value1", "key2": "value2"},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{"key1": "value1", "key2": "value2"}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
internal/servers/server/option_test.go (1)

3727-4066: Implementation of the gRPC configuration test functions commended.

These four test functions are now added to verify the gRPC configuration options that are critical for the V2 E2E testing framework. As noted in the previous review comments, these tests were requested to validate the functionality of important gRPC options like MaxConcurrentStreams, NumStreamWorkers, SharedWriteBuffer, and WaitForHandlers.

internal/net/grpc/pool/pool_test.go (6)

2874-2877: Improved variable naming for better readability

The change from want and want1 to more descriptive wantConn and wantOk improves code readability by making the purpose of each field clearer. This type of semantic naming is particularly helpful in test code.


2887-2893: Consistently updated function parameters with more descriptive names

The defaultCheckFunc parameters have been properly updated to match the new field names in the want struct, maintaining consistency throughout the test code while improving readability.


3009-3010: Function call parameters correctly aligned with new naming convention

The variable assignments and function call have been correctly updated to use the new parameter names, maintaining consistency with the changes made to the struct fields and function signatures.


3042-3046: Enhanced struct fields with clearer naming

The addition of wantIdx and renaming to wantConn and wantOk provides more explicit naming that better communicates the purpose of each field, which is particularly valuable in test code where clear expectations are important.


3052-3065: Updated function signature and comparison logic with improved naming

The function signature and comparison logic have been correctly updated to match the new field names, with proper handling of all parameters including the additional gotIdx parameter that corresponds to the new wantIdx field.


3185-3186: Function call correctly updated to match new function signature

The function call and result handling now properly capture and use the additional index parameter in the method call, maintaining consistency with the updated function signature.

internal/test/data/vector/noise/noise.go (3)

85-105: Guard against potential division by zero.

If all vectors in data are non-nil but empty, count stays zero, causing a division by zero at line 105. This was previously flagged and remains a concern.


108-123: Handle edge case for required near zero.

When required equals 0 or 1, subtracting 1 leads to an unintended shift for bits.Len64(required-1). Ensure the logic handles this boundary case safely.


180-181: Confirm Go 1.21+ for slices.Clone.

slices.Clone is only available in the standard library starting from Go 1.21. Ensure your build environment meets this requirement or use a compatible alternative.

internal/net/grpc/option_test.go (9)

532-615: Good reorganization of backoff testing functions!

The renaming of test functions and parameter updates better align with the intended testing focus on maximum backoff delay settings.


617-700: Proper parameter typing for backoff base delay tests.

The use of string type for duration parameters is consistent with other timing-related tests in the codebase.


702-785: Appropriate type for multiplier testing.

Using a float64 parameter for the backoff multiplier correctly matches the expected data type for this configuration option.


787-870: Proper parameter type for jitter testing.

Using float64 for the jitter parameter is appropriate as jitter values are typically represented as decimal values.


1042-1125: Well-structured backoff testing with proper type.

Using the specific backoff.Backoff type for the parameter shows good type safety and clarity in the test API.


1127-1210: Good integration of circuit breaker testing.

Using the circuitbreaker.CircuitBreaker type properly enables testing of circuit breaker functionality within the gRPC options.


2408-2494: Good addition of network parameter to dialer function.

Adding the network parameter to the WithDialer function provides better flexibility in specifying the network type (tcp, udp, etc.) for the connection.


2581-3174: Comprehensive addition of new test functions for connection options.

The addition of these new test functions (WithAuthority, WithDisableRetry, WithIdleTimeout, etc.) provides a more complete test coverage for gRPC connection configuration options.


532-3174:

✅ Verification successful

Verify function renaming correctness with implementation code.

The renaming of test functions suggests corresponding changes in the implementation code. Ensure that these test function renamings match the actual implementation functions they are testing.


🏁 Script executed:

#!/bin/bash
# Check for the implementation functions corresponding to the test functions

# Looking for implementation functions like WithBackoffMaxDelay, WithBackoffBaseDelay, etc.
echo "Checking for grpc option implementation functions:"
rg -A 1 "func With(Backoff|Circuit|Call|Max|Min|Authority|Dialer|Disable)" internal/net/grpc/

Length of output: 4220


Action Required: Confirm Test and Implementation Function Name Consistency

The verification shows that all implementation functions corresponding to the test functions (e.g., WithBackoffMaxDelay, WithBackoffBaseDelay, WithBackoffMultiplier, WithBackoffJitter, WithMinConnectTimeout, WithBackoff, WithCircuitBreaker, WithCallOptions, and others) are correctly defined in the code (primarily in internal/net/grpc/option.go and related files). The renaming in the test file aligns with the current implementation, so no mismatches were found.

internal/net/grpc/errdetails/errdetails.go (5)

93-94: LGTM! Improved string manipulation for type URL extraction

The code now correctly handles both prefix formats for extracting the type name.


165-167: Improved error detail handling for unrecognized message types

The default case addition enhances flexibility by handling any proto.Message type through protojson.Marshal, making the system more robust when dealing with various message types.


168-172: Enhanced error logging for marshaling failures

The improved error check now logs detailed information when marshaling fails, including the type name, which will significantly help with debugging.


316-318: LGTM! Improved handling of multiple error details

The change to use the new Details struct for marshaling multiple messages improves the structure and consistency of the serialized output.


416-421: Enhanced flexibility for handling unknown Any types

The addition of a default case for any unrecognized message types improves the robustness of the AnyToErrorDetail function by attempting to unmarshal any type instead of failing silently.

internal/net/http/client/client.go (2)

37-38: LGTM! Clean refactoring of New to use NewWithTransport

The original New function now properly delegates to the more flexible NewWithTransport function with the default transport.


40-50: Fixed potential nil pointer dereference issue

The implementation now correctly handles the case where the provided RoundTripper is not of type *http.Transport by initializing with the default transport, addressing the previous review comment about potential nil pointer dereference.

internal/net/grpc/metadata_test.go (1)

18-101: Test template needs implementation or explanation

The TestNewMetadata function remains commented out without implementation or explanation. As noted in previous reviews, this doesn't follow the pattern seen in other test files and reduces test coverage for the NewMetadata function.

Please either:

  1. Implement concrete test cases for NewMetadata, or
  2. Add a comment explaining why this test remains commented out
#!/bin/bash
# Checking how many exported functions in the metadata.go file have corresponding tests

echo "Checking for the NewMetadata function implementation:"
rg -A 2 "^func NewMetadata" internal/net/grpc/metadata.go

echo "Checking test coverage for exported functions in metadata.go:"
rg -l "^func Test" internal/net/grpc/ | grep metadata_test
internal/net/net_test.go (2)

1201-1284: Implement actual test cases for TestIsUDP function.

The test function is well-structured but currently commented out and lacks actual test cases. Network type checking functions are critical for reliability and deserve thorough testing.

Consider implementing test cases for:

  1. Standard network types (e.g., "udp")
  2. Variant types (e.g., "udp4", "udp6")
  3. Case sensitivity (e.g., "UDP", "Udp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings

1286-1369: Implement actual test cases for TestIsTCP function.

Similar to TestIsUDP, this test function is well-structured but currently commented out and lacks actual test cases.

Consider implementing test cases for various TCP network types and edge cases to ensure robust validation.

internal/net/grpc/stream.go (3)

179-181: Appropriate concurrency limit implementation

The concurrency limit is correctly implemented by setting the error group limit when the concurrency parameter is greater than zero. This allows for controlling the number of concurrent operations while still supporting unlimited concurrency when needed.


212-237: Concurrent send implementation with proper synchronization

The implementation now uses goroutines to send messages concurrently while ensuring proper synchronization using a WaitGroup. This is a significant improvement over the previous synchronous implementation as it:

  1. Allows for higher throughput by sending messages in parallel
  2. Properly manages synchronization with WaitGroup to ensure all sends complete before closing
  3. Maintains the error handling mechanism of the original implementation

171-172:

✅ Verification successful

Function signature updated with concurrency parameter

The BidirectionalStreamClient function now includes a concurrency parameter that controls the maximum number of concurrent operations. This is a breaking change that will require updates to all calling code.


🏁 Script executed:

#!/bin/bash
# Find all places where BidirectionalStreamClient is called to ensure they're updated
rg -A 2 "BidirectionalStreamClient\(" --glob '!internal/net/grpc/stream*.go'

Length of output: 1560


Breaking Change Confirmed: Concurrency Parameter Integrated in BidirectionalStreamClient

The updated function signature in internal/net/grpc/stream.go correctly introduces the concurrency parameter. Verification of call sites (including in pkg/tools/cli/loadtest/service/loader.go and various tests under tests/v2/e2e/) confirms that all invocations now pass the appropriate concurrency value. This breaking change has been consistently addressed across the codebase, so callers are already updated accordingly.

internal/net/grpc/stream_test.go (2)

206-210: Updated test arguments structure

The test argument structure has been appropriately updated to match the new function signature of BidirectionalStreamClient, with the new concurrency parameter and renamed function parameters (sendDataProvider and callBack).


290-290: Updated function call in test

The call to BidirectionalStreamClient has been correctly updated to include the new concurrency parameter.

internal/params/option.go (5)

20-24: Added necessary imports for file path operations

The added imports for os and filepath are needed for the new functionality that retrieves the executable name.


27-36: Enhanced default options with automatic name inference

The default options now include setting the parser's name to the executable name (filepath.Base(os.Args[0])) and a default value for overriding command line flags. This is a good enhancement that provides sensible defaults without requiring additional configuration.


38-45: Robust implementation of WithName option

The WithName function correctly handles empty strings by not updating the parser's name in that case, which is a good defensive programming practice.


89-94: Implementation of WithOverrideDefault option

The WithOverrideDefault function provides a clean way to control whether the parser should override default command line flags.


96-109: Well-designed WithArgumentFilters implementation

The WithArgumentFilters function:

  1. Handles the case when no filters are provided (early return)
  2. Initializes the filters slice if it's nil
  3. Appends the provided filters to the existing ones

This is a well-designed function that follows Go best practices for handling zero values and variable arguments.

internal/net/dialer_test.go (1)

1993-2079: Test skeleton for isQUICDial needs implementation

This commented-out test function follows a good structure for testing, but like other test skeletons in the PR, it lacks actual implementation. Having placeholder tests in the codebase can lead to technical debt if they're left unimplemented for extended periods.

Consider either:

  1. Implementing concrete test cases that validate the isQUICDial function's behavior, or
  2. Removing the commented-out code until you're ready to implement the tests

If this is part of a larger testing initiative, it would be better to implement tests incrementally in separate PRs rather than adding multiple commented-out skeletons.

internal/params/option_test.go (1)

450-705: Implement the commented-out test functions

The file contains three new test functions that are entirely commented out: TestWithName, TestWithOverrideDefault, and TestWithArgumentFilters. Each function has a structure with:

  1. None of these tests will execute since they're commented out
  2. The test cases contain TODO markers and lack actual implementation
  3. These commented tests use tt.Parallel() and goleak.IgnoreCurrent() while existing tests don't

Consider either:

  1. Implementing and uncommenting these test functions
  2. Removing the commented code if it's not ready for inclusion

If these are intended as templates for future implementation, consider adding a comment explaining why they're commented out and when they should be implemented.

pkg/gateway/lb/handler/grpc/handler_test.go (5)

805-807: Good addition of attribute validation in tests

The new wantAttrs field in the want struct appropriately supports testing of attribute return values from the doSearch method.


814-814: Properly updated function signature

The checkFunc signature is correctly updated to handle the new attribute parameter, maintaining consistency with the implementation changes.


818-818: Consistent implementation in defaultCheckFunc

The parameter update is consistently applied to the defaultCheckFunc as well, which is good practice.


825-827: Comprehensive attribute validation logic

The added validation logic correctly compares the gotAttrs against the expected wantAttrs using reflection, maintaining the same validation pattern as other fields.


923-924: Correctly captures and validates attributes

The updated method invocation now properly captures the gotAttrs return value and passes it to the checkFunc for validation, completing the test enhancement.

internal/params/params.go (7)

29-35: Constants and type alias look good
Defining ErrorHandling as a type alias for flag.ErrorHandling along with these constants is clear and aligns with standard usage.


54-70: Struct changes appear consistent
Adding fields for overrideDefault, name, filters, and ErrorHandler enhances configurability and clarity in parsing logic. The initialization is cohesive, and references to these fields appear correct.


78-82: Reiterating concurrency caution on global flag override
This pattern overrides the global flag.CommandLine when p.overrideDefault is true, which can cause conflicts if multiple parser instances run concurrently.


105-115: Efficient argument filtering with DeleteFunc
Using slices.DeleteFunc to remove unwanted arguments is performant and concise. Ensure the filtering logic is tested for edge cases (e.g., all arguments filtered out).


117-129: Robust error handling
The approach to distinguish between help requests (flag.ErrHelp) and genuine parse failures is sound. Returning (nil, true, nil) to signal help usage is a clean design.


135-145: Global FlagSet restoration
Calling Restore() and Override() modifies flag.CommandLine, which remains unsafe in concurrent scenarios. Consider documenting thread-safety implications or adopting a concurrency-safe design.


23-23:

✅ Verification successful

Confirm Go version support for 'slices' package
Importing "slices" requires Go 1.21 or newer. Ensure that the project’s build environment meets this requirement to prevent compatibility issues.

Run this script to check the Go version and confirm it’s at least 1.21:


🏁 Script executed:

#!/bin/bash
# Description: Parse go.mod and check for Go version usage
if [ -f "go.mod" ]; then
  grep '^go ' go.mod
else
  echo "go.mod not found"
fi

Length of output: 50


Go Version Requirement Met

The project's go.mod indicates go 1.24.0, which meets the requirement for using the "slices" package (available in Go 1.21 and newer). No further changes are necessary.

internal/iter/iter.go (2)

53-59: Return a no-op iterator instead of nil
Returning nil for empty slices can lead to unexpected panics if the caller tries to iterate. Providing a no-op Cycle would allow safe iteration calls without special-case checks.


1-153: Good use of context cancellation
All iteration methods (Seq, Seq2, Values, ForEach) properly handle ctx.Done() checks, ensuring gracefully interrupted loops. Overall, the design is consistent and readable.

tests/v2/e2e/config/enums.go (1)

1-112: Well-structured enumerations for E2E testing.

The enumerations defined in this file provide a good foundation for the E2E testing framework. The use of string-based types for enumerations is a good practice in Go, and the constants are logically grouped based on their functionality.

tests/v2/e2e/kubernetes/status.go (3)

92-113: Consider making the ticker interval user-configurable.

Previously, it was recommended to allow a configurable polling interval or a fallback timeout for this loop. Relying on a hardcoded 5-second interval is convenient, but if the user forgets to specify a context timeout, this loop could potentially run indefinitely.


185-246: Deployment conditions: add check for DeploymentReplicaFailure condition.

This function currently checks only DeploymentProgressing and DeploymentAvailable. Including an explicit check for DeploymentReplicaFailure could provide faster detection of certain issues, such as insufficient resources or scheduling bottlenecks.


310-340: Refine DaemonSet condition checks to avoid using a placeholder.

Using appsv1.DaemonSetConditionType("") might skip real condition types (e.g., DaemonSetReplicaFailure). Enumerating the known condition types or checking for key statuses ensures better visibility into actual issues.

tests/v2/e2e/config/config.go (1)

185-193: Add stricter validation for metadata inputs.

When splitting MetaString into key-value pairs, the code does not impose restrictions on length or allowed characters. Without checks, adversarial or malformed inputs could leak into d.Metadata.

tests/v2/e2e/assets/unary_crud.yaml (1)

202-202: No duplication detected for the “name” key.

The static analysis hint about a duplicated “name” key does not appear to reflect the current lines. It seems to be a false positive.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 202-202: duplication of key "name" in mapping

(key-duplicates)

tests/v2/e2e/kubernetes/client.go (1)

94-99:

❓ Verification inconclusive

Question default QPS & Burst settings.
You force QPS to 20.0 and Burst to 30 if they are both unset. Small clusters or performance-sensitive setups might require different values. Consider exposing these configuration parameters or verifying they are appropriate for all use cases.

Would you like to confirm usage of these defaults across tests and production code? If so, here is a script to search for references to newClient:


🏁 Script executed:

#!/bin/bash
# Searching references to newClient usage to ensure appropriate QPS & Burst
rg -A 5 $'newClient\\('

Length of output: 3471


Review Verification: Default QPS & Burst Settings

The search results confirm that the default values (QPS = 20.0 and Burst = 30) are set in the Kubernetes E2E client (tests/v2/e2e/kubernetes/client.go) via the newClient function. Other parts of the code (e.g., the Redis client and CRUD tests) use their own implementations of newClient without a similar fallback behavior. Given this, please:

  • Verify that these defaults are intended only for the E2E Kubernetes client and do not inadvertently affect production configurations.
  • Consider exposing the QPS and Burst parameters (or at least document the rationale) to allow custom tuning for smaller clusters or performance-sensitive setups.
tests/v2/e2e/kubernetes/portforward/option.go (1)

95-101: Validate port mappings.
Consider validating that mapped ports are within a valid range and non-zero, preventing silent misconfigurations.

tests/v2/e2e/hdf5/hdf5.go (1)

57-66: Confirm concurrency safety in InitNoiseFunc.
The sync.Once usage correctly ensures that noiseFunc initialization happens only once, even if multiple goroutines call InitNoiseFunc concurrently. This pattern appears safe and efficient.

tests/v2/e2e/crud/search_test.go (1)

307-330: Appreciate leftover requests handling in multiSearch.
Calling exec(reqs) after the loop ensures any partial batches are processed, preventing dropped requests. This is a clean approach to handling inexact multiples of BulkSize.

tests/v2/e2e/kubernetes/resources.go (1)

562-608: No overshadowed errors in SetPodAnnotations.
Your current implementation returns on the first error, preventing overshadowing of earlier failures. This resolves the past concern about losing context.

.gitfiles (6)

2034-2052: Comprehensive V2 E2E strategic testing framework added

The introduction of the V2 E2E testing framework in tests/v2/e2e/ represents a significant enhancement to the Vald project's testing capabilities. The framework includes:

  • Configuration files and enums
  • CRUD test implementations with various strategies
  • HDF5 dataset handling
  • Kubernetes integration with resource management
  • Port forwarding capabilities
  • Rollout and status management utilities

This structured approach will greatly improve the testability and reliability of the Vald project.


1087-1087: New iterator abstraction added to improve code reusability

The addition of internal/iter/iter.go introduces a new abstraction for iteration patterns, which should improve code reusability and maintainability throughout the codebase.


1985-1989: QBG algorithm support added to Rust implementation

The addition of the Quantization-Based Graph (QBG) algorithm to the Rust implementation expands Vald's algorithm options and maintains feature parity between the Go and Rust implementations.


1273-1275: Address QUIC spelling issue in cspell configuration

The cspell tool is flagging "quic" as an unknown word in these test files. QUIC (Quick UDP Internet Connections) is a legitimate networking protocol, so this should be added to your cspell dictionary.

#!/bin/bash
# Add "quic" to cspell dictionary or verify its configuration

# Check if .cspell.json exists and if "quic" is already in the dictionary
if [ -f .cspell.json ]; then
  grep -q "quic" .cspell.json
  if [ $? -eq 0 ]; then
    echo "quic is already in the cspell dictionary"
  else
    echo "quic is not in the cspell dictionary and should be added"
  fi
else
  echo ".cspell.json not found"
fi

161-177: API documentation has been expanded

The addition of multiple documentation files for the API endpoints enhances the project's documentation and makes it easier for users to understand and use the Vald API effectively.


1-2110: Overall structure is well-organized and aligned with PR objectives

The modifications to .gitfiles properly track all the new files introduced as part of this PR. The changes align well with the stated PR objectives of refactoring and adding V2 E2E strategic testing. The file organization maintains a clean structure with appropriate separation of concerns between different components and test frameworks.

Comment on lines +91 to +175
// func TestWithTableDivisionFactor(t *testing.T) {
// type args struct {
// f uint64
// }
// type want struct {
// want Option
// }
// type test struct {
// name string
// args args
// want want
// checkFunc func(want, Option) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got Option) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// f:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// f:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := WithTableDivisionFactor(test.args.f)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
//
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add realistic test scenarios.

TestWithTableDivisionFactor is also commented out. To ensure confidence in the option’s correctness, please fill in detailed test cases. Otherwise, consider removing these placeholders.

Comment on lines +5 to +95
// func TestNew(t *testing.T) {
// type args struct {
// data [][]float32
// num uint64
// opts []Option
// }
// type want struct {
// want Modifier
// }
// type test struct {
// name string
// args args
// want want
// checkFunc func(want, Modifier) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got Modifier) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// data:nil,
// num:0,
// opts:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// data:nil,
// num:0,
// opts:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := New(test.args.data, test.args.num, test.args.opts...)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
//
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Complete the TestNew function.

Currently, it's fully commented out, resulting in zero coverage for the New constructor logic. Filling in real test cases will validate the noise generator setup.

Comment on lines +996 to +1094
// func TestStackTrace_ShortString(t *testing.T) {
// type fields struct {
// URL string
// FuncName string
// File string
// Line int
// }
// type want struct {
// want string
// }
// type test struct {
// name string
// fields fields
// want want
// checkFunc func(want, string) error
// beforeFunc func(*testing.T)
// afterFunc func(*testing.T)
// }
// defaultCheckFunc := func(w want, got string) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// fields: fields {
// URL:"",
// FuncName:"",
// File:"",
// Line:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// fields: fields {
// URL:"",
// FuncName:"",
// File:"",
// Line:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
// s := StackTrace{
// URL: test.fields.URL,
// FuncName: test.fields.FuncName,
// File: test.fields.File,
// Line: test.fields.Line,
// }
//
// got := s.ShortString()
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Implement test cases for TestStackTrace_ShortString.

The new test function for ShortString is structured but lacks actual test cases. As this appears to be testing a new method, it's important to verify its functionality with various input scenarios.

Consider adding test cases that:

  1. Test with various URL, FuncName, File, and Line combinations
  2. Test edge cases like empty fields
  3. Verify the correct formatting of the short string output

Comment on lines +185 to +263
// func TestDurationString_Duration(t *testing.T) {
// type want struct {
// want time.Duration
// err error
// }
// type test struct {
// name string
// d DurationString
// want want
// checkFunc func(want, time.Duration, error) error
// beforeFunc func(*testing.T)
// afterFunc func(*testing.T)
// }
// defaultCheckFunc := func(w want, got time.Duration, err error) error {
// if !errors.Is(err, w.err) {
// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err)
// }
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got, err := test.d.Duration()
// if err := checkFunc(test.want, got, err); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Implement test cases for TestDurationString_Duration.

The test function is well-structured but currently commented out and lacks actual test cases. Time handling is critical for system reliability.

Consider adding test cases for:

  1. Valid duration strings (e.g., "1s", "5m", "2h")
  2. Invalid duration strings
  3. Edge cases (empty strings, extremely large values)

Comment on lines +20 to +23
import (
"context"
"iter"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify import alias “iter”
Importing "iter" inside the iter package might lead to circular dependencies or naming confusion if it refers to the same module. Double-check that this import is intentional and correctly resolves to an external package (or a distinct internal package).


🏁 Script executed:

#!/bin/bash
# Description: Verify package references to confirm no circular import with "iter"
rg --context 5 'package iter' .

Length of output: 566


Review Update: Verify Import Alias “iter”
The investigation confirms that the file internal/iter/iter.go declares package iter and then imports "iter". This is concerning because importing a package with the same name as the current package can lead to circular dependency issues or create ambiguity about which package is being referenced. Please ensure that the import "iter" is intentional and that it indeed refers to an external or distinct module rather than recursively importing the current package.

  • If the intent was to reference an external package, consider either renaming the import alias (e.g., iterpkg "iter") or restructuring the module paths to avoid the confusion.
  • If the import is unintentional, remove it to prevent potential circular dependency problems.

Comment on lines 162 to 169
// Execute the modify gRPC call.
res, err := call(ctx, newReq(id))
if err != nil {
log.Errorf("object request id %s returned %v", id, err)
// Handle the error using the centralized error handler.
handleGRPCCallError(t, err, plan)
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Return errors to ensure test coverage.
In your goroutines, the error is logged and then replaced with nil. This prevents errgroup.Wait() from collecting failures. If you want the test to fail on error, consider returning the error.

res, err := call(ctx, newReq(id))
if err != nil {
    log.Errorf("object request id %s returned %v", id, err)
    handleGRPCCallError(t, err, plan)
-   return nil
+   return err
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Execute the modify gRPC call.
res, err := call(ctx, newReq(id))
if err != nil {
log.Errorf("object request id %s returned %v", id, err)
// Handle the error using the centralized error handler.
handleGRPCCallError(t, err, plan)
return nil
}
// Execute the modify gRPC call.
res, err := call(ctx, newReq(id))
if err != nil {
log.Errorf("object request id %s returned %v", id, err)
// Handle the error using the centralized error handler.
handleGRPCCallError(t, err, plan)
return err
}

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🔭 Outside diff range comments (1)
pkg/index/job/deletion/service/deleter_test.go (1)

520-520: 🛠️ Refactor suggestion

Missing imports need to be added when implementing tests.

The file doesn't include import statements, which will be necessary for the actual implementation.

When implementing, ensure you add these imports:

import (
	"context"
	"reflect"
	"testing"

	"github.com/vdaas/vald/apis/grpc/v1/payload"
	"github.com/vdaas/vald/apis/grpc/v1/vald"
	"github.com/vdaas/vald/internal/errors"
	"github.com/vdaas/vald/pkg/discoverer"
	"go.uber.org/goleak"
	"google.golang.org/grpc"
)
♻️ Duplicate comments (11)
pkg/index/job/deletion/usecase/deletion_test.go (5)

1-672: ⚠️ Potential issue

Uncomment and implement all test functions.

The file contains a comprehensive test structure for all the runner methods, but everything is commented out. This was previously identified in past reviews and some functions were reportedly fixed in commit 57792a5, but they appear to be commented out again in this PR.

Uncomment and implement the following test functions:

  • TestNew (lines 5-93)
  • Test_run_PreStart (lines 95-208)
  • Test_run_Start (lines 210-327)
  • Test_run_PreStop (lines 329-442)
  • Test_run_Stop (lines 444-557)
  • Test_run_PostStop (lines 559-672)

3-3: ⚠️ Potential issue

Add missing import statements.

The test file is missing necessary imports for packages used throughout the tests, such as context, errors, reflect, testing, and others needed for the code to compile.

Add these imports after the package declaration:

 package usecase

+import (
+	"context"
+	"errors"
+	"reflect"
+	"testing"
+
+	"golang.org/x/sync/errgroup"
+	"go.uber.org/goleak"
+	
+	"github.com/vdaas/vald/internal/config"
+	"github.com/vdaas/vald/internal/errors"
+	"github.com/vdaas/vald/internal/observability"
+	"github.com/vdaas/vald/internal/runner"
+	"github.com/vdaas/vald/internal/servers/starter"
+	"github.com/vdaas/vald/pkg/index/job/deletion/service"
+)

31-67: 🛠️ Refactor suggestion

Implement actual test cases for the New function.

The test function has placeholder TODOs instead of actual test cases. For a comprehensive test, include cases for valid configuration, nil configuration, and invalid configuration parameters.

Here's an example implementation:

 tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       args: args {
-		           cfg:nil,
-		       },
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+			name: "success_with_valid_config",
+			args: args{
+				cfg: &config.Data{
+					// Fill with valid test configuration
+				},
+			},
+			want: want{
+				want: &run{
+					// Expected valid runner
+				},
+				err: nil,
+			},
+		},
+		{
+			name: "failure_with_nil_config",
+			args: args{
+				cfg: nil,
+			},
+			want: want{
+				want: nil,
+				err: errors.ErrInvalidConfig,
+			},
+		},

125-175: 🛠️ Refactor suggestion

Add test cases for the PreStart function.

Replace the TODO placeholders with actual test cases for the PreStart function, including success and failure scenarios.

Example test cases should include:

  1. Successful PreStart execution
  2. Error handling with nil context
  3. Error handling when dependencies fail to initialize

244-294: 🛠️ Refactor suggestion

Add test cases for the Start function that tests error channel behavior.

The Start function returns an error channel, which requires specific testing techniques. Add test cases that verify both successful startup and error propagation through the channel.

You'll need to implement:

  1. Test with mock server and indexer that start successfully
  2. Test with dependencies that return errors during startup
  3. Verification of error channel behavior using goroutines
internal/net/http/client/client_test.go (1)

215-305: ⚠️ Potential issue

Implement tests for the NewWithTransport function.

While the test structure is well-designed, the test is currently commented out and lacks actual test cases. Since NewWithTransport is now part of the public API, implementing at least some basic test cases is important to verify its functionality and prevent regressions.

Consider implementing the following test cases:

  1. Basic test with default options
  2. Test with custom transport options
  3. Test with a non-*http.Transport implementation
  4. Error handling test for invalid options

Here's an example implementation to get you started:

func TestNewWithTransport(t *testing.T) {
	type args struct {
		rt   http.RoundTripper
		opts []Option
	}
	type want struct {
		want *http.Client
		err  error
	}
	type test struct {
		name       string
		args       args
		want       want
		checkFunc  func(want, *http.Client, error) error
		beforeFunc func(*testing.T, args)
		afterFunc  func(*testing.T, args)
	}
	defaultCheckFunc := func(w want, got *http.Client, err error) error {
		if !errors.Is(err, w.err) {
			return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err)
		}
		if diff := comparator.Diff(got, w.want, clientComparator...); diff != "" {
			return errors.New(diff)
		}
		return nil
	}
	
	customTransport := &http.Transport{
		DisableKeepAlives: true,
	}
	
	tests := []test{
		{
			name: "initialize success with default http.Transport",
			args: args{
				rt:   http.DefaultTransport,
				opts: nil,
			},
			want: want{
				want: &http.Client{
					Transport: htr.NewExpBackoff(
						htr.WithRoundTripper(func() http.RoundTripper {
							tr := new(http.Transport)
							tr.Proxy = http.ProxyFromEnvironment
							_ = http2.ConfigureTransport(tr)
							return tr
						}()),
						htr.WithBackoff(
							backoff.New(),
						),
					),
				},
			},
		},
		{
			name: "initialize success with custom http.Transport",
			args: args{
				rt:   customTransport,
				opts: nil,
			},
			want: want{
				want: &http.Client{
					Transport: htr.NewExpBackoff(
						htr.WithRoundTripper(customTransport),
						htr.WithBackoff(
							backoff.New(),
						),
					),
				},
			},
		},
		// Add more test cases here
	}

	for _, tc := range tests {
		test := tc
		t.Run(test.name, func(tt *testing.T) {
			tt.Parallel()
			defer goleak.VerifyNone(tt, goleakIgnoreOptions...)
			if test.beforeFunc != nil {
				test.beforeFunc(tt, test.args)
			}
			if test.afterFunc != nil {
				defer test.afterFunc(tt, test.args)
			}
			checkFunc := test.checkFunc
			if test.checkFunc == nil {
				checkFunc = defaultCheckFunc
			}

			got, err := NewWithTransport(test.args.rt, test.args.opts...)
			if err := checkFunc(test.want, got, err); err != nil {
				tt.Errorf("error = %v", err)
			}
		})
	}
}
tests/v2/e2e/assets/unary_crud.yaml (1)

191-202: ⚠️ Potential issue

Fix duplicate key in YAML mapping.

There's a duplication of the "name" key in the mapping at lines 191 and 202, which is not valid YAML. Also, there's a typo in "Inset Operation".

Apply this fix:

-      - name: Inset Operation
+      - name: Insert Operation
        executions:
          - name: Insert
            type: insert
            mode: unary
            parallelism: 10
            num: 30000
            wait: 2m
          - mode: unary
            name: IndexInfo
            type: index_info
-        name: Insert -> IndexInfo
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 202-202: duplication of key "name" in mapping

(key-duplicates)

internal/net/net_test.go (2)

1201-1284: 🛠️ Refactor suggestion

Implement test cases for IsUDP function

The test template for IsUDP is structured well but needs actual test cases to verify the function's behavior.

Please uncomment and implement comprehensive test cases for:

  1. Standard UDP network types (e.g., "udp")
  2. Variant types (e.g., "udp4", "udp6")
  3. Case sensitivity (e.g., "UDP", "Udp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings

Example implementation:

-// TODO test cases
+{
+    name: "returns true for standard udp",
+    args: args{
+        network: "udp",
+    },
+    want: want{
+        want: true,
+    },
+},
+{
+    name: "returns true for udp4",
+    args: args{
+        network: "udp4",
+    },
+    want: want{
+        want: true,
+    },
+},
+{
+    name: "returns false for tcp",
+    args: args{
+        network: "tcp",
+    },
+    want: want{
+        want: false,
+    },
+},

1286-1369: 🛠️ Refactor suggestion

Implement test cases for IsTCP function

The test template for IsTCP is structured well but needs actual test cases to verify the function's behavior.

Please uncomment and implement comprehensive test cases for:

  1. Standard TCP network types (e.g., "tcp")
  2. Variant types (e.g., "tcp4", "tcp6")
  3. Case sensitivity (e.g., "TCP", "Tcp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings

Example implementation:

-// TODO test cases
+{
+    name: "returns true for standard tcp",
+    args: args{
+        network: "tcp",
+    },
+    want: want{
+        want: true,
+    },
+},
+{
+    name: "returns true for tcp6",
+    args: args{
+        network: "tcp6",
+    },
+    want: want{
+        want: true,
+    },
+},
+{
+    name: "returns false for udp",
+    args: args{
+        network: "udp",
+    },
+    want: want{
+        want: false,
+    },
+},
internal/test/data/vector/noise/noise.go (1)

79-106: ⚠️ Potential issue

Guard against division by zero when computing average standard deviation.
If all sub-slices are empty, count remains zero, which triggers a division by zero at line 105.

     // ...
     if count == 0 {
+       return 0.01
     }
     return float32(totalStd/float64(count)) * ng.noiseLevelFactor
tests/v2/e2e/crud/search_test.go (1)

57-58: ⚠️ Potential issue

Prevent potential division by zero when neighbors is empty.

If neighbors is an empty slice, float64(len(neighbors)) would be 0, leading to an infinite or NaN result. Safeguard against this case by returning 0 or logging a warning when there are no neighbors.

 func recall(t *testing.T, resultIDs []string, neighbors []int) float64 {
   ...
   // Return the recall as a ratio.
+  if len(neighbors) == 0 {
+    return 0
+  }
   return float64(count) / float64(len(neighbors))
 }
🧹 Nitpick comments (36)
pkg/index/job/deletion/usecase/deletion_test.go (2)

330-332: Improve parameter naming for the PreStop context.

The parameter name in0 is not descriptive. Rename it to a more meaningful name like ctx for better code readability.

 type args struct {
-	in0 context.Context
+	ctx context.Context
 }

559-561: Improve parameter naming for the PostStop context.

The parameter name in0 is not descriptive. Rename it to a more meaningful name like ctx for better code readability.

 type args struct {
-	in0 context.Context
+	ctx context.Context
 }
internal/errors/errors.go (1)

86-88: LGTM! Adding new error function for unimplemented features.

The new ErrUnimplemented function follows the same pattern as other error functions in this file, providing a consistent way to handle unimplemented features across the codebase.

Consider adding a documentation comment above the function, similar to other error functions in this file:

+	// ErrUnimplemented represents a function to generate an error for unimplemented features.
	ErrUnimplemented = func(name string) error {
		return Errorf("%s is unimplemented", name)
	}
pkg/tools/cli/loadtest/service/loader.go (1)

207-207: Add test coverage for these modified lines.

Static analysis reports that the modified lines are not covered by tests. Consider adding test cases to verify the behavior with different concurrency values.

Would you like help creating test cases for these changes to ensure the concurrency parameter is properly handled in different scenarios?

Also applies to: 212-212

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 207-207: pkg/tools/cli/loadtest/service/loader.go#L207
Added line #L207 was not covered by tests

tests/v2/e2e/assets/unary_crud.yaml (1)

124-370: Comprehensive test strategy configuration.

The strategies section defines a series of well-structured test scenarios that cover a wide range of operations including:

  • Index property checks
  • Insert operations
  • Various search operations using different algorithms
  • Object manipulation operations
  • Update and upsert operations
  • Removal operations

Each strategy has appropriate concurrency settings and execution parameters.

Consider adding comments to describe the purpose of complex strategies, especially for those with multiple operations. This would improve maintainability and make it easier for new developers to understand the test scenarios.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 202-202: duplication of key "name" in mapping

(key-duplicates)

internal/sync/errgroup/group_test.go (1)

946-1057:

❓ Verification inconclusive

Test refactoring from TryGo to exec

The test has been refactored to test exec instead of TryGo. This change aligns with the internal refactoring mentioned in the PR objectives, but a few observations:

  1. The want structure no longer includes a boolean return value, suggesting exec doesn't return a success indicator unlike TryGo
  2. You're using atomic.Int64 for the limit field, which is good for thread safety
  3. The original Test_group_TryGo is retained but commented out

Since both methods appear to exist in the codebase (based on the retained test), consider either:

  • Implementing both tests to ensure both methods are properly tested
  • Adding documentation about the transition from TryGo to exec and whether TryGo is being deprecated

This will help future developers understand the intended usage pattern.


🏁 Script executed:

#!/bin/bash
# Check if both TryGo and exec methods exist in the implementation
grep -n "func .* (TryGo|exec)" internal/sync/errgroup/group.go

Length of output: 64


🏁 Script executed:

#!/bin/bash
# Re-run using ripgrep to search for the declarations of TryGo and exec methods within group.go

echo "Searching for TryGo:"
rg -n "func\s+.*TryGo" internal/sync/errgroup/group.go

echo "Searching for exec:"
rg -n "func\s+.*exec" internal/sync/errgroup/group.go

Length of output: 342


Refactoring review for TryGo to exec transition

The test now focuses on invoking exec instead of TryGo, and our verification confirms that both methods exist in internal/sync/errgroup/group.go (with TryGo at lines 110 and 195, and exec at line 141). A few points for clarity:

  • The want struct in the new test no longer includes a boolean field, which confirms that exec no longer returns a success flag like TryGo.
  • The use of atomic.Int64 for the limit field is a solid improvement for thread safety.
  • The original Test_group_TryGo remains commented out. This suggests an ongoing transition strategy for backward compatibility.

Actionable suggestions:

  • Consider whether both methods require dedicated tests. If TryGo is still intended for use, adding tests for it—or clearly documenting its deprecation—would aid future developers.
  • Update documentation or inline comments to explain the rationale behind this transition and clarify the intended usage for each method.
pkg/tools/cli/loadtest/service/insert_test.go (1)

1-558: Consider implementing or removing commented test skeletons

This entire file consists of commented-out test skeletons. While the type and variable name changes align with implementation changes, having extensive placeholder tests without implementation can lead to maintenance challenges.

Consider either implementing these tests with actual test cases or removing them until you're ready to implement them, possibly in a future PR focused on testing.

internal/errors/k8s.go (1)

43-45: Consider standardizing the casing in error messages.
Most error messages start with lowercase letters, but "Undefined namespace" and "Undefined service" begin with uppercase. For consistency, consider using lowercase.

internal/iter/iter.go (1)

52-153: Coverage is insufficient for these new lines.
Consider adding unit tests (or expanding existing ones) to cover offset logic, modFunc usage, and empty-slice scenarios.

Want me to help craft dedicated test cases for these paths?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 52-67: internal/iter/iter.go#L52-L67
Added lines #L52 - L67 were not covered by tests


[warning] 72-77: internal/iter/iter.go#L72-L77
Added lines #L72 - L77 were not covered by tests


[warning] 81-87: internal/iter/iter.go#L81-L87
Added lines #L81 - L87 were not covered by tests


[warning] 89-91: internal/iter/iter.go#L89-L91
Added lines #L89 - L91 were not covered by tests


[warning] 96-97: internal/iter/iter.go#L96-L97
Added lines #L96 - L97 were not covered by tests


[warning] 101-107: internal/iter/iter.go#L101-L107
Added lines #L101 - L107 were not covered by tests


[warning] 109-111: internal/iter/iter.go#L109-L111
Added lines #L109 - L111 were not covered by tests


[warning] 117-123: internal/iter/iter.go#L117-L123
Added lines #L117 - L123 were not covered by tests


[warning] 125-127: internal/iter/iter.go#L125-L127
Added lines #L125 - L127 were not covered by tests


[warning] 132-137: internal/iter/iter.go#L132-L137
Added lines #L132 - L137 were not covered by tests


[warning] 139-141: internal/iter/iter.go#L139-L141
Added lines #L139 - L141 were not covered by tests


[warning] 145-146: internal/iter/iter.go#L145-L146
Added lines #L145 - L146 were not covered by tests


[warning] 150-151: internal/iter/iter.go#L150-L151
Added lines #L150 - L151 were not covered by tests

tests/v2/e2e/kubernetes/status.go (6)

116-145: Ensure all valid statuses are declared in PossibleStatuses.

While enumerating possible statuses for each resource type is helpful, future changes in Kubernetes resource conditions could be missed, and there's no fallback in the calling code. Consider either logging or returning an error if a new condition appears that doesn't map to these statuses, so issues are quickly spotted.


146-175: Consolidate resource evaluation in CheckResourceState.

This switch statement is quite large, and each resource is handled individually below. A centralized approach or partial reuse between resources could reduce duplication, as several checks (e.g., generation vs. observed, container conditions) are common across workloads. If you’d like to keep them separate for clarity, consider referencing shared helper functions.


185-246: Refine deployment failure conditions.

In evaluateDeployment, failure is detected only when DeploymentProgressing is false. Some corner cases (e.g., ReplicaFailure or times when no progress is made for too long) may remain undetected. Consider explicitly checking for more failure signals like ReplicaFailure or waiting beyond a threshold to flag the deployment as failed.


342-375: Distinguish job conditions from “updating” status.

The function returns StatusUpdating when a job is active, which might be slightly confusing terminology for a batch job’s lifecycle. You may adopt a job-specific status term (e.g., StatusRunning) for better clarity, distinguishing it from other resource “updates.”


403-451: Surface container status details in evaluatePod.

Currently, readiness is determined solely by the PodReady condition. If multiple containers fail or repeatedly restart, the reason may be less clear. Diagnostics like container statuses, restart counts, or the cause of readiness failure might be valuable to log for deeper debugging in e2e tests.


499-518: Consider verifying active routes for Ingress objects.

evaluateIngress confirms that load balancer details exist, but does not validate whether configured paths or hosts are actually served. If coverage is needed to confirm that the ingress routes are responding, consider additional tests or checks to ensure readiness beyond the presence of an IP/hostname.

tests/v2/e2e/config/config.go (5)

185-193: Ensure robust validation for metadata inputs.

There is no explicit validation to prevent malicious or invalid metadata entries. Keys and values derived from MetaString are simply split and added into d.Metadata. Consider adding checks for character constraints, maximum lengths, and overall input size to mitigate potential security issues.

Would you like me to propose a validation snippet or open a new issue to address stricter validation for metadata inputs?


149-157: Refine required field checks in Data.Bind().

The function checks for non-nil and non-empty values of Strategies, Dataset, and Target; however, there may be legitimate cases where certain fields are intentionally omitted, or their defaults are applied dynamically. Consider making these checks more granular (e.g., ensuring at least one strategy is valid instead of requiring all) or providing default objects for optional fields.


263-267: Provide sensible defaults for bulk operations.

When e.Mode == OperationMultiple, you enforce bulk_size > 0. If the user forgets to set it, this results in an error. Appearing helpful, you could provide a safe default (for example, 1) rather than forcing the user to specify it explicitly each time.


236-262: Consider splitting out logic in the large operation type switch.

The switch statement in Execution.Bind() for handling different operation types is quite large and repetitive. Breaking it out into smaller, well-named helper methods (or a map-based approach) can simplify reading, maintenance, and testing.


425-441: Use a map lookup for OperationMode.

Similar to OperationType, the OperationMode switch repeats string comparison logic. A simple map from normalized strings to enum values would reduce boilerplate and improve extensibility (e.g., adding new modes with minimal changes).

tests/v2/e2e/kubernetes/resources.go (1)

307-314: Revisit concurrency checks for nil interface references.

All operations (e.g., Create, Update, Delete) validate b == nil || b.Interface == nil, returning errors.ErrKubernetesClientNotFound. While helpful, consider adding logs or additional context about which resource or method is being invoked to speed up debugging.

tests/v2/e2e/kubernetes/portforward/portforward.go (3)

125-229: Consider a graceful shutdown signal for watcher goroutines.

Your endpointsWatcher goroutine restarts the watcher upon closure. On shutdown, the channel may close abruptly while the goroutine tries to restart. Provide an explicit exit condition or gracefully signal watchers to stop to avoid transient errors.


291-293: Refine error reporting for missing pod.

A generic ErrNoAvailablePods is returned when podName is empty or getNextPod fails. Include contextual information, such as the service name or the last known list of pods, to aid troubleshooting, e.g., “No available pods found for service in .”


301-308: Improve error handling for port forwarding failures.

When PortforwardExtended fails, you log an error and optionally call stop(). Consider returning an enriched error message explaining the final state—whether the port is partially bound or if a retry is scheduled—to help clarify the cause and next steps.

internal/test/data/vector/noise/noise_test.go (2)

3-95: All test logic is commented out.
This code block for TestNew is entirely commented out, leaving no real test coverage. Please either implement or remove these skeleton tests to maintain clarity.


97-196: Unimplemented test cases for Test_noiseGenerator_Mod.
The placeholders need to be implemented or removed. Retaining large blocks of commented code can lead to confusion.

internal/params/option_test.go (3)

452-535: Commented-out test function TestWithName.
Currently, the entire test function is commented out with TODO placeholders. To keep the codebase clean, consider removing it until it's ready or implement these tests.


537-620: Commented-out test function TestWithOverrideDefault.
All test logic is commented out with TODO placeholders. Please either implement the tests or remove them to avoid confusion.


622-705: Commented-out test function TestWithArgumentFilters.
This function is fully commented out as well. Leaving extensive commented stubs can clutter the code. Either implement or remove these stubs.

internal/test/data/vector/noise/noise.go (1)

111-123: Handle required noise samples edge cases.
If required becomes 1 or extremely small, subtracting 1 before calling bits.Len64 might produce unintended results.

 if required <= 1 {
+   return int(ng.minNoiseTableSize)
 }
 return 1 << bits.Len64(required-1)
tests/v2/e2e/crud/search_test.go (1)

178-219: Handle unexpected execution types gracefully.

The switch statement omits a default branch, which can lead to silently ignoring new or unrecognized operation types. Consider adding a default case to either handle or log an error for unknown plan types.

 switch plan.Type {
   ...
+default:
+  t.Errorf("unknown plan type: %v", plan.Type)
 }
tests/v2/e2e/crud/modification_test.go (1)

140-179: Add a default branch to handle unknown plan types.

Similar to the search operations, there is no default case for unrecognized plan.Type values. This may silently skip new or unsupported plan types. A default case that logs or handles the error can help identify misconfigurations early.

 switch plan.Type {
   ...
+default:
+  t.Errorf("unknown modification operation: %v", plan.Type)
 }
pkg/index/job/deletion/service/deleter_test.go (4)

1-3: Note: This file contains test templates that are commented out and not implemented yet.

The file correctly declares the package name, but all the code is commented out and marked as "NOT IMPLEMENTED BELOW".

Would you like me to help implement the actual test cases for the Deleter service? I can provide concrete examples based on the existing structure.


5-93: TestNew function template has a solid table-driven test structure.

The template for testing the New function follows Go best practices with:

  • Well-structured input/output parameters
  • Proper error checking
  • Support for setup/teardown
  • Goroutine leak verification
  • Parallel test execution

However, there are no actual test cases implemented yet, only placeholder comments.

When implementing, consider adding these test cases:

  1. Creating a Deleter with default options
  2. Creating a Deleter with custom options
  3. Testing error cases (e.g., invalid options)
- // TODO test cases
+ // Basic New() with default options
+ {
+     name: "new_with_default_options",
+     args: args{
+         opts: nil,
+     },
+     want: want{
+         want: &index{
+             concurrency: defaultConcurrency,
+         },
+         err: nil,
+     },
+     checkFunc: defaultCheckFunc,
+ },
+ // New() with custom concurrency
+ {
+     name: "new_with_custom_concurrency",
+     args: args{
+         opts: []Option{WithConcurrency(10)},
+     },
+     want: want{
+         want: &index{
+             concurrency: 10,
+         },
+         err: nil,
+     },
+     checkFunc: defaultCheckFunc,
+ },

95-179: Test_delDuplicateAddrs template can be enhanced with specific test cases.

This template is well-structured for testing the duplicate address removal functionality, but doesn't contain any actual test cases yet.

When implementing, add these test cases to thoroughly test the function:

  1. Empty slice input
  2. Slice with no duplicates
  3. Slice with duplicates in different positions
  4. Slice with consecutive duplicates
- // TODO test cases
+ // Empty input
+ {
+     name: "empty_input",
+     args: args{
+         targetAddrs: []string{},
+     },
+     want: want{
+         want: []string{},
+     },
+ },
+ // No duplicates
+ {
+     name: "no_duplicates",
+     args: args{
+         targetAddrs: []string{"addr1", "addr2", "addr3"},
+     },
+     want: want{
+         want: []string{"addr1", "addr2", "addr3"},
+     },
+ },
+ // With duplicates
+ {
+     name: "with_duplicates",
+     args: args{
+         targetAddrs: []string{"addr1", "addr2", "addr1", "addr3", "addr2"},
+     },
+     want: want{
+         want: []string{"addr1", "addr2", "addr3"},
+     },
+ },

296-405: Test_index_Start template needs test cases for various scenarios.

The template for the Start method is well-structured but requires various test cases to thoroughly test error handling and successful execution paths.

When implementing, include cases for:

  1. Successful start with and without concurrency
  2. Context cancellation during execution
  3. Empty address list handling
  4. Error propagation from dependent methods
- // TODO test cases
+ // Empty target addresses
+ {
+     name: "empty_target_addresses",
+     args: args{
+         ctx: context.Background(),
+     },
+     fields: fields{
+         targetAddrs: []string{},
+     },
+     want: want{
+         err: errors.New("no target addresses provided"),
+     },
+ },
+ // Context cancellation
+ func() test {
+     ctx, cancel := context.WithCancel(context.Background())
+     cancel() // Cancel immediately to simulate timeout/cancellation
+     return test{
+         name: "context_cancelled",
+         args: args{
+             ctx: ctx,
+         },
+         fields: fields{
+             targetAddrs: []string{"localhost:8080"},
+         },
+         want: want{
+             err: context.Canceled,
+         },
+     }
+ }(),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71d6ce2 and ff0676b.

📒 Files selected for processing (134)
  • .gitfiles (14 hunks)
  • .github/workflows/_docker-image.yaml (1 hunks)
  • .github/workflows/_release-pr.yaml (1 hunks)
  • .github/workflows/build-binaries.yaml (1 hunks)
  • .github/workflows/build-protobuf.yaml (1 hunks)
  • .github/workflows/chatops.yaml (5 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/coverage.yaml (1 hunks)
  • .github/workflows/e2e-chaos.yaml (4 hunks)
  • .github/workflows/e2e-code-bench-agent.yaml (2 hunks)
  • .github/workflows/e2e-max-dim.yaml (1 hunks)
  • .github/workflows/e2e-profiling.yaml (1 hunks)
  • .github/workflows/e2e.yaml (8 hunks)
  • .github/workflows/format.yaml (2 hunks)
  • .github/workflows/fossa.yaml (1 hunks)
  • .github/workflows/helm-lint.yaml (3 hunks)
  • .github/workflows/helm.yaml (2 hunks)
  • .github/workflows/reviewdog-k8s.yaml (3 hunks)
  • .github/workflows/reviewdog.yaml (2 hunks)
  • .github/workflows/test-hack.yaml (1 hunks)
  • .github/workflows/unit-test-rust.yaml (1 hunks)
  • .github/workflows/unit-test.yaml (3 hunks)
  • .github/workflows/update-deps.yaml (1 hunks)
  • Makefile (5 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • buf.gen.yaml (1 hunks)
  • cmd/index/job/deletion/main_test.go (1 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/example/client/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/deletion/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • internal/backoff/option.go (0 hunks)
  • internal/client/v1/client/discoverer/discover_test.go (5 hunks)
  • internal/config/benchmark_test.go (4 hunks)
  • internal/config/config.go (2 hunks)
  • internal/config/index_deleter_test.go (1 hunks)
  • internal/core/algorithm/usearch/usearch_test.go (16 hunks)
  • internal/errors/errors.go (1 hunks)
  • internal/errors/errors_test.go (1 hunks)
  • internal/errors/k8s.go (1 hunks)
  • internal/info/info_test.go (17 hunks)
  • internal/iter/iter.go (1 hunks)
  • internal/net/dialer_test.go (1 hunks)
  • internal/net/grpc/errdetails/errdetails.go (6 hunks)
  • internal/net/grpc/metadata_test.go (1 hunks)
  • internal/net/grpc/option_test.go (44 hunks)
  • internal/net/grpc/pool/pool_test.go (5 hunks)
  • internal/net/grpc/server_test.go (2 hunks)
  • internal/net/grpc/stream.go (2 hunks)
  • internal/net/grpc/stream_test.go (4 hunks)
  • internal/net/http/client/client.go (1 hunks)
  • internal/net/http/client/client_test.go (1 hunks)
  • internal/net/net.go (1 hunks)
  • internal/net/net_test.go (1 hunks)
  • internal/net/quic/conn_test.go (1 hunks)
  • internal/net/quic/listener_test.go (1 hunks)
  • internal/params/option.go (2 hunks)
  • internal/params/option_test.go (1 hunks)
  • internal/params/params.go (5 hunks)
  • internal/params/params_test.go (1 hunks)
  • internal/rand/rand.go (1 hunks)
  • internal/servers/server/option_test.go (1 hunks)
  • internal/sync/errgroup/group.go (7 hunks)
  • internal/sync/errgroup/group_test.go (16 hunks)
  • internal/test/data/vector/gen.go (0 hunks)
  • internal/test/data/vector/noise/noise.go (1 hunks)
  • internal/test/data/vector/noise/noise_test.go (1 hunks)
  • internal/test/data/vector/noise/option.go (1 hunks)
  • internal/test/data/vector/noise/option_test.go (1 hunks)
  • internal/timeutil/time.go (1 hunks)
  • internal/timeutil/time_test.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (9 hunks)
  • pkg/discoverer/k8s/service/discover_test.go (4 hunks)
  • pkg/gateway/lb/handler/grpc/aggregation_test.go (2 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (2 hunks)
  • pkg/index/job/deletion/config/config_test.go (1 hunks)
  • pkg/index/job/deletion/service/deleter_test.go (1 hunks)
  • pkg/index/job/deletion/service/options_test.go (1 hunks)
  • pkg/index/job/deletion/usecase/deletion_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/insert_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/job_test.go (12 hunks)
  • pkg/tools/benchmark/job/service/object_test.go (8 hunks)
  • pkg/tools/benchmark/job/service/option_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/remove_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/search_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/update_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/upsert_test.go (4 hunks)
  • pkg/tools/cli/loadtest/service/insert_test.go (11 hunks)
  • pkg/tools/cli/loadtest/service/loader.go (1 hunks)
  • pkg/tools/cli/loadtest/service/loader_test.go (13 hunks)
  • pkg/tools/cli/loadtest/service/search_test.go (9 hunks)
  • tests/v2/e2e/assets/rollout.yaml (1 hunks)
  • tests/v2/e2e/assets/unary_crud.yaml (1 hunks)
  • tests/v2/e2e/config/config.go (1 hunks)
  • tests/v2/e2e/config/enums.go (1 hunks)
  • tests/v2/e2e/crud/crud_test.go (1 hunks)
  • tests/v2/e2e/crud/dataset_test.go (1 hunks)
  • tests/v2/e2e/crud/grpc_test.go (1 hunks)
  • tests/v2/e2e/crud/index_test.go (1 hunks)
  • tests/v2/e2e/crud/modification_test.go (1 hunks)
  • tests/v2/e2e/crud/object_test.go (1 hunks)
  • tests/v2/e2e/crud/search_test.go (1 hunks)
  • tests/v2/e2e/crud/strategy_test.go (1 hunks)
  • tests/v2/e2e/hdf5/hdf5.go (1 hunks)
  • tests/v2/e2e/kubernetes/client.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/option.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/portforward.go (1 hunks)
  • tests/v2/e2e/kubernetes/resources.go (1 hunks)
  • tests/v2/e2e/kubernetes/rollout.go (1 hunks)
  • tests/v2/e2e/kubernetes/status.go (1 hunks)
💤 Files with no reviewable changes (2)
  • internal/test/data/vector/gen.go
  • internal/backoff/option.go
🚧 Files skipped from review as they are similar to previous changes (94)
  • dockers/agent/core/agent/Dockerfile
  • dockers/buildbase/Dockerfile
  • dockers/binfmt/Dockerfile
  • .github/workflows/unit-test-rust.yaml
  • dockers/operator/helm/Dockerfile
  • .github/workflows/_release-pr.yaml
  • .github/workflows/e2e-chaos.yaml
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • dockers/tools/benchmark/job/Dockerfile
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/dev/Dockerfile
  • .github/workflows/build-binaries.yaml
  • .github/workflows/codeql-analysis.yml
  • dockers/tools/cli/loadtest/Dockerfile
  • dockers/index/job/creation/Dockerfile
  • buf.gen.yaml
  • dockers/index/job/save/Dockerfile
  • dockers/gateway/lb/Dockerfile
  • .github/workflows/build-protobuf.yaml
  • .github/workflows/update-deps.yaml
  • .github/workflows/fossa.yaml
  • dockers/discoverer/k8s/Dockerfile
  • .github/workflows/coverage.yaml
  • Makefile.d/e2e.mk
  • dockers/agent/core/ngt/Dockerfile
  • .github/workflows/e2e-profiling.yaml
  • dockers/buildkit/Dockerfile
  • pkg/tools/benchmark/job/service/search_test.go
  • dockers/agent/sidecar/Dockerfile
  • .github/workflows/reviewdog-k8s.yaml
  • .github/workflows/test-hack.yaml
  • pkg/tools/benchmark/job/service/object_test.go
  • .github/workflows/unit-test.yaml
  • pkg/tools/benchmark/job/service/upsert_test.go
  • pkg/tools/benchmark/job/service/remove_test.go
  • dockers/agent/core/faiss/Dockerfile
  • .github/workflows/helm.yaml
  • .github/workflows/_docker-image.yaml
  • tests/v2/e2e/assets/rollout.yaml
  • pkg/index/job/deletion/config/config_test.go
  • .github/workflows/e2e.yaml
  • dockers/tools/benchmark/operator/Dockerfile
  • dockers/index/job/deletion/Dockerfile
  • internal/rand/rand.go
  • pkg/tools/benchmark/job/service/update_test.go
  • dockers/manager/index/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • internal/net/grpc/metadata_test.go
  • dockers/index/job/correction/Dockerfile
  • dockers/index/operator/Dockerfile
  • .github/workflows/reviewdog.yaml
  • pkg/tools/benchmark/job/service/job_test.go
  • pkg/agent/core/ngt/service/ngt_test.go
  • .github/workflows/format.yaml
  • internal/net/grpc/errdetails/errdetails.go
  • pkg/tools/benchmark/job/service/insert_test.go
  • tests/v2/e2e/kubernetes/rollout.go
  • Makefile.d/functions.mk
  • internal/timeutil/time.go
  • .github/workflows/helm-lint.yaml
  • tests/v2/e2e/crud/dataset_test.go
  • dockers/ci/base/Dockerfile
  • internal/net/grpc/server_test.go
  • internal/net/net.go
  • internal/config/index_deleter_test.go
  • internal/errors/errors_test.go
  • internal/test/data/vector/noise/option.go
  • pkg/agent/core/ngt/service/ngt.go
  • .github/workflows/e2e-code-bench-agent.yaml
  • internal/params/params_test.go
  • tests/v2/e2e/crud/crud_test.go
  • pkg/index/job/deletion/service/options_test.go
  • tests/v2/e2e/crud/grpc_test.go
  • internal/client/v1/client/discoverer/discover_test.go
  • tests/v2/e2e/kubernetes/portforward/option.go
  • pkg/discoverer/k8s/service/discover_test.go
  • tests/v2/e2e/kubernetes/client.go
  • .github/workflows/chatops.yaml
  • internal/info/info_test.go
  • dockers/example/client/Dockerfile
  • .github/workflows/e2e-max-dim.yaml
  • internal/net/grpc/stream_test.go
  • pkg/gateway/lb/handler/grpc/aggregation_test.go
  • Makefile
  • internal/config/config.go
  • internal/config/benchmark_test.go
  • pkg/tools/cli/loadtest/service/search_test.go
  • internal/net/quic/conn_test.go
  • tests/v2/e2e/config/enums.go
  • pkg/tools/cli/loadtest/service/loader_test.go
  • internal/core/algorithm/usearch/usearch_test.go
  • tests/v2/e2e/hdf5/hdf5.go
  • internal/net/grpc/pool/pool_test.go
🧰 Additional context used
🧠 Learnings (1)
.gitfiles (1)
Learnt from: datelier
PR: vdaas/vald#2807
File: rust/bin/agent/src/handler/object.rs:36-38
Timestamp: 2025-03-13T04:50:01.551Z
Learning: In Rust code for Vald handlers, avoid using unwrap() on Option types. Instead, handle None values explicitly by returning appropriate error statuses to maintain robustness.
🪛 GitHub Check: codecov/patch
internal/iter/iter.go

[warning] 52-67: internal/iter/iter.go#L52-L67
Added lines #L52 - L67 were not covered by tests


[warning] 72-77: internal/iter/iter.go#L72-L77
Added lines #L72 - L77 were not covered by tests


[warning] 81-87: internal/iter/iter.go#L81-L87
Added lines #L81 - L87 were not covered by tests


[warning] 89-91: internal/iter/iter.go#L89-L91
Added lines #L89 - L91 were not covered by tests


[warning] 96-97: internal/iter/iter.go#L96-L97
Added lines #L96 - L97 were not covered by tests


[warning] 101-107: internal/iter/iter.go#L101-L107
Added lines #L101 - L107 were not covered by tests


[warning] 109-111: internal/iter/iter.go#L109-L111
Added lines #L109 - L111 were not covered by tests


[warning] 117-123: internal/iter/iter.go#L117-L123
Added lines #L117 - L123 were not covered by tests


[warning] 125-127: internal/iter/iter.go#L125-L127
Added lines #L125 - L127 were not covered by tests


[warning] 132-137: internal/iter/iter.go#L132-L137
Added lines #L132 - L137 were not covered by tests


[warning] 139-141: internal/iter/iter.go#L139-L141
Added lines #L139 - L141 were not covered by tests


[warning] 145-146: internal/iter/iter.go#L145-L146
Added lines #L145 - L146 were not covered by tests


[warning] 150-151: internal/iter/iter.go#L150-L151
Added lines #L150 - L151 were not covered by tests

pkg/tools/cli/loadtest/service/loader.go

[warning] 207-207: pkg/tools/cli/loadtest/service/loader.go#L207
Added line #L207 was not covered by tests


[warning] 212-212: pkg/tools/cli/loadtest/service/loader.go#L212
Added line #L212 was not covered by tests

🪛 YAMLlint (1.35.1)
tests/v2/e2e/assets/unary_crud.yaml

[error] 202-202: duplication of key "name" in mapping

(key-duplicates)

⏰ Context from checks skipped due to timeout of 90000ms (69)
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
🔇 Additional comments (87)
pkg/gateway/lb/handler/grpc/handler_test.go (4)

805-807: Enhancement of test structure to include attribute validation

The addition of the wantAttrs []attribute.KeyValue field to the want struct enhances the test framework to validate attributes returned by the doSearch method, providing more comprehensive testing.


814-814: Function signature appropriately updated for attribute validation

The checkFunc signature has been correctly updated to accommodate the new attribute validation parameter.


818-827: Comprehensive validation in defaultCheckFunc

The implementation correctly validates the returned attributes using reflect.DeepEqual, maintaining the same validation approach as used for other return values.


923-924: Complete implementation of attribute capture and validation

The code correctly captures the attributes returned from doSearch and passes them to the validation function, completing the implementation of attribute validation in tests.

internal/net/grpc/option_test.go (18)

532-535: Test function refactoring aligns with backoff functionality.

The test function has been renamed from TestWithDialOptions to TestWithBackoffMaxDelay with its parameter type changed from []grpc.DialOption to string. This change better aligns the test function with the specific backoff functionality being tested.

Also applies to: 558-559, 578-579, 609-609


617-620: LGTM: Appropriate function rename to test base delay parameter.

The function was renamed from TestWithBackoffMaxDelay to TestWithBackoffBaseDelay, maintaining the parameter type string which is appropriate for a duration value.

Also applies to: 694-694


702-705: Properly renamed test function with appropriate parameter type.

The function was renamed from TestWithBackoffBaseDelay to TestWithBackoffMultiplier with parameter type changed from string to float64, which is appropriate for a multiplier value.

Also applies to: 729-730, 748-749, 779-779


787-790: Function rename reflects specific backoff jitter testing.

The function was renamed from TestWithBackoffMultiplier to TestWithBackoffJitter with parameter changed from m float64 to j float64, appropriately representing a jitter value.

Also applies to: 814-815, 833-834, 864-864


872-875: Test function now focused on connection timeout parameter.

The function was renamed from TestWithBackoffJitter to TestWithMinConnectTimeout with parameter type string, appropriate for a duration value.

Also applies to: 899-900, 918-919, 949-949


957-960: Test function refactored to test error group functionality.

The function was renamed from TestWithMinConnectTimeout to TestWithErrGroup with parameter type changed from string to errgroup.Group to test error group functionality.

Also applies to: 984-985, 1003-1004, 1034-1034


1042-1045: Function refactored to test backoff strategy.

The function was renamed from TestWithCallOptions to TestWithBackoff with parameter type changed from []grpc.CallOption to backoff.Backoff, focusing on testing backoff functionality.

Also applies to: 1069-1070, 1088-1089, 1119-1119


1127-1130: Test function refactored for circuit breaker functionality.

The function was renamed from TestWithErrGroup to TestWithCircuitBreaker with parameter type changed from errgroup.Group to circuitbreaker.CircuitBreaker, appropriately testing circuit breaker functionality.

Also applies to: 1154-1155, 1173-1174, 1204-1204


1212-1215: Test function refactored back to call options testing.

The function was renamed from TestWithCircuitBreaker to TestWithCallOptions with parameter type []grpc.CallOption, returning to testing call options configuration.

Also applies to: 1239-1240, 1258-1259, 1289-1289


1297-1300: New test function for content subtype configuration.

A new test function TestWithCallContentSubtype has been added with parameter type string to test content subtype configuration.

Also applies to: 1324-1325, 1343-1344, 1374-1374


1382-1385: Test function renamed to focus on receive message size.

The function was renamed to TestWithMaxRecvMsgSize with parameter type int for testing maximum receive message size.

Also applies to: 1409-1410, 1428-1429, 1459-1459


1467-1470: Test function for send message size.

The function TestWithMaxSendMsgSize tests the maximum send message size configuration with an int parameter.

Also applies to: 1544-1544


1552-1555: Test function for retry buffer size.

The function TestWithMaxRetryRPCBufferSize tests the maximum retry RPC buffer size configuration with an int parameter.

Also applies to: 1629-1629


1637-1640: Test function for wait-for-ready flag.

The function TestWithWaitForReady tests the wait-for-ready flag configuration with a boolean parameter.

Also applies to: 1664-1665, 1683-1684, 1714-1719


1722-1725: Test function for dial options.

The function TestWithDialOptions tests the dial options configuration with a slice of grpc.DialOption parameters.

Also applies to: 1749-1750, 1768-1769, 1799-1800


2408-2412: Updated dialer test with additional network parameter.

The function TestWithDialer has been updated to include a network parameter of type string alongside the existing net.Dialer parameter, providing more complete testing of dialer configuration.

Also applies to: 2436-2437, 2456-2457, 2488-2488


2581-2834: Added comprehensive tests for gRPC client configuration options.

Several new test functions have been added to test various gRPC client configuration options:

  • TestWithAuthority - Tests authority configuration
  • TestWithDisableRetry - Tests retry disabling
  • TestWithIdleTimeout - Tests idle timeout configuration
  • TestWithMaxCallAttempts - Tests maximum call attempts
  • TestWithMaxHeaderListSize - Tests maximum header list size
  • TestWithSharedWriteBuffer - Tests shared write buffer configuration
  • TestWithUserAgent - Tests user agent configuration

These additions provide a more comprehensive test suite for the gRPC client options.


532-3174: Overall restructuring enhances test organization and clarity.

The comprehensive restructuring of test functions in this file significantly improves the organization and clarity of the test suite. The changes align test function names with their actual purposes, particularly in the areas of backoff configuration, connection management, and client options. Parameter types have been appropriately updated to match the functions being tested.

This refactoring supports the PR objective of introducing a new V2 end-to-end strategic testing framework by ensuring that the underlying gRPC communication components are properly tested.

pkg/tools/cli/loadtest/service/loader.go (1)

207-207:

✅ Verification successful

Updated BidirectionalStreamClient calls to include concurrency parameter.

The function calls now include the concurrency parameter before the sendDataProvider, which aligns with the updated function signature in internal/net/grpc/stream.go.

Also applies to: 212-212


🏁 Script executed:

#!/bin/bash
# Check if the updated function calls are consistent with other usages in the codebase

echo "Checking BidirectionalStreamClient usage across the codebase..."
rg -p "BidirectionalStreamClient\s*\(" --type go

Length of output: 1129


Function Call Update Verified: Concurrency Parameter in BidirectionalStreamClient

  • Confirmed that the calls in pkg/tools/cli/loadtest/service/loader.go at lines 207 and 212 now correctly include the l.concurrency parameter before the sendDataProvider, aligning with the updated signature in internal/net/grpc/stream.go.
  • Verified consistency across the codebase in tests (e.g., in tests/v2/e2e/crud/modification_test.go, tests/v2/e2e/crud/object_test.go, and tests/v2/e2e/crud/search_test.go).

No further modifications are required.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 207-207: pkg/tools/cli/loadtest/service/loader.go#L207
Added line #L207 was not covered by tests

tests/v2/e2e/assets/unary_crud.yaml (5)

16-20: LGTM! Appropriate configuration for time zone and logging.

The time zone is set to UTC which is a good practice for consistent timestamp handling across different environments. Logging configuration is properly set with raw format and info level.


31-118: Well-structured target configuration with comprehensive networking options.

The target configuration includes detailed settings for connection management, backoff strategies, and dial options with network settings like DNS resolution and socket options. This provides fine-grained control over how the tests connect to and interact with the target service.


119-123: LGTM! Test metadata properly configured.

Both metadata map and metadata_string are properly defined, providing different ways to specify metadata for the tests.


23-30:

❓ Verification inconclusive

Comprehensive Kubernetes port forwarding configuration.

The Kubernetes section is well-structured with appropriate configuration for port forwarding. This allows the tests to communicate with services running inside a Kubernetes cluster.


🏁 Script executed:

#!/bin/bash
# Check if the E2E_TARGET_NAMESPACE and E2E_TARGET_NAME environment variables are set in relevant files

echo "Checking for E2E_TARGET_NAMESPACE and E2E_TARGET_NAME definitions:"
rg -e "E2E_TARGET_NAMESPACE" -e "E2E_TARGET_NAME" --type make --type shell

Length of output: 245


Action Required: Verify Environment Variable Definitions in the Repository

The Kubernetes port forwarding configuration in tests/v2/e2e/assets/unary_crud.yaml (lines 23–30) is well-structured and meets the intended functionality. However, the check for E2E_TARGET_NAMESPACE and E2E_TARGET_NAME definitions using rg failed with an error (unrecognized file type: shell). This indicates that the file type flag is incorrect. For example, using --glob "*.sh" or --type sh might be more appropriate.

  • File Affected: tests/v2/e2e/assets/unary_crud.yaml (configuration is fine)
  • Action: Update the search command to correctly target shell scripts or manually verify that the environment variables are defined. For instance, consider running:
    rg -e "E2E_TARGET_NAMESPACE" -e "E2E_TARGET_NAME" --glob "*.sh" --glob "Makefile"

Once these definitions have been verified, we can confidently approve the configuration changes.


21-22:

❓ Verification inconclusive

Verify environment variable expansion.

The dataset name uses _E2E_DATASET_PATH_ which appears to be an environment variable placeholder.


🏁 Script executed:

#!/bin/bash
# Check if the E2E_DATASET_PATH environment variable is set in relevant files

echo "Checking for E2E_DATASET_PATH definition:"
rg "E2E_DATASET_PATH" --type make --type shell

Length of output: 169


Environment Variable Expansion Verification – Additional Check Required

The placeholder _E2E_DATASET_PATH_ in the YAML still appears intended for runtime substitution. However, the initial script failed because ripgrep did not recognize the "shell" file type. To verify that the environment variable is defined and correctly expanded, please run the following script without file type filters:

#!/bin/bash
echo "Searching repository for any references to E2E_DATASET_PATH:"
rg "E2E_DATASET_PATH"

Once you confirm that the expected definitions or substitutions exist, ensure that the runtime environment for your e2e setup properly expands this variable.

pkg/tools/benchmark/job/service/option_test.go (1)

1633-1692: Missing implementation for test cases in TestWithMetadata

You have a commented-out test function with placeholder TODO comments instead of actual test cases. According to previous review comments, this issue was supposed to be fixed in commit 06cc38f, but the implementation is still missing.

Please implement test cases that verify the functionality of WithMetadata with various scenarios (nil map, empty map, populated map, etc.) as was previously suggested.

internal/net/grpc/stream.go (2)

170-182: Good addition of concurrency control to BidirectionalStreamClient

The addition of the concurrency parameter and limit setting for the error group is a well-thought-out enhancement. This allows callers to control the level of parallelism based on their specific needs and system capabilities.


212-237: Well-implemented concurrent message sending

The refactoring to send messages concurrently using goroutines and a wait group is an excellent improvement that should significantly enhance performance for high-volume streaming scenarios. The code correctly:

  1. Uses a wait group to track all send operations
  2. Waits for all send operations to complete before closing the stream
  3. Properly encapsulates each send operation in a separate goroutine
  4. Handles error propagation appropriately

This change aligns well with the PR objectives of improving concurrency handling.

internal/net/quic/listener_test.go (1)

1-196: Test skeletons should be implemented or removed

The file contains well-structured test skeletons for QUIC listener functionality, but they're entirely commented out. While the structure follows good testing practices with proper setup for test cases, check functions, and leak detection, they lack actual implementation.

Consider either:

  1. Implementing at least basic test cases to provide real test coverage, or
  2. Removing these commented-out skeletons until they're ready to be implemented

Commented-out code in the codebase can lead to confusion and maintenance challenges over time.

internal/params/option.go (5)

20-23: LGTM: Good addition of imports for executable name retrieval

These imports are necessary for retrieving the executable base name in the defaultOptions.


27-36: LGTM: Well-structured default options

The addition of WithName and WithOverrideDefault to the default options enhances the parser's configuration with sensible defaults. Setting the parser name to the executable's base name is particularly useful for auto-generating help messages.


38-45: LGTM: Good implementation of WithName option

The WithName option is implemented with proper validation to ensure that empty names are not accepted, maintaining robustness in the parser configuration.


89-94: LGTM: Clear implementation of WithOverrideDefault option

This function provides a clean way to configure whether the parser should override the default flags, with clear documentation of its purpose.


96-109: LGTM: Well-designed WithArgumentFilters implementation

This function is implemented with careful handling:

  1. Early return if no filters are provided
  2. Initialization of the filters slice if it's nil
  3. Efficient pre-allocation of capacity based on the number of filters provided
  4. Clear documentation explaining the purpose and behavior of filters
internal/net/dialer_test.go (1)

1992-2079: Test skeleton for isQUICDial needs implementation

This commented-out test function follows a good structure for testing, but like other test skeletons in the PR, it lacks actual implementation. Having placeholder tests in the codebase can lead to technical debt if they're left unimplemented for extended periods.

Consider either:

  1. Implementing concrete test cases that validate the isQUICDial function's behavior, or
  2. Removing the commented-out code until you're ready to implement the tests

If this is part of a larger testing initiative, it would be better to implement tests incrementally in separate PRs rather than adding multiple commented-out skeletons.

pkg/tools/cli/loadtest/service/insert_test.go (2)

24-24: Type signature improved to use pointers for any values

The return type changes from func() any to func() *any across multiple function signatures is a good improvement. Using pointers to any type likely reduces unnecessary copying of potentially large data structures and aligns with the actual implementation.

Also applies to: 32-32, 36-36, 119-119, 126-126, 130-130, 209-209, 216-216, 220-220


305-305: Variable name clarification from dataProvider to sendDataProvider

Renaming dataProvider to sendDataProvider improves code readability by making the variable's purpose more explicit - it clearly indicates that this function is responsible for providing data to be sent. This type of renaming enhances maintainability.

Also applies to: 344-344, 373-373, 414-414, 437-437, 476-476, 505-505, 546-546

internal/errors/k8s.go (1)

20-46: All newly introduced error variables look solid.
These additions improve clarity in error handling, making each condition explicit.

internal/sync/errgroup/group.go (20)

17-18: Documentation clarity is appreciated.
The package-level doc highlights the purpose succinctly.


24-24: No concern with the atomic import.
This usage is typical for concurrency control.


31-42: Interface documentation is clear.
It helps future maintainers understand concurrency limits.


44-45: Struct documentation is concise.
No issues found here.


51-54: Concurrent limit tracking looks correct.
Storing it in an atomic ensures thread-safe updates.


62-67: Global instance initialization logic is straightforward.
No issues spotted.


68-71: Global initialization approach is consistent.
Cancels with cause if needed.


101-107: Global Go wrapper appears fine.
It cleanly defers to the instance’s Go method.


109-115: Global TryGo wrapper appears fine.
No concerns with concurrency or error handling.


117-120: SetLimit doc is clear.
No immediate issues with the explanation.


121-134: SetLimit implementation is well-structured.
Handles limit == 1 specially, then uses a semaphore for higher concurrency. Nicely done.


136-153: Inline execution (exec) logic is efficient.
Avoiding goroutines for limit == 1 can save overhead.


155-164: Goroutine-based run function is properly encapsulated.
The use of defer for wg.Done ensures consistent cleanup.


166-190: Go method concurrency management is clear.
Acquiring semaphore only when needed is an excellent approach.


192-210: TryGo’s non-blocking approach is well-implemented.
This is helpful for conditional concurrency.


212-223: appendErr ensures idempotent error recording.
Using an error map prevents duplicates. Good call.


225-231: done method properly releases semaphore.
No concerns with concurrency.


233-241: doCancel enforces exactly-once cancellation.
Using cancelOnce.Do is a safe pattern.


243-259: Wait method ensures all tasks complete and records the first error.
This flow is consistent with typical errgroup semantics.


261-267: Global Wait adds convenience.
Makes sense to return nil if the instance is nonexistent.

internal/iter/iter.go (15)

1-15: License and package headers look good.


17-18: Package declaration is clear.


20-23: Imports are concise.


25-38: Interface definitions are well-structured.
They clearly outline iterator functionality.


40-49: Struct fields are self-explanatory.
The offset, modFunc, and sizing logic are straightforward.


51-68: NewCycle creation logic is sensible.
Handles nil and empty slices with a return of nil.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 52-67: internal/iter/iter.go#L52-L67
Added lines #L52 - L67 were not covered by tests


53-59: This logic returns nil for empty slices.
A prior comment suggested returning a no-op cycle instead.


70-78: At method’s modulo-based indexing is correct.
Applying modFunc inside is a nice touch.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 72-77: internal/iter/iter.go#L72-L77
Added lines #L72 - L77 were not covered by tests


80-94: Seq2 iterates with index-value pairs.
The context check for completion is appropriate.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 81-87: internal/iter/iter.go#L81-L87
Added lines #L81 - L87 were not covered by tests


[warning] 89-91: internal/iter/iter.go#L89-L91
Added lines #L89 - L91 were not covered by tests


96-99: Seq is simply delegating to Values.
No issues here.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 96-97: internal/iter/iter.go#L96-L97
Added lines #L96 - L97 were not covered by tests


100-114: Values method yields elements properly.
Context checks are properly handled.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 101-107: internal/iter/iter.go#L101-L107
Added lines #L101 - L107 were not covered by tests


[warning] 109-111: internal/iter/iter.go#L109-L111
Added lines #L109 - L111 were not covered by tests


116-130: Indexes method yields indices only.
Again, context checks are well-handled.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 117-123: internal/iter/iter.go#L117-L123
Added lines #L117 - L123 were not covered by tests


[warning] 125-127: internal/iter/iter.go#L125-L127
Added lines #L125 - L127 were not covered by tests


132-143: ForEach method is straightforward.
Short-circuiting on false or context cancellation is good.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 132-137: internal/iter/iter.go#L132-L137
Added lines #L132 - L137 were not covered by tests


[warning] 139-141: internal/iter/iter.go#L139-L141
Added lines #L139 - L141 were not covered by tests


145-147: Raw method exposes the underlying slice.
Looks good.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 145-146: internal/iter/iter.go#L145-L146
Added lines #L145 - L146 were not covered by tests


149-152: Len method returns the total iteration count.
Implementation is concise.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 150-151: internal/iter/iter.go#L150-L151
Added lines #L150 - L151 were not covered by tests

.gitfiles (1)

126-126: Confirm that CI references .github/workflows/unit-test-rust.yaml.

The new Rust unit test workflow is added here. Please verify it’s properly referenced in the repository's CI/CD pipeline so that Rust tests actually run.

Would you like a script to search for references to .github/workflows/unit-test-rust.yaml across the repo?

tests/v2/e2e/kubernetes/resources.go (2)

579-608: Avoid overshadowing errors when setting pod annotations.

This duplicates a prior comment. If the Update call fails, original context may be lost. Provide more descriptive wrapping or logging to differentiate between the failure to retrieve the pod vs. the failure to update its annotation, making debugging easier.


308-314: Evaluate thread safety of the Interface field.

The baseClient struct uses a RW lock, but the code sets b.Interface in one place and reads it in many others. If there's a scenario requiring re-initialization or re-binding while multiple goroutines operate, consider verifying that the lock usage fully prevents data races (e.g., wrap read/write behind the same lock).

internal/net/http/client/client.go (1)

37-50: Well-implemented HTTP client with transport customization

The refactoring of the HTTP client initialization is well done. The New function now delegates to the new NewWithTransport function, allowing for greater flexibility. The proper handling of different RoundTripper types is a good practice.

The implementation properly:

  1. Creates a new function that accepts a custom transport
  2. Checks if the provided transport is of type *http.Transport
  3. Falls back to cloning the default transport if not
  4. Provides clear documentation

This increases flexibility while maintaining backward compatibility.

tests/v2/e2e/crud/index_test.go (1)

57-76: The unaryIndex function remains incomplete.
Although this function is documented to iterate over data and apply modifications, it only sends an empty request without populating it. This repeats a past concern raised in previous reviews.

internal/test/data/vector/noise/noise.go (1)

180-181: Ensure Go compiler version supports slices.Clone.
This function call requires Go 1.21 or later. Confirm that the build environment is updated accordingly.

internal/params/params.go (2)

135-139: ** Global override introduces shared-state risk**
Overriding flag.CommandLine in Override() and restoring it in Restore() cause concurrency issues if multiple parser instances run concurrently. Please consider concurrency-safe alternatives or clarifying single-thread usage.

Also applies to: 141-145


105-118:

❓ Verification inconclusive

Confirm Go version is >= 1.21 to use slices.DeleteFunc
slices.DeleteFunc is only available in Go 1.21 and later. If your environment is older, you'll encounter a compile error.

Run the following script to confirm your go.mod file references go 1.21:


🏁 Script executed:

#!/bin/bash
fd go.mod --exec rg '^go 1\.21'

Length of output: 33


Manual Verification Required: Confirm Go Version in go.mod

The automated script did not return evidence that your go.mod file specifies Go 1.21 or later. Please manually verify that your go.mod file includes a line such as:

go 1.21

This is crucial because the code in internal/params/params.go (lines 105-118) relies on slices.DeleteFunc, which is only available in Go 1.21 and later. If the Go version is not updated, you might encounter compile errors.

tests/v2/e2e/crud/object_test.go (1)

139-176: ** Return goroutine errors to fail fast**
As previously suggested, consider returning errors from each goroutine to the errgroup, so tests can fail fast if any request fails mid-task. Logging errors alone might obscure partial failures.

tests/v2/e2e/crud/strategy_test.go (1)

159-161: ** Surface partial failures in error group**
Echoing previous feedback, consider returning errors in processOperation or other invoked methods so the error group can detect partial failures. Currently, all goroutines return nil, preventing a fail-fast approach for partial task failures.

tests/v2/e2e/crud/search_test.go (1)

77-77: Validate slice boundaries to avoid potential panic.
This reiterates a comment from a previous review. If len(topKIDs) exceeds the length of neighbors, slicing with neighbors[:len(topKIDs)] will cause a panic. Consider bounding the slice or logging a warning.

Comment on lines +3727 to +4066
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := WithGRPCSharedWriteBuffer(test.args.enable)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
//
// func TestWithGRPCWaitForHandlers(t *testing.T) {
// type args struct {
// wait bool
// }
// type want struct {
// want Option
// }
// type test struct {
// name string
// args args
// want want
// checkFunc func(want, Option) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got Option) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// wait:false,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// wait:false,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := WithGRPCWaitForHandlers(test.args.wait)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Implement the commented test functions for comprehensive gRPC options coverage

The PR adds templates for four important gRPC configuration option tests that were previously identified as necessary for the V2 E2E testing framework, but they're currently commented out. While the test structure follows the pattern of other option tests in this file, these tests need to be uncommented and implemented with actual test cases.

These tests are critical for validating the gRPC configuration options that affect the E2E testing framework's performance and reliability. To complete the implementation:

  1. Uncomment all four test functions
  2. Implement at least two test cases for each function:
    • A "set success" case with valid parameters
    • A parameter validation case (e.g., "not set when size is invalid")

Example implementation for TestWithGRPCMaxConcurrentStreams:

-// func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
+func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
     type args struct {
         size uint32
     }
-    type want struct {
-        want Option
-    }
     type test struct {
         name       string
         args       args
-        want       want
-        checkFunc  func(want, Option) error
-        beforeFunc func(*testing.T, args)
-        afterFunc  func(*testing.T, args)
+        checkFunc  func(opt Option) error
     }
-    defaultCheckFunc := func(w want, got Option) error {
-        if !reflect.DeepEqual(got, w.want) {
-            return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
-        }
-        return nil
-    }
     tests := []test{
-        // TODO test cases
-        /*
-           {
-               name: "test_case_1",
-               args: args {
-                   size:0,
-               },
-               want: want{},
-               checkFunc: defaultCheckFunc,
-               beforeFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-               afterFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-           },
-        */
-
-        // TODO test cases
-        /*
-           func() test {
-               return test {
-                   name: "test_case_2",
-                   args: args {
-                   size:0,
-                   },
-                   want: want{},
-                   checkFunc: defaultCheckFunc,
-                   beforeFunc: func(t *testing.T, args args) {
-                       t.Helper()
-                   },
-                   afterFunc: func(t *testing.T, args args) {
-                       t.Helper()
-                   },
-               }
-           }(),
-        */
+        {
+            name: "set success when size is more than 0",
+            args: args{
+                size: 100,
+            },
+            checkFunc: func(opt Option) error {
+                got := new(server)
+                opt(got)
+                if len(got.grpc.opts) != 1 {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
+        {
+            name: "not set when size is 0",
+            args: args{
+                size: 0,
+            },
+            checkFunc: func(opt Option) error {
+                gopts := []grpc.ServerOption{
+                    grpc.ConnectionTimeout(10 * time.Second),
+                }
+                got := new(server)
+                got.grpc.opts = gopts
+                opt(got)
+                if !reflect.DeepEqual(got.grpc.opts, gopts) {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
     }

     for _, tc := range tests {
         test := tc
         t.Run(test.name, func(tt *testing.T) {
-            tt.Parallel()
-            defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
-            if test.beforeFunc != nil {
-                test.beforeFunc(tt, test.args)
-            }
-            if test.afterFunc != nil {
-                defer test.afterFunc(tt, test.args)
-            }
-            checkFunc := test.checkFunc
-            if test.checkFunc == nil {
-                checkFunc = defaultCheckFunc
-            }
-
-            got := WithGRPCMaxConcurrentStreams(test.args.size)
-            if err := checkFunc(test.want, got); err != nil {
+            got := WithGRPCMaxConcurrentStreams(test.args.size)
+            if err := test.checkFunc(got); err != nil {
                 tt.Errorf("error = %v", err)
             }
         })
     }
-}
+}

(Apply similar modifications to the other three test functions)

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//
// func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
// type args struct {
// size uint32
// }
// type want struct {
// want Option
// }
// type test struct {
// name string
// args args
// want want
// checkFunc func(want, Option) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got Option) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// size:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// size:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := WithGRPCMaxConcurrentStreams(test.args.size)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
//
// func TestWithGRPCNumStreamWorkers(t *testing.T) {
// type args struct {
// size uint32
// }
// type want struct {
// want Option
// }
// type test struct {
// name string
// args args
// want want
// checkFunc func(want, Option) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got Option) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// size:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// size:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := WithGRPCNumStreamWorkers(test.args.size)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
//
// func TestWithGRPCSharedWriteBuffer(t *testing.T) {
// type args struct {
// enable bool
// }
// type want struct {
// want Option
// }
// type test struct {
// name string
// args args
// want want
// checkFunc func(want, Option) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got Option) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// enable:false,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// enable:false,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := WithGRPCSharedWriteBuffer(test.args.enable)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
//
// func TestWithGRPCWaitForHandlers(t *testing.T) {
// type args struct {
// wait bool
// }
// type want struct {
// want Option
// }
// type test struct {
// name string
// args args
// want want
// checkFunc func(want, Option) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got Option) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// wait:false,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// wait:false,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := WithGRPCWaitForHandlers(test.args.wait)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
type args struct {
size uint32
}
type test struct {
name string
args args
checkFunc func(opt Option) error
}
tests := []test{
{
name: "set success when size is more than 0",
args: args{
size: 100,
},
checkFunc: func(opt Option) error {
got := new(server)
opt(got)
if len(got.grpc.opts) != 1 {
return errors.New("invalid param was set")
}
return nil
},
},
{
name: "not set when size is 0",
args: args{
size: 0,
},
checkFunc: func(opt Option) error {
gopts := []grpc.ServerOption{
grpc.ConnectionTimeout(10 * time.Second),
}
got := new(server)
got.grpc.opts = gopts
opt(got)
if !reflect.DeepEqual(got.grpc.opts, gopts) {
return errors.New("invalid param was set")
}
return nil
},
},
}
for _, tc := range tests {
test := tc
t.Run(test.name, func(tt *testing.T) {
got := WithGRPCMaxConcurrentStreams(test.args.size)
if err := test.checkFunc(got); err != nil {
tt.Errorf("error = %v", err)
}
})
}
}

Comment on lines +185 to +263
// func TestDurationString_Duration(t *testing.T) {
// type want struct {
// want time.Duration
// err error
// }
// type test struct {
// name string
// d DurationString
// want want
// checkFunc func(want, time.Duration, error) error
// beforeFunc func(*testing.T)
// afterFunc func(*testing.T)
// }
// defaultCheckFunc := func(w want, got time.Duration, err error) error {
// if !errors.Is(err, w.err) {
// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err)
// }
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got, err := test.d.Duration()
// if err := checkFunc(test.want, got, err); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Implement test cases for TestDurationString_Duration

The test function has been added with the proper structure but contains only TODO comments instead of actual test cases. Since this appears to be part of the E2E testing framework refactoring, having proper test coverage for time utilities is important.

Consider implementing test cases that cover:

  • Valid duration strings with various time units (ns, ms, s, m, h)
  • Empty strings
  • Invalid formats
  • Edge cases (extremely large or small durations)

This will ensure the Duration() method of DurationString works as expected in all scenarios.

Comment on lines +265 to +349
// func TestDurationString_DurationWithDefault(t *testing.T) {
// type args struct {
// def time.Duration
// }
// type want struct {
// want time.Duration
// }
// type test struct {
// name string
// args args
// d DurationString
// want want
// checkFunc func(want, time.Duration) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got time.Duration) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// def:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// def:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := test.d.DurationWithDefault(test.args.def)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Implement test cases for TestDurationString_DurationWithDefault

Similar to the previous function, this test has the proper structure but lacks actual test cases. The DurationWithDefault method appears to be important for handling default values when parsing fails.

Consider implementing test cases that verify:

  • Valid duration strings correctly parse and ignore the default
  • Empty strings return the default value
  • Invalid formats return the default value
  • Various default values are properly returned when needed

These tests will help ensure robust time handling in the E2E testing framework.

Comment on lines +75 to +115

// --------------------------------------------------------------------------------
// WaitForStatus waits for a Kubernetes resource to reach a specific status.
// The function checks the status of the resource at regular intervals and returns
// the object, a boolean indicating if the status matched, and an error (if any).
// The function supports Deployment, StatefulSet, DaemonSet, Job, CronJob, Pod,
// PersistentVolumeClaim, Service, and Ingress.
// --------------------------------------------------------------------------------
func WaitForStatus[T Object, L ObjectList, C NamedObject, I ResourceInterface[T, L, C]](
ctx context.Context, client I, name string, statuses ...ResourceStatus,
) (obj T, matched bool, err error) {
if !slices.ContainsFunc(PossibleStatuses(obj), func(st ResourceStatus) bool {
return slices.Contains(statuses, st)
}) {
return obj, false, errors.ErrStatusPatternNeverMatched
}

ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return obj, false, ctx.Err()
case <-ticker.C:
obj, err = client.Get(ctx, name, metav1.GetOptions{})
if err != nil {
return obj, false, err
}
status, info, err := CheckResourceState(obj)
if err != nil {
return obj, false, errors.Wrap(err, info)
}
for _, st := range statuses {
if st == status {
return obj, true, nil
}
}
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Guard against indefinite waits in WaitForStatus.

The function currently waits indefinitely until the expected status is reached, relying solely on context cancellation. This could lead to lengthy test runs if developers forget to configure a timeout. Consider adding a default timeout or requiring a context with a deadline to prevent unintentional indefinite waits.

Comment on lines +1 to +261
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := WithTableDivisionFactor(test.args.f)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
//
// })
// }
// }
//
// func TestWithMinTableSize(t *testing.T) {
// type args struct {
// s uint64
// }
// type want struct {
// want Option
// }
// type test struct {
// name string
// args args
// want want
// checkFunc func(want, Option) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got Option) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// s:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// s:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := WithMinTableSize(test.args.s)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
//
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Test templates for noise generator options need implementation

The file contains commented-out test structures for three important option functions: WithLevelFactor, WithTableDivisionFactor, and WithMinTableSize. The test structures are well-designed with proper setup for parallel testing and goroutine leak detection.

Consider implementing the test cases with the following scenarios:

  1. Valid values for each option function
  2. Edge cases (zero values, minimum/maximum values)
  3. Verify that each function properly returns an Option that configures the noiseGenerator correctly

Specifically for the first test:

-// TODO test cases
+// Test with valid level factor
+{
+    name: "valid_level_factor",
+    args: args{
+        f: 0.5,
+    },
+    want: want{
+        want: func(ng *noiseGenerator) error {
+            if ng.levelFactor != 0.5 {
+                return errors.New("level factor not set correctly")
+            }
+            return nil
+        },
+    },
+},

@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch from ff0676b to 54c5093 Compare March 14, 2025 16:37
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🔭 Outside diff range comments (2)
pkg/index/job/deletion/service/deleter_test.go (1)

1-520: ⚠️ Potential issue

Uncomment the file to make tests runnable

The entire file is commented out, making all tests non-executable. This defeats the purpose of having tests in the codebase.

Remove the comment markers (//) from the entire file to make the tests runnable once the test cases are implemented.

Additionally, ensure that all necessary imports are included at the top of the file (context, errors, reflect, goleak, grpc, etc.), as they appear to be missing in the current implementation.

internal/net/grpc/option_test.go (1)

532-615: 💡 Verification agent

🧩 Analysis chain

Systematic test function restructuring for gRPC options

The restructuring of these test functions shows a clear shift towards more granular testing of specific gRPC options, particularly focusing on backoff strategies and connection management. The changes follow a consistent pattern:

  • TestWithDialOptions → TestWithBackoffMaxDelay
  • TestWithBackoffMaxDelay → TestWithBackoffBaseDelay
  • TestWithBackoffBaseDelay → TestWithBackoffMultiplier
  • TestWithBackoffMultiplier → TestWithBackoffJitter
  • TestWithBackoffJitter → TestWithMinConnectTimeout
  • etc.

This aligns well with the PR's goal of enhancing the E2E testing framework.

While the structure of the tests looks good, all test cases are commented out with // TODO test cases. Consider implementing these before finalizing:

Also applies to: 617-700, 702-785, 787-870, 872-955, 957-1040, 1042-1125, 1127-1210, 1212-1295, 1297-1380, 1382-1465, 1467-1550, 1552-1635, 1637-1720, 1722-1805


🏁 Script executed:

#!/bin/bash
# Check if the actual test implementations exist in the project

# Look for the actual implementation functions that would be tested by these test functions
echo "Searching for corresponding implementation functions:"
rg "func With(Backoff|CircuitBreaker|CallOptions|MaxRecv|MaxSend)" internal/net/grpc/ --type go

Length of output: 1147


Test Implementation Needed for gRPC Option Tests

The refactoring of the gRPC option tests follows a clear and consistent naming convention (e.g., TestWithBackoffMaxDelay, TestWithBackoffBaseDelay, etc.), and verification confirms that the corresponding implementation functions (such as WithBackoffMaxDelay in internal/net/grpc/option.go) exist. However, all the test cases remain commented out as // TODO test cases, meaning that the essential validations for these functions have not yet been implemented.

  • Uncomment and provide concrete test cases for functions like WithBackoffMaxDelay.
  • Ensure similar implementations are provided for the related tests covering backoff strategies and connection management (particularly for the sections spanning lines 617-700, 702-785, 787-870, 872-955, 957-1040, 1042-1125, 1127-1210, 1212-1295, 1297-1380, 1382-1465, 1467-1550, 1552-1635, 1637-1720, 1722-1805).

Please implement these tests to improve coverage and ensure the expected behaviors are validated.

♻️ Duplicate comments (18)
internal/servers/server/option_test.go (1)

3727-4066: ⚠️ Potential issue

Implement the commented test functions for gRPC configuration options

These four test functions remain commented out but are critical for the V2 E2E testing framework. To ensure comprehensive test coverage of your gRPC configuration options, these functions should be implemented following the same pattern as the other option tests in this file.

For each test function, you should:

  1. Uncomment the function
  2. Remove unnecessary code (such as the want struct if not used)
  3. Implement test cases for both valid and invalid scenarios
  4. Add appropriate assertions to verify the behavior

For example, implement TestWithGRPCMaxConcurrentStreams as:

-// func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
+func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
     type args struct {
         size uint32
     }
-    type want struct {
-        want Option
-    }
     type test struct {
         name       string
         args       args
-        want       want
-        checkFunc  func(want, Option) error
-        beforeFunc func(*testing.T, args)
-        afterFunc  func(*testing.T, args)
+        checkFunc  func(opt Option) error
     }
-    defaultCheckFunc := func(w want, got Option) error {
-        if !reflect.DeepEqual(got, w.want) {
-            return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
-        }
-        return nil
-    }
     tests := []test{
-        // TODO test cases
-        /*
-           {
-               name: "test_case_1",
-               args: args {
-                   size:0,
-               },
-               want: want{},
-               checkFunc: defaultCheckFunc,
-               beforeFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-               afterFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-           },
-        */
+        {
+            name: "set success when size is more than 0",
+            args: args{
+                size: 100,
+            },
+            checkFunc: func(opt Option) error {
+                got := new(server)
+                opt(got)
+                if len(got.grpc.opts) != 1 {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
+        {
+            name: "not set when size is 0",
+            args: args{
+                size: 0,
+            },
+            checkFunc: func(opt Option) error {
+                gopts := []grpc.ServerOption{
+                    grpc.ConnectionTimeout(10 * time.Second),
+                }
+                got := new(server)
+                got.grpc.opts = gopts
+                opt(got)
+                if !reflect.DeepEqual(got.grpc.opts, gopts) {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
     }

     for _, tc := range tests {
         test := tc
         t.Run(test.name, func(tt *testing.T) {
-            tt.Parallel()
-            defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
-            if test.beforeFunc != nil {
-                test.beforeFunc(tt, test.args)
-            }
-            if test.afterFunc != nil {
-                defer test.afterFunc(tt, test.args)
-            }
-            checkFunc := test.checkFunc
-            if test.checkFunc == nil {
-                checkFunc = defaultCheckFunc
-            }
-            got := WithGRPCMaxConcurrentStreams(test.args.size)
-            if err := checkFunc(test.want, got); err != nil {
+            got := WithGRPCMaxConcurrentStreams(test.args.size)
+            if err := test.checkFunc(got); err != nil {
                 tt.Errorf("error = %v", err)
             }
         })
     }
 }

Apply similar modifications to the other three test functions.

pkg/index/job/deletion/usecase/deletion_test.go (10)

1-672: ⚠️ Potential issue

The entire test file needs to be uncommented and imports added before it can be executed.

The file is structured with a good template for table-driven tests, but all code is commented out with // at the beginning of each line. This prevents any actual test execution. Additionally, necessary import statements for packages like errors, reflect, testing, context, and errgroup are missing.

-package usecase
+package usecase
+
+import (
+	"context"
+	"errors"
+	"reflect"
+	"testing"
+
+	"golang.org/x/sync/errgroup"
+	"go.uber.org/goleak"
+
+	"github.com/vdaas/vald/internal/config"
+	"github.com/vdaas/vald/internal/observability"
+	"github.com/vdaas/vald/internal/runner"
+	"github.com/vdaas/vald/internal/starter"
+	"github.com/vdaas/vald/pkg/index/job/deletion/service"
+)

3-93: ⚠️ Potential issue

Uncomment TestNew function and implement actual test cases.

This function is completely commented out. While it has a good structure for table-driven tests with appropriate error handling, without uncommenting it and adding actual test cases, no testing is being performed for the New function.


31-67: 🛠️ Refactor suggestion

Add specific test cases for comprehensive testing of the New function.

The TODO comments and placeholders need to be replaced with actual test cases. Include at least:

  1. A test case with valid configuration
  2. A test case with nil configuration
  3. A test case with invalid configuration parameters

95-208: 🛠️ Refactor suggestion

Uncomment and implement Test_run_PreStart with improved parameter naming.

This test function follows a good structure but is entirely commented out. When implementing, use more descriptive parameter names to clearly indicate their purpose, and ensure test cases cover both success and error scenarios.


125-175: 🛠️ Refactor suggestion

Replace TODO placeholders with actual test cases for PreStart.

Implement concrete test cases for the PreStart function instead of placeholder TODOs. Include tests for:

  1. Successful PreStart execution
  2. Behavior with a nil context
  3. Error handling when dependencies fail to initialize

210-327: ⚠️ Potential issue

Uncomment and implement Test_run_Start function with channel testing.

The Start method returns a channel, requiring specific tests for channel behavior. When implementing this function, verify both successful start scenarios and error conditions, and ensure proper testing of channel behavior.


244-294: 🛠️ Refactor suggestion

Add specific test cases for the Start function's channel behavior.

When implementing test cases, include:

  1. Verification of successful start with proper error channel
  2. Tests for error cases with server or indexer failures
  3. Validation of channel behavior using goroutine synchronization

329-442: 🛠️ Refactor suggestion

Rename parameter "in0" to a descriptive name and implement Test_run_PreStop.

The parameter name "in0" is not descriptive. Rename it to "ctx" for clarity. Additionally, implement test cases to verify proper resource preparation for shutdown, particularly ensuring downstream components are properly notified.


444-557: ⚠️ Potential issue

Uncomment and implement Test_run_Stop for shutdown validation.

The Stop function is crucial for clean shutdown. Implement test cases to cover graceful shutdown scenarios and verify error propagation when dependencies fail to stop properly.


559-672: 🛠️ Refactor suggestion

Rename parameter "in0" and implement Test_run_PostStop for resource cleanup.

The parameter name "in0" should be renamed to "ctx" for better readability. Implement test cases to ensure proper cleanup after service shutdown, validating that resources are fully released and no lingering connections remain.

internal/test/data/vector/noise/noise.go (1)

80-106: ⚠️ Potential issue

Guard against division by zero after skipping empty vectors.
If all vectors are empty, count remains zero, causing a divide-by-zero at line 105.

Apply this fix:

 if count == 0 {
-  return float32(totalStd/float64(count)) * ng.noiseLevelFactor
+  return 0.01
 }
 return float32(totalStd/float64(count)) * ng.noiseLevelFactor
pkg/tools/benchmark/job/service/option_test.go (1)

1633-1716: 🛠️ Refactor suggestion

Implement actual test cases for TestWithMetadata.

The test function structure is in place, but no actual test cases have been implemented, only TODO placeholders. This was previously flagged in a past review comment and marked as fixed, but the implementation is still missing.

Consider implementing the following test cases as previously suggested:

  1. Test with nil map
  2. Test with empty map
  3. Test with populated map
  4. Test with map containing special characters
 	tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       args: args {
-		           m:nil,
-		       },
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+			name: "nil map",
+			args: args{
+				m: nil,
+			},
+			want: want{
+				want: WithMetadata(nil),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "empty map",
+			args: args{
+				m: map[string]string{},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "populated map",
+			args: args{
+				m: map[string]string{"key1": "value1", "key2": "value2"},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{"key1": "value1", "key2": "value2"}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "map with special characters",
+			args: args{
+				m: map[string]string{"key-special!": "value with spaces", "empty": ""},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{"key-special!": "value with spaces", "empty": ""}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
internal/info/info_test.go (1)

996-1094: 🛠️ Refactor suggestion

Implement test cases for TestStackTrace_ShortString.

The test function is structured correctly but lacks actual test cases. Since this tests a new method ShortString(), it's important to include actual test cases to verify its behavior.

Consider implementing test cases that test:

  • Different combinations of URL, FuncName, File, and Line values
  • Empty fields
  • Various formatting scenarios
 	tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       fields: fields {
-		           URL:"",
-		           FuncName:"",
-		           File:"",
-		           Line:0,
-		       },
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T,) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T,) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+			name: "all fields populated",
+			fields: fields{
+				URL:      "https://example.com",
+				FuncName: "TestFunction",
+				File:     "/path/to/file.go",
+				Line:     42,
+			},
+			want: want{
+				want: "TestFunction [/path/to/file.go:42]",
+			},
+		},
+		{
+			name: "empty URL",
+			fields: fields{
+				URL:      "",
+				FuncName: "TestFunction",
+				File:     "/path/to/file.go",
+				Line:     42,
+			},
+			want: want{
+				want: "TestFunction [/path/to/file.go:42]",
+			},
+		},
+		{
+			name: "empty FuncName",
+			fields: fields{
+				URL:      "https://example.com",
+				FuncName: "",
+				File:     "/path/to/file.go",
+				Line:     42,
+			},
+			want: want{
+				want: "[/path/to/file.go:42]",
+			},
+		},
+		{
+			name: "empty File",
+			fields: fields{
+				URL:      "https://example.com",
+				FuncName: "TestFunction",
+				File:     "",
+				Line:     42,
+			},
+			want: want{
+				want: "TestFunction [:42]",
+			},
+		},
internal/timeutil/time_test.go (2)

185-263: 🛠️ Refactor suggestion

Implement test cases for TestDurationString_Duration.

The test function has been added with proper structure but contains only TODO comments. Since this is part of time handling utilities, it's important to have proper test coverage.

Consider implementing test cases for:

  • Valid duration strings with various time units (ns, ms, s, m, h)
  • Empty strings
  • Invalid formats
  • Edge cases
 	tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T,) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T,) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+			name: "valid duration - 1s",
+			d:    DurationString("1s"),
+			want: want{
+				want: time.Second,
+				err:  nil,
+			},
+		},
+		{
+			name: "valid duration - 500ms",
+			d:    DurationString("500ms"),
+			want: want{
+				want: 500 * time.Millisecond,
+				err:  nil,
+			},
+		},
+		{
+			name: "valid duration - 2m",
+			d:    DurationString("2m"),
+			want: want{
+				want: 2 * time.Minute,
+				err:  nil,
+			},
+		},
+		{
+			name: "valid duration - 3h",
+			d:    DurationString("3h"),
+			want: want{
+				want: 3 * time.Hour,
+				err:  nil,
+			},
+		},
+		{
+			name: "empty string",
+			d:    DurationString(""),
+			want: want{
+				want: 0,
+				err:  nil,
+			},
+		},
+		{
+			name: "invalid format",
+			d:    DurationString("invalid"),
+			want: want{
+				want: 0,
+				err:  errors.New("time: invalid duration \"invalid\""),
+			},
+		},

265-349: 🛠️ Refactor suggestion

Implement test cases for TestDurationString_DurationWithDefault.

Similar to the previous function, this test has proper structure but lacks actual test cases. The DurationWithDefault method is important for handling default values when parsing fails.

Consider implementing test cases for:

  • Valid duration strings that should override the default
  • Empty strings that should use the default
  • Invalid formats that should use the default
  • Various default values
 	tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       args: args {
-		           def:nil,
-		       },
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+			name: "valid duration overrides default",
+			d:    DurationString("5s"),
+			args: args{
+				def: 10 * time.Second,
+			},
+			want: want{
+				want: 5 * time.Second,
+			},
+		},
+		{
+			name: "empty string uses default",
+			d:    DurationString(""),
+			args: args{
+				def: 10 * time.Second,
+			},
+			want: want{
+				want: 10 * time.Second,
+			},
+		},
+		{
+			name: "invalid format uses default",
+			d:    DurationString("invalid"),
+			args: args{
+				def: 10 * time.Second,
+			},
+			want: want{
+				want: 10 * time.Second,
+			},
+		},
+		{
+			name: "zero default value",
+			d:    DurationString("invalid"),
+			args: args{
+				def: 0,
+			},
+			want: want{
+				want: 0,
+			},
+		},
tests/v2/e2e/crud/dataset_test.go (1)

36-46: ⚠️ Potential issue

Undefined ds variable could cause runtime errors

The function references a global variable ds that isn't defined within this file, which could lead to unexpected nil pointer panics if not properly initialized elsewhere.

Consider either:

  1. Making ds a parameter to the function, or
  2. Adding proper initialization check with error message
-func getDatasetSlices(
-	t *testing.T, e *config.Execution,
-) (train, test iter.Cycle[[][]float32, []float32], neighbors iter.Cycle[[][]int, []int]) {
-	t.Helper()
-	if ds == nil || e == nil || e.BaseConfig == nil {
+func getDatasetSlices(
+	t *testing.T, ds dataset, e *config.Execution,
+) (train, test iter.Cycle[[][]float32, []float32], neighbors iter.Cycle[[][]int, []int]) {
+	t.Helper()
+	if ds == nil {
+		t.Fatal("dataset is nil")
+		return nil, nil, nil
+	}
+	if e == nil || e.BaseConfig == nil {
tests/v2/e2e/assets/unary_crud.yaml (1)

191-202: ⚠️ Potential issue

Fix duplicate key in YAML mapping

There's a duplication of the "name" key in the mapping at line 202, which was flagged by the static analysis tool.

  - concurrency: 1
    name: Initial Insert and Wait
    operations:
      - name: Inset Operation
        executions:
          - name: Insert
            type: insert
            mode: unary
            parallelism: 10
            num: 30000
            wait: 2m
-        name: Insert -> IndexInfo
+        # name already defined above
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 202-202: duplication of key "name" in mapping

(key-duplicates)

🧹 Nitpick comments (32)
internal/errors/k8s.go (3)

20-46: Standardize error message capitalization.

I noticed an inconsistency in the error message capitalization pattern. Most error messages start with lowercase (e.g., "invalid reconciler config", "port forward address not found"), but lines 43-45 use uppercase ("Undefined namespace", "Undefined service").

-	ErrUndefinedNamespace = New("Undefined namespace")
-	ErrUndefinedService = New("Undefined service")
+	ErrUndefinedNamespace = New("undefined namespace")
+	ErrUndefinedService = New("undefined service")

20-46: Consider adding documentation for error variables.

The error variables lack documentation comments explaining their purpose, when they're returned, and how they should be handled by consumers. Adding comments would improve code maintainability and help developers understand when to expect these errors.

For example:

 var (
+	// ErrInvalidReconcilerConfig is returned when the reconciler configuration is invalid
 	ErrInvalidReconcilerConfig = New("invalid reconciler config")

+	// ErrPodIsNotRunning returns an error when a pod in the specified namespace is not in running state
 	ErrPodIsNotRunning = func(namespace, name string) error {
 		return Errorf("pod %s/%s is not running", namespace, name)
 	}

20-46: Consider grouping related errors together.

The errors are all related to Kubernetes operations, but they could be further organized by functionality (e.g., port forwarding errors, pod-related errors, etc.) to improve readability and maintenance.

For example:

var (
	// Pod-related errors
	ErrPodIsNotRunning = func(namespace, name string) error {
		return Errorf("pod %s/%s is not running", namespace, name)
	}
	ErrPodTemplateNotFound = New("pod template not found")
	ErrNoAvailablePods = New("no available pods")

	// Port forwarding errors
	ErrPortForwardAddressNotFound = New("port forward address not found")
	ErrPortForwardPortPairNotFound = New("port forward port pair not found")

	// Kubernetes client errors
	ErrKubernetesClientNotFound = New("kubernetes client not found")
	ErrUnsupportedKubernetesResourceType = func(obj any) error {
		return Errorf("unsupported kubernetes resource type %T", obj)
	}

	// Configuration errors
	ErrInvalidReconcilerConfig = New("invalid reconciler config")
	ErrUndefinedNamespace = New("undefined namespace")
	ErrUndefinedService = New("undefined service")

	// Status errors
	ErrStatusPatternNeverMatched = New("status pattern never matched")
)
pkg/tools/cli/loadtest/service/insert_test.go (1)

16-557: Consider implementing the commented test code

The file contains extensive commented-out test code, indicating these tests are placeholders that haven't been implemented yet. As part of the E2E testing improvements mentioned in the PR, consider implementing these tests to ensure proper coverage of the insert functionality.

Would you like assistance implementing these test cases based on the updated function signatures?

pkg/index/job/deletion/service/deleter_test.go (1)

31-67: Test_New requires test cases implementation

The test structure is properly set up, but no actual test cases have been implemented. The TODO comments and example test case templates need to be replaced with real test scenarios.

Would you like me to help generate some test cases for testing the New function? I can provide implementations that test various scenarios like:

  1. Creation with default options
  2. Creation with custom options
  3. Error handling scenarios
internal/net/grpc/stream_test.go (1)

203-296: Consider implementing the test function.

While the parameters have been updated correctly, the test function remains commented out with placeholder TODOs. Consider implementing actual test cases to validate the concurrent behavior introduced in the main implementation.

Example test cases could include:

  • Testing with different concurrency values
  • Testing proper handling of nil data provider
  • Testing callback behavior with various return values
  • Verifying error propagation
internal/net/grpc/option_test.go (1)

532-3174: Consider reducing code duplication in future refactoring

All test functions follow a nearly identical pattern with significant code duplication, particularly:

  • Each function defines its own defaultCheckFunc with identical implementation
  • The test setup, table structure, and execution logic are duplicated

While not critical for this PR, consider future refactoring to improve maintainability.

You could extract common patterns into helper functions:

// Add at file level:
+func runOptionTest[T any, U any](t *testing.T, name string, arg T, optionFn func(T) Option, tests []test[T, U]) {
+    for _, tc := range tests {
+        test := tc
+        t.Run(test.name, func(tt *testing.T) {
+            tt.Parallel()
+            defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
+            // Common test execution code...
+            got := optionFn(test.args)
+            if err := checkFunc(test.want, got); err != nil {
+                tt.Errorf("error = %v", err)
+            }
+        })
+    }
+}

// Define generic test struct:
+type test[T any, U any] struct {
+    name       string
+    args       T
+    want       U
+    checkFunc  func(U, Option) error
+    beforeFunc func(*testing.T, T)
+    afterFunc  func(*testing.T, T)
+}
internal/test/data/vector/noise/option_test.go (3)

5-89: Implement actual test cases for TestWithLevelFactor.
Currently, this entire test is commented out and provides no coverage. Realistic test scenarios are essential for ensuring that the option logic works as intended.

Would you like help constructing parameterized test cases, including edge cases?


91-175: Implement actual test cases for TestWithTableDivisionFactor.
This test is also fully commented out, preventing verification of its correctness. Please add tangible test cases for normal, edge, and error conditions to validate table division factor logic.


177-261: Implement actual test cases for TestWithMinTableSize.
No coverage exists yet due to the commented-out structure. Consider thoroughly testing behaviors when the minimum table size is smaller, equal to, or larger than typical usage scenarios.

internal/test/data/vector/noise/noise_test.go (2)

5-95: Provide concrete scenarios for TestNew.
All test cases are commented out, yielding zero coverage for your constructor logic. Defining real inputs (non-empty vs. empty data, various num values, etc.) is crucial for solidifying correctness.


97-196: Fill in actual test cases for Test_noiseGenerator_Mod.
Without real test inputs, it’s impossible to verify that noise is applied correctly. Consider checks against typical vectors, edge cases like empty slices, and boundary conditions.

tests/v2/e2e/config/config.go (4)

371-423: Consider returning an explicit error for unknown operation types.
When the operation type string is unrecognized, the method returns an empty result instead of an error. Although higher-level code does catch this case, throwing an earlier error here could simplify debugging and tighten validation.


444-482: Clarify handling of unknown status codes.
The method returns an empty code when no match is found, which might be confusing or silently accepted by upstream code. Consider explicitly returning an error or fallback value to make code intent clearer.


611-615: Fail fast on invalid or non-numeric ports.
If parsing fails or the port is invalid, this method defaults to zero, which may cause unexpected behavior at runtime. Consider returning an explicit error to fail early in the configuration phase.


1-772: Consider modularizing the file into smaller config segments.
This file is quite large, packing many config definitions and bind methods into one place. Splitting it into multiple configuration sub-files (e.g., metadata, search, Kubernetes) can improve clarity and maintainability.

tests/v2/e2e/assets/unary_crud.yaml (3)

191-198: Typo in operation name "Inset" instead of "Insert"

There's a typo in the operation name at line 191 which should be "Insert Operation" instead of "Inset Operation".

-      - name: Inset Operation
+      - name: Insert Operation

204-205: Fix typo in strategy name: "Opeation" should be "Operation"

There's a typo in the strategy name which should be "Operation" instead of "Opeation".

-    name: Parallel Search Opeation (Search, SearchByID, LinearSearch, LinearSearchByID) x (ConcurrentQueue, SortSlice, SortPoolSlice, PairingHeap) = 16
+    name: Parallel Search Operation (Search, SearchByID, LinearSearch, LinearSearchByID) x (ConcurrentQueue, SortSlice, SortPoolSlice, PairingHeap) = 16

271-272: Fix typo in strategy name: "Opeation" should be "Operation"

There's another typo in the strategy name which should be "Operation" instead of "Opeation".

-    name: GetObject/Exists/GetTimestamp Opeation
+    name: GetObject/Exists/GetTimestamp Operation
tests/v2/e2e/kubernetes/client.go (3)

41-46: Unused fields in client struct

The client struct contains manager and client fields that are declared but never initialized or used in any of the functions. Consider removing these fields if they're not needed, or ensuring they're properly initialized.

type client struct {
	rest      *rest.Config
	clientset *kubernetes.Clientset
-	manager   manager.Manager
-	client    kclient.WithWatch
}

48-91: Consider simplifying nested if statements for better readability

The nested if statements to determine the kubeConfig path could be simplified for better readability. Also, there's duplicated fallback logic to in-cluster configuration that could be refactored.

Consider refactoring to reduce nesting:

func NewClient(kubeConfig, currentContext string) (c Client, err error) {
-	if kubeConfig == "" {
-		kubeConfig = os.Getenv(clientcmd.RecommendedConfigPathEnvVar)
-		if kubeConfig == "" {
-			if file.Exists(clientcmd.RecommendedHomeFile) {
-				kubeConfig = clientcmd.RecommendedHomeFile
-			}
-			if kubeConfig == "" {
-				c, err = inClusterConfigClient()
-				if err != nil {
-					return nil, err
-				}
-				return c, nil
-			}
-		}
-	}
+	// Try to find kubeConfig if not provided
+	if kubeConfig == "" {
+		kubeConfig = os.Getenv(clientcmd.RecommendedConfigPathEnvVar)
+	}
+	if kubeConfig == "" && file.Exists(clientcmd.RecommendedHomeFile) {
+		kubeConfig = clientcmd.RecommendedHomeFile
+	}
+	
+	// Use in-cluster config if no kubeConfig is available
+	if kubeConfig == "" {
+		return inClusterConfigClient()
+	}

	cfg, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
		&clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeConfig},
		&clientcmd.ConfigOverrides{
			ClusterInfo:    clientcmdapi.Cluster{},
			CurrentContext: currentContext,
		}).ClientConfig()
	if err != nil {
		log.Debugf("failed to build config from kubeConfig path %s,\terror: %v", kubeConfig, err)
		return inClusterConfigClient()
	}

	c, err = newClient(cfg)
	if err != nil {
		log.Debugf("failed to build config from kubeConfig path %s,\terror: %v", kubeConfig, err)
		return inClusterConfigClient()
	}
	return c, nil
}

+// Helper function to handle in-cluster fallback with proper error joining
+func inClusterConfigClient() (Client, error) {
+	c, err := inClusterConfigClient()
+	if err != nil {
+		return nil, err
+	}
+	return c, nil
+}

122-124: Method name typo: "GetRESRConfig" should be "GetRESTConfig"

There's a typo in the method name - "GetRESRConfig" should be "GetRESTConfig".

-func (c *client) GetRESRConfig() *rest.Config {
+func (c *client) GetRESTConfig() *rest.Config {
	return c.rest
}

Also update the interface method name to match:

type Client interface {
	GetClientSet() kubernetes.Interface
-	GetRESRConfig() *rest.Config
+	GetRESTConfig() *rest.Config
}
tests/v2/e2e/crud/object_test.go (2)

54-64: Consider removing unreachable code after t.Fatal.
Calling t.Fatal("object operation plan is nil") will terminate the test. The subsequent return after t.Fatal() is not necessary because the test ends there. While harmless, removing it might improve clarity.

62     t.Fatal("object operation plan is nil")
-63     return

65-72: Expand coverage for multiple operation modes.
Currently, only the unary (and streaming) modes are implemented for OpObject. If additional modes for OpObject become relevant (like OperationMultiple), consider implementing or explicitly documenting why they are unsupported.

tests/v2/e2e/crud/grpc_test.go (2)

49-63: Enable more granular error distinctions.
In handleGRPCCallError, all unexpected errors are logged similarly. If needed, differentiate critical vs. minor errors (e.g., by specific gRPC error codes or context) to produce more actionable logs or test outcomes.


147-186: Examine concurrency limits for stream.
grpc.BidirectionalStreamClient uses int(plan.Parallelism) for concurrency. If the stream cannot handle multiple sends in parallel, consider limiting concurrency to 1 or applying a queue-based mechanism.

tests/v2/e2e/kubernetes/portforward/option.go (1)

33-37: Clarify the default namespace choice.
The WithNamespace("default") default might conflict with testing in different namespaces. Consider either documenting this default more explicitly or providing a way to detect the active namespace at runtime.

tests/v2/e2e/hdf5/hdf5.go (1)

29-36: Consider validating data field lengths.
While maxLen helps determine maximum length, there is no explicit check to ensure that Train, Test, and Neighbors arrays all share the required dimensions for consistent operations. You may want to confirm that these dataset slices are properly aligned in size to avoid out-of-bounds errors.

tests/v2/e2e/crud/strategy_test.go (1)

139-147: Improve concurrency error handling.
Though concurrency is set using eg.SetLimit, errors in one goroutine won't immediately halt others. If fail-fast behavior is desirable, consider returning errors in a manner that stops the entire test upon failure.

tests/v2/e2e/kubernetes/portforward/portforward.go (1)

167-201: Add retry logic for endpoint watcher restarts.
Endpoints watcher restart logic logs an error and attempts to recreate the watcher, but doesn’t implement a retry or backoff pattern here. Consider adding a small delay or backoff before retrying to avoid rapid, repeated failures.

tests/v2/e2e/crud/search_test.go (2)

58-58: Prevent division by zero in recall.

If len(neighbors) is zero, the return value becomes NaN or +Inf. Consider logging a warning or returning 0 in this scenario to avoid undefined recall.

 func recall(t *testing.T, resultIDs []string, neighbors []int) float64 {
     ...
     if len(neighbors) == 0 {
+        t.Log("neighbors slice is empty, returning 0 recall")
+        return 0
     }
     return float64(count) / float64(len(neighbors))
 }

327-328: Run leftover requests batch in parallel.

Currently, the leftover requests batch is executed synchronously after the loop, unlike other batches which are processed via goroutines. Running this leftover batch concurrently would preserve consistent parallelism.

- exec(reqs)
+ batch := slices.Clone(reqs)
+ reqs = reqs[:0]
+ eg.Go(func() error {
+    exec(batch)
+    return nil
+})
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff0676b and 54c5093.

📒 Files selected for processing (134)
  • .gitfiles (14 hunks)
  • .github/workflows/_docker-image.yaml (1 hunks)
  • .github/workflows/_release-pr.yaml (1 hunks)
  • .github/workflows/build-binaries.yaml (1 hunks)
  • .github/workflows/build-protobuf.yaml (1 hunks)
  • .github/workflows/chatops.yaml (5 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/coverage.yaml (1 hunks)
  • .github/workflows/e2e-chaos.yaml (4 hunks)
  • .github/workflows/e2e-code-bench-agent.yaml (2 hunks)
  • .github/workflows/e2e-max-dim.yaml (1 hunks)
  • .github/workflows/e2e-profiling.yaml (1 hunks)
  • .github/workflows/e2e.yaml (8 hunks)
  • .github/workflows/format.yaml (2 hunks)
  • .github/workflows/fossa.yaml (1 hunks)
  • .github/workflows/helm-lint.yaml (3 hunks)
  • .github/workflows/helm.yaml (2 hunks)
  • .github/workflows/reviewdog-k8s.yaml (3 hunks)
  • .github/workflows/reviewdog.yaml (2 hunks)
  • .github/workflows/test-hack.yaml (1 hunks)
  • .github/workflows/unit-test-rust.yaml (1 hunks)
  • .github/workflows/unit-test.yaml (3 hunks)
  • .github/workflows/update-deps.yaml (1 hunks)
  • Makefile (5 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • buf.gen.yaml (1 hunks)
  • cmd/index/job/deletion/main_test.go (1 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/example/client/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/deletion/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • internal/backoff/option.go (0 hunks)
  • internal/client/v1/client/discoverer/discover_test.go (5 hunks)
  • internal/config/benchmark_test.go (4 hunks)
  • internal/config/config.go (2 hunks)
  • internal/config/index_deleter_test.go (1 hunks)
  • internal/core/algorithm/usearch/usearch_test.go (16 hunks)
  • internal/errors/errors.go (1 hunks)
  • internal/errors/errors_test.go (1 hunks)
  • internal/errors/k8s.go (1 hunks)
  • internal/info/info_test.go (17 hunks)
  • internal/iter/iter.go (1 hunks)
  • internal/net/dialer_test.go (1 hunks)
  • internal/net/grpc/errdetails/errdetails.go (6 hunks)
  • internal/net/grpc/metadata_test.go (1 hunks)
  • internal/net/grpc/option_test.go (44 hunks)
  • internal/net/grpc/pool/pool_test.go (5 hunks)
  • internal/net/grpc/server_test.go (2 hunks)
  • internal/net/grpc/stream.go (2 hunks)
  • internal/net/grpc/stream_test.go (4 hunks)
  • internal/net/http/client/client.go (1 hunks)
  • internal/net/http/client/client_test.go (1 hunks)
  • internal/net/net.go (1 hunks)
  • internal/net/net_test.go (1 hunks)
  • internal/net/quic/conn_test.go (1 hunks)
  • internal/net/quic/listener_test.go (1 hunks)
  • internal/params/option.go (2 hunks)
  • internal/params/option_test.go (1 hunks)
  • internal/params/params.go (5 hunks)
  • internal/params/params_test.go (1 hunks)
  • internal/rand/rand.go (1 hunks)
  • internal/servers/server/option_test.go (1 hunks)
  • internal/sync/errgroup/group.go (7 hunks)
  • internal/sync/errgroup/group_test.go (16 hunks)
  • internal/test/data/vector/gen.go (0 hunks)
  • internal/test/data/vector/noise/noise.go (1 hunks)
  • internal/test/data/vector/noise/noise_test.go (1 hunks)
  • internal/test/data/vector/noise/option.go (1 hunks)
  • internal/test/data/vector/noise/option_test.go (1 hunks)
  • internal/timeutil/time.go (1 hunks)
  • internal/timeutil/time_test.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (9 hunks)
  • pkg/discoverer/k8s/service/discover_test.go (4 hunks)
  • pkg/gateway/lb/handler/grpc/aggregation_test.go (2 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (2 hunks)
  • pkg/index/job/deletion/config/config_test.go (1 hunks)
  • pkg/index/job/deletion/service/deleter_test.go (1 hunks)
  • pkg/index/job/deletion/service/options_test.go (1 hunks)
  • pkg/index/job/deletion/usecase/deletion_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/insert_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/job_test.go (12 hunks)
  • pkg/tools/benchmark/job/service/object_test.go (8 hunks)
  • pkg/tools/benchmark/job/service/option_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/remove_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/search_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/update_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/upsert_test.go (4 hunks)
  • pkg/tools/cli/loadtest/service/insert_test.go (11 hunks)
  • pkg/tools/cli/loadtest/service/loader.go (1 hunks)
  • pkg/tools/cli/loadtest/service/loader_test.go (13 hunks)
  • pkg/tools/cli/loadtest/service/search_test.go (9 hunks)
  • tests/v2/e2e/assets/rollout.yaml (1 hunks)
  • tests/v2/e2e/assets/unary_crud.yaml (1 hunks)
  • tests/v2/e2e/config/config.go (1 hunks)
  • tests/v2/e2e/config/enums.go (1 hunks)
  • tests/v2/e2e/crud/crud_test.go (1 hunks)
  • tests/v2/e2e/crud/dataset_test.go (1 hunks)
  • tests/v2/e2e/crud/grpc_test.go (1 hunks)
  • tests/v2/e2e/crud/index_test.go (1 hunks)
  • tests/v2/e2e/crud/modification_test.go (1 hunks)
  • tests/v2/e2e/crud/object_test.go (1 hunks)
  • tests/v2/e2e/crud/search_test.go (1 hunks)
  • tests/v2/e2e/crud/strategy_test.go (1 hunks)
  • tests/v2/e2e/hdf5/hdf5.go (1 hunks)
  • tests/v2/e2e/kubernetes/client.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/option.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/portforward.go (1 hunks)
  • tests/v2/e2e/kubernetes/resources.go (1 hunks)
  • tests/v2/e2e/kubernetes/rollout.go (1 hunks)
  • tests/v2/e2e/kubernetes/status.go (1 hunks)
💤 Files with no reviewable changes (2)
  • internal/backoff/option.go
  • internal/test/data/vector/gen.go
🚧 Files skipped from review as they are similar to previous changes (89)
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/tools/benchmark/operator/Dockerfile
  • .github/workflows/e2e-code-bench-agent.yaml
  • .github/workflows/helm.yaml
  • .github/workflows/unit-test.yaml
  • dockers/ci/base/Dockerfile
  • dockers/example/client/Dockerfile
  • .github/workflows/unit-test-rust.yaml
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • dockers/tools/cli/loadtest/Dockerfile
  • .github/workflows/_release-pr.yaml
  • Makefile.d/e2e.mk
  • dockers/index/job/save/Dockerfile
  • pkg/tools/benchmark/job/service/upsert_test.go
  • dockers/discoverer/k8s/Dockerfile
  • .github/workflows/build-binaries.yaml
  • .github/workflows/build-protobuf.yaml
  • .github/workflows/format.yaml
  • dockers/buildbase/Dockerfile
  • dockers/index/job/correction/Dockerfile
  • dockers/agent/core/faiss/Dockerfile
  • .github/workflows/e2e-profiling.yaml
  • dockers/gateway/lb/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • pkg/tools/benchmark/job/service/search_test.go
  • .github/workflows/update-deps.yaml
  • .github/workflows/fossa.yaml
  • buf.gen.yaml
  • dockers/index/job/creation/Dockerfile
  • pkg/tools/cli/loadtest/service/loader.go
  • .github/workflows/codeql-analysis.yml
  • dockers/tools/benchmark/job/Dockerfile
  • pkg/tools/benchmark/job/service/object_test.go
  • dockers/manager/index/Dockerfile
  • .github/workflows/_docker-image.yaml
  • dockers/dev/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • dockers/operator/helm/Dockerfile
  • dockers/index/job/deletion/Dockerfile
  • dockers/agent/sidecar/Dockerfile
  • dockers/index/job/readreplica/rotate/Dockerfile
  • pkg/tools/benchmark/job/service/insert_test.go
  • .github/workflows/e2e.yaml
  • internal/errors/errors.go
  • internal/net/grpc/errdetails/errdetails.go
  • .github/workflows/test-hack.yaml
  • internal/core/algorithm/usearch/usearch_test.go
  • Makefile.d/functions.mk
  • internal/net/net.go
  • .github/workflows/e2e-max-dim.yaml
  • internal/config/index_deleter_test.go
  • dockers/index/operator/Dockerfile
  • .github/workflows/e2e-chaos.yaml
  • internal/config/benchmark_test.go
  • tests/v2/e2e/kubernetes/rollout.go
  • internal/timeutil/time.go
  • .github/workflows/reviewdog.yaml
  • pkg/index/job/deletion/config/config_test.go
  • internal/rand/rand.go
  • .github/workflows/chatops.yaml
  • tests/v2/e2e/crud/crud_test.go
  • tests/v2/e2e/assets/rollout.yaml
  • internal/net/quic/conn_test.go
  • internal/net/http/client/client_test.go
  • pkg/agent/core/ngt/service/ngt_test.go
  • internal/net/http/client/client.go
  • pkg/tools/benchmark/job/service/job_test.go
  • pkg/agent/core/ngt/service/ngt.go
  • pkg/tools/benchmark/job/service/remove_test.go
  • pkg/tools/benchmark/job/service/update_test.go
  • internal/test/data/vector/noise/option.go
  • internal/errors/errors_test.go
  • internal/net/grpc/server_test.go
  • dockers/agent/core/agent/Dockerfile
  • pkg/tools/cli/loadtest/service/search_test.go
  • internal/params/params_test.go
  • internal/client/v1/client/discoverer/discover_test.go
  • .github/workflows/coverage.yaml
  • pkg/discoverer/k8s/service/discover_test.go
  • internal/net/grpc/pool/pool_test.go
  • .github/workflows/reviewdog-k8s.yaml
  • pkg/gateway/lb/handler/grpc/aggregation_test.go
  • cmd/index/job/deletion/main_test.go
  • pkg/tools/cli/loadtest/service/loader_test.go
  • .github/workflows/helm-lint.yaml
  • Makefile
  • internal/config/config.go
🧰 Additional context used
🧠 Learnings (1)
.gitfiles (1)
Learnt from: datelier
PR: vdaas/vald#2807
File: rust/bin/agent/src/handler/object.rs:36-38
Timestamp: 2025-03-13T04:50:01.551Z
Learning: In Rust code for Vald handlers, avoid using unwrap() on Option types. Instead, handle None values explicitly by returning appropriate error statuses to maintain robustness.
🪛 YAMLlint (1.35.1)
tests/v2/e2e/assets/unary_crud.yaml

[error] 202-202: duplication of key "name" in mapping

(key-duplicates)

⏰ Context from checks skipped due to timeout of 90000ms (198)
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: check-format-diff
  • GitHub Check: coverage
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for internal packages
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
🔇 Additional comments (64)
internal/net/quic/listener_test.go (1)

1-196: Test skeletons should be implemented or removed

The file consists entirely of commented-out test code for QUIC listener functionality. While the test structure follows good practices (table-driven tests, proper setup/teardown, parallel execution, and goroutine leak detection), having unimplemented test skeletons in the codebase can lead to confusion and maintenance challenges.

Consider either:

  1. Implementing the tests with actual test cases
  2. Removing these commented-out skeletons until they're ready to be implemented
internal/net/grpc/metadata_test.go (1)

18-101: Commented test function needs implementation or explanation

The newly added TestNewMetadata function follows the project's test structure pattern but is currently commented out with TODO placeholders. This is consistent with other test functions in this file, but differs from standard practices in the rest of the codebase.

Please either:

  1. Implement concrete test cases for the NewMetadata function
  2. Add a comment explaining why this test and others in this file remain commented out
  3. Consider adding necessary imports (reflect, errors, goleak) if you plan to uncomment these tests
#!/bin/bash
# Check if other test files in the project follow this pattern of commented tests
# or if tests are typically implemented

echo "Checking patterns in other test files in the project..."
# Check how many test files have commented out test functions
rg "^// func Test" --type go | wc -l

# Check how many test files have uncommented, implemented test functions
rg "^func Test" --type go | head -n 10

# Check if the NewMetadata function exists and is exported
echo "Checking if NewMetadata function exists and is exported..."
rg "^func NewMetadata\(" --type go internal/net/grpc/
pkg/index/job/deletion/service/options_test.go (5)

1-3: Implementation placeholder without active test logic.

This file appears to be a placeholder for service option tests with all code commented out. The structure is in place, but none of the tests are actually functional in their current state.

For the file to contribute to the V2 E2E strategic testing framework mentioned in the PR objectives, these tests need to be uncommented and properly implemented. Also note that required import statements are missing (such as reflect, errors, and goleak).


5-89: Uncomment and implement test cases for WithDiscoverer.

The test template for WithDiscoverer is well-structured but needs to be uncommented and implemented with concrete test cases. Consider scenarios for:

  1. Valid discoverer client
  2. Nil client handling
  3. Edge cases to ensure robustness

Since this PR focuses on enhancing the testing infrastructure, implementing these test cases would directly support that objective.


91-175: Add comprehensive test cases for WithIndexingConcurrency.

The TestWithIndexingConcurrency function should be uncommented and implemented to test various concurrency scenarios. The implementation of WithIndexingConcurrency likely checks for non-positive values, so consider testing:

  1. Zero concurrency value
  2. Negative concurrency value
  3. Standard/expected concurrency values
  4. Very high concurrency values

This would contribute to ensuring the robustness of the concurrency handling in the E2E testing framework.


177-261: Implement test cases for WithTargetAddrs function.

The TestWithTargetAddrs test is currently only a commented-out scaffold. Please uncomment and add proper test cases covering:

  1. Empty address slice
  2. Single address
  3. Multiple addresses
  4. Invalid address format (if validation is performed)
  5. Duplicate addresses (if deduplication is expected)

Implementing these tests aligns with the PR's goal of improving testing capabilities.


263-347: Add test cases for WithTargetIndexID function.

The TestWithTargetIndexID function should be uncommented and implemented with test cases that verify:

  1. Empty index ID behavior
  2. Valid index ID handling
  3. Special character handling (if relevant)
  4. Very long index IDs (if there are length constraints)

This would ensure that the WithTargetIndexID option correctly assigns values to the target index ID in the service.

pkg/gateway/lb/handler/grpc/handler_test.go (5)

805-807: Enhanced test coverage with attribute validation

The addition of wantAttrs []attribute.KeyValue to the want struct properly extends the test coverage to validate the attributes returned by the doSearch method.


814-814: Function signature updated to accommodate attributes validation

The checkFunc signature has been correctly updated to accept the new attribute validation parameter.


818-818: Implementation consistency in default check function

The defaultCheckFunc signature has been appropriately updated to match the changes in the checkFunc type.


825-827: Complete attribute validation logic implementation

The added validation code properly compares the returned attributes against the expected values, completing the test enhancement.


923-924: Method invocation and check function call properly updated

The doSearch method call and subsequent checkFunc invocation have been correctly modified to handle the new attribute return value and validation.

pkg/tools/cli/loadtest/service/insert_test.go (2)

24-24: Improved type safety with pointer return types

The change from func() any to func() *any across these function signatures shows a consistent approach to handling return values as pointers rather than direct values. This change:

  • Provides more precise control over the returned data
  • Aligns with memory efficiency best practices for potentially large data structures
  • Enables explicit nil returns to indicate absence of value

Note that this approach requires careful null checking in the implementation code to avoid potential nil pointer dereferences.

Also applies to: 32-32, 36-36, 119-119, 126-126, 130-130, 209-209, 216-216, 220-220


305-305: More descriptive variable naming

Renaming dataProvider to sendDataProvider improves code clarity by more precisely describing the function's purpose. This consistent renaming across all occurrences follows good naming convention practices and makes the code more maintainable.

Also applies to: 344-344, 373-373, 414-414, 437-437, 476-476, 505-505, 546-546

internal/params/option.go (5)

20-23: New import statements align with extended functionality.

The additions of os and filepath imports support the new WithName function that uses filepath.Base(os.Args[0]) to set the parser name dynamically based on the executable.


27-36: Default options enhanced with meaningful defaults.

The updated defaultOptions now includes:

  1. Setting the parser name to the current executable name
  2. Setting overrideDefault to false as a safe default

These changes improve usability while maintaining backward compatibility.


38-45: Well-implemented WithName function with null safety.

The function properly checks for empty strings before setting the name, preventing potential issues with empty parser names.


89-94: Simple and effective WithOverrideDefault implementation.

This function follows the same pattern as the other option functions, providing a clean interface for controlling whether the default flag.CommandLine should be overridden.


96-109: Well-documented and robust WithArgumentFilters function.

The function:

  1. Includes clear documentation about its purpose and behavior
  2. Properly handles empty filters list with an early return
  3. Initializes the filters slice if nil
  4. Implements defensive programming with the nil check

This will be useful for filtering out unwanted command line arguments.

internal/params/params.go (7)

29-35: Type alias and constants improve error handling clarity.

Creating a type alias for flag.ErrorHandling with appropriate constants makes the code more readable and improves the API by exposing these options directly.


53-70: Enhanced parser struct with new fields.

The parser struct now includes:

  1. overrideDefault flag to control global flag behavior
  2. name for identifying the parser
  3. filters for argument filtering
  4. f to store the FlagSet
  5. defaults to preserve the original CommandLine
  6. ErrorHandler for customized error handling

These additions significantly enhance the parser's capabilities.


78-82: Global state management introduces concurrency risks.

The code correctly preserves the default CommandLine and initializes a new FlagSet. However, the Override() method modifies global state which can cause issues in concurrent environments.

Consider documenting the concurrency limitations or implementing a safer approach to avoid shared state issues when multiple parser instances are active simultaneously.


105-115: Robust argument filtering implementation.

The filtering implementation:

  1. Preserves the original command-line arguments
  2. Efficiently filters arguments using slices.DeleteFunc
  3. Includes proper nil checks for both filters and filter functions
  4. Uses a clear predicate function that returns true for arguments to be deleted

This provides powerful filtering capabilities while maintaining good error handling.


117-123: Improved error handling using errors.Is.

Replacing direct error comparison with errors.Is(err, flag.ErrHelp) is a better practice for error checking. This makes the error handling more robust against changes in the error implementation.


135-139: Document concurrent usage limitations for Restore.

The Restore method resets the global flag.CommandLine to its original value, which could cause unpredictable behavior if multiple parser instances are used concurrently.

Consider documenting that this method should be used with caution in concurrent environments.


141-145: Document concurrent usage limitations for Override.

Similar to Restore, the Override method changes global state by replacing flag.CommandLine, which can lead to race conditions when multiple parsers are active.

This was previously identified in another review. Please ensure this is acknowledged through documentation or architectural changes.

internal/params/option_test.go (1)

450-705: Implement or remove commented test functions.

The file contains three completely commented-out test functions:

  • TestWithName
  • TestWithOverrideDefault
  • TestWithArgumentFilters

Each contains placeholder TODO markers and lacks actual test implementations.

Given the new functionality is already implemented in the main code, consider either:

  1. Implementing these tests to verify the correctness of the new functions
  2. Removing the commented code if it's not intended for this PR
  3. Adding a comment explaining why they're commented out and when they should be implemented

Without these tests, the new functionality lacks proper test coverage.

pkg/index/job/deletion/service/deleter_test.go (2)

181-294: Test_index_StartClient requires mock implementation

This test function needs mock implementations for proper testing, as mentioned in the previous review comment. The table-driven structure is in place, but concrete test cases with mocks for the client interface are required.


407-519: Test_index_doDeleteIndex needs mock implementation for gRPC client

This test function requires mock implementations for the gRPC client function to properly test the core deletion functionality.

internal/net/net_test.go (2)

1199-1284: Implement test cases for IsUDP and IsTCP functions.

Both test functions are well-structured but currently commented out and lack actual test cases. Network type checking functions are critical for reliability and deserve thorough testing.

Consider adding test cases for:

  1. Standard network types (e.g., "udp", "tcp")
  2. Variant types (e.g., "udp4", "udp6", "tcp4", "tcp6")
  3. Case sensitivity (e.g., "UDP", "Udp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings

1286-1369: Implement test cases for IsTCP function.

The IsTCP test function follows the same pattern as IsUDP but is also commented out and missing actual test cases. This function should be properly implemented to ensure reliable network type checking.

internal/net/grpc/stream_test.go (2)

205-210: Updated parameter structure matches the implementation changes.

The modified parameter structure for the TestBidirectionalStreamClient function now correctly aligns with the changes in the actual implementation. The new parameters (concurrency, sendDataProvider, and callBack) reflect the updated function signature in stream.go.


290-290: Function call updated to match new signature.

The call to BidirectionalStreamClient has been properly updated to include the new concurrency parameter and use the renamed data provider and callback parameters.

internal/net/grpc/stream.go (3)

171-171: Function signature improved with concurrency parameter.

The addition of the concurrency parameter allows for better control of parallel operations in the client stream.


179-181: Concurrency limit implementation.

Good addition of conditional concurrency limit setting. This ensures the error group only limits concurrent operations when explicitly requested.


212-237: Improved concurrent message sending implementation.

The changes implement asynchronous message sending using goroutines and proper synchronization with a WaitGroup. This is a significant improvement that:

  1. Allows for concurrent sending of messages to the stream
  2. Ensures all send operations complete before closing the stream
  3. Maintains proper error handling
  4. Provides controllable concurrency through the new parameter
internal/net/grpc/option_test.go (2)

1977-2060: Type specification refinement for window size parameters

The parameter type changes from int to int32 for both WithInitialWindowSize and WithInitialConnectionWindowSize properly align with gRPC's standard parameter types.

Also applies to: 2063-2146


2409-2493: Enhanced network configuration for dialer function

The addition of a network string parameter to WithDialer improves flexibility by allowing specification of the network type (e.g., "tcp", "udp"). This follows standard Go network programming patterns.

internal/test/data/vector/noise/noise.go (2)

125-166: Noise generation logic looks solid.
The usage of the Box-Muller transform to precompute Gaussian noise is efficient and should minimize overhead at runtime.


180-181:

✅ Verification successful

Ensure Go 1.21+ for slices.Clone.
slices.Clone is part of the standard library from Go 1.21 onward. Verify your build environment supports it.


🏁 Script executed:

#!/bin/bash
# Check Go version in the CI environment
go version

Length of output: 83


CI Environment Verified: Go 1.24 Usage

The CI test shows that the build environment is using Go 1.24, so slices.Clone is supported correctly.

internal/info/info_test.go (1)

341-342: Addition of valdReplacer looks good.

The new valdReplacer field has been properly added to the fields struct in all test functions and initialized correctly in the test instance creation.

Also applies to: 427-429, 593-594, 679-681, 697-698, 783-785, 883-884

internal/sync/errgroup/group_test.go (1)

946-1057: 🛠️ Refactor suggestion

Resolve Test_group_TryGo implementation or removal.

The code has been refactored to use exec instead of TryGo, but the old test function is still commented out rather than removed. This creates ambiguity about which method should be used.

If both methods (TryGo and exec) are meant to coexist in the API:

  • Uncomment and update Test_group_TryGo to ensure both methods have test coverage
  • Document the differences between the methods and when to use each

If TryGo is being deprecated:

  • Remove the commented out Test_group_TryGo function entirely
  • Add a deprecated notice in the implementation if you're keeping the method for backward compatibility

The changes to use atomic.Int64 for the limit field and simplify the return value structure look good.

Also applies to: 1172-1288

internal/net/dialer_test.go (1)

1992-2079: Test skeleton remains commented out.
This test function is still fully commented out and lacks implementation, mirroring a previously noted concern. Please consider either removing it or implementing the test cases to avoid lingering technical debt.

internal/sync/errgroup/group.go (1)

17-268: Concurrency logic appears solid.
The introduction of a semaphore-based approach for limiting concurrent goroutines, alongside a direct inline execution path for limit == 1, is well-structured. Error handling, context cancellation, and error aggregation in Wait() are also sensibly implemented. No critical issues stand out.

internal/iter/iter.go (2)

22-22: Potential circular import or naming confusion.
Importing "iter" within the iter package may lead to circular or ambiguous references. This concern was previously raised; ensure that "iter" is indeed an external package or rename the alias to avoid confusion.


53-59: Return a no-op cycle for empty slices instead of nil.
Continuing to return nil for an empty or nil slice may trigger downstream panics if iterator methods get invoked. A no-op cycle would provide more consistent behavior. This duplicate suggestion was made earlier but remains relevant.

.gitfiles (4)

126-126: No code logic to review.
The reference to .github/workflows/unit-test-rust.yaml generally looks good. Please ensure the new Rust-based unit test workflow is properly integrated with your existing CI/CD pipeline.


161-177: Doc files addition.
These entries only list new or modified documentation-related YAML and Markdown files. There's no functional code impact; everything looks fine from a review standpoint.


2034-2052: Additional e2e test files.
The newly referenced files under tests/v2/e2e/ appear to integrate with your expanded test framework. No concerns regarding the file references themselves.


2064-2064: Reference to K3D version.
This line simply indicates an additional version file for K3D. No logic issues.

tests/v2/e2e/crud/index_test.go (1)

30-52: Well-structured index operation handler with good error handling

The processIndex function provides a clean implementation for handling various index operations based on the execution plan type. The code effectively uses a helper pattern with the single function to reduce duplication across different operation types.

tests/v2/e2e/kubernetes/portforward/option.go (1)

95-101: Validate port mappings.
Similar to previous suggestions, adding safeguards to ensure that port numbers in pairs are valid (non-zero, within a sensible range, etc.) can help prevent silent misconfiguration.

95 func WithPorts(pairs map[uint16]uint16) Option {
96     return func(pf *portForward) {
97         if pairs != nil {
98             // Validate the port pairs before assigning
+            for local, remote := range pairs {
+                if local == 0 || remote == 0 {
+                    // Optionally, log or return an error
+                    // t.Errorf("Invalid port mapping: %d -> %d", local, remote)
+                }
+            }
             pf.ports = pairs
tests/v2/e2e/hdf5/hdf5.go (2)

59-63: Double-check failover logic when switching data sources.
The logic will switch to d.Test if d.Train is empty or smaller than d.Test. This might inadvertently override legitimate training data. Confirm the fallback to ensure it aligns with expected usage.


110-114: Validate dataset dimensionality before indexing.
Currently, the code assumes exactly two dimensions. If an HDF5 dataset has fewer or more dimensions, indexing dims[1] will result in a panic. Enforce a check like if len(dims) != 2 { ... } to avoid runtime errors.

tests/v2/e2e/crud/strategy_test.go (1)

152-155: Return errors from processOperation to enable fail-fast.
Here, processOperation is invoked but always returns nil. If an operation fails internally, the error won't bubble up to errgroup. Returning the error and allowing errgroup to propagate it will help surface issues earlier.

tests/v2/e2e/kubernetes/portforward/portforward.go (1)

289-293: Provide more context in error returns.
When no pods are available, the function logs an error but returns a generic errors.ErrNoAvailablePods without including the namespace, service name, or addresses. Adding more contextual details may accelerate troubleshooting.

tests/v2/e2e/config/enums.go (1)

1-113: No issues found; enumerations are well-defined.

All string constants are clearly named and organized, making them easily maintainable.

tests/v2/e2e/crud/modification_test.go (1)

1-185: Implementation is consistent and thorough.

The modular approach for each operation type (insert, update, upsert, remove, removeByTimestamp) is clear, and reusability across request builders is well-structured. No further concerns.

tests/v2/e2e/crud/search_test.go (1)

76-78: Check for out-of-bounds in calculateRecall.

Using neighbors[:len(topKIDs)] can lead to a slice bounds error if len(topKIDs) exceeds len(neighbors).

Would you like to verify that all use cases guarantee len(neighbors) >= len(topKIDs), or shall we bound it gracefully in the code?

tests/v2/e2e/kubernetes/status.go (4)

83-114: Consider user-configurable polling intervals or timeouts.
Relying on a fixed 5-second ticker plus an indefinite loop can cause hang-ups if the context is not canceled or the resource never reaches the desired status. Providing configurable or default timeouts can reduce the risk of unbounded waiting.


185-246: Add explicit checks for DeploymentReplicaFailure.
Currently, there is no condition check for ReplicaFailure, which can improve visibility if replicas fail to deploy. Including a condition like if cond.Type == appsv1.DeploymentReplicaFailure { ... } would accelerate detection of such failures.


310-340: Refine DaemonSet condition checks to include real condition types.
Using appsv1.DaemonSetConditionType("") might miss specific condition types like DaemonSetReplicaFailure. Enumerating known conditions ensures issues are surfaced more reliably.


483-497: Handle additional service types like NodePort and ExternalName.
At present, the code checks only LoadBalancer. NodePort, ExternalName, and other types may require unique checks (e.g., missing external references or no external IP concept). Accounting for these service types can improve e2e coverage.

tests/v2/e2e/kubernetes/resources.go (1)

579-608: Wrap errors with more context when updating pod annotations.
Returning errors as-is can obscure the root cause. Consider wrapping them to preserve context for debugging. For example:

-    return obj, err
+    return obj, errors.Wrap(err, "failed to set annotations and update the resource")

Comment on lines +1 to +4
package service

// NOT IMPLEMENTED BELOW
//
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

File contains commented out test implementations

This file contains test functions that are all commented out with a clear marker "NOT IMPLEMENTED BELOW". While the test structure is good with table-driven tests, none of the tests are actually runnable in their current state.

For proper test coverage, uncomment the code and implement the actual test cases. The file is well-structured but needs actual implementation.

Comment on lines +296 to +405
// type want struct {
// err error
// }
// type test struct {
// name string
// args args
// fields fields
// want want
// checkFunc func(want, error) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, err error) error {
// if !errors.Is(err, w.err) {
// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// ctx:nil,
// },
// fields: fields {
// client:nil,
// targetAddrs:nil,
// targetIndexID:"",
// concurrency:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// ctx:nil,
// },
// fields: fields {
// client:nil,
// targetAddrs:nil,
// targetIndexID:"",
// concurrency:0,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
// idx := &index{
// client: test.fields.client,
// targetAddrs: test.fields.targetAddrs,
// targetIndexID: test.fields.targetIndexID,
// concurrency: test.fields.concurrency,
// }
//
// err := idx.Start(test.args.ctx)
// if err := checkFunc(test.want, err); err != nil {
// tt.Errorf("error = %v", err)
// }
//
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Test_index_Start requires implementation with context testing

The test structure is set up, but actual test cases need to be implemented. Since this test involves context, it would be important to test context cancellation behavior.

Implement test cases that cover:

  1. Successful start operation
  2. Context cancellation handling
  3. Error propagation from downstream operations

Consider using mocks for any dependencies to ensure isolated testing.

Comment on lines +108 to +123
// Estimate the optimal noise table size.
// Heuristic: required unique noise samples = (num * vectorDim) / noiseTableDivisionFactor.
// The size is rounded up to the next power of two, ensuring it is at least minNoiseTableSize.
noiseTableSize := func() int {
if len(data) == 0 || len(data[0]) == 0 {
return 1 << 20 // Fallback default.
}
required := num * uint64(len(data[0])) // Total required unique noise samples.
// Reduce the required noise samples by the division factor.
required /= ng.noiseTableDivisionFactor
// Ensure the noise table size is at least minNoiseTableSize.
if required < ng.minNoiseTableSize {
required = ng.minNoiseTableSize
}
return 1 << bits.Len64(required-1)
}()
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Check for zero-valued noiseTableDivisionFactor.
Currently, there is no safeguard if ng.noiseTableDivisionFactor is zero, which would cause a division error at line 117.

You can either assert a minimum value (e.g., 1) or handle zero gracefully to avoid unexpected runtime behavior.

Comment on lines +185 to +196
if d.Metadata == nil {
d.Metadata = make(map[string]string)
}
for _, meta := range strings.Split(config.GetActualValue(d.MetaString), ",") {
key, val, ok := strings.Cut(meta, "=")
if ok && key != "" && val != "" {
d.Metadata[config.GetActualValue(key)] = config.GetActualValue(val)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add validation for metadata inputs.
Currently, metadata is split and inserted into the Metadata map without length checks, allowed characters checks, or whitespace trimming. This can lead to unexpected values or potential misuse if inputs are not trusted.

Comment on lines 79 to 127
func unary[Q, R proto.Message](
t *testing.T,
ctx context.Context,
data iter.Cycle[[][]float32, []float32],
plan *config.Execution,
call grpcCall[Q, R],
newReq newRequest[Q],
) {
t.Helper()
// Create an error group to manage concurrent requests.
eg, ctx := errgroup.New(ctx)
for i, vec := range data.Seq2(ctx) {
// For each test vector, iterate over all modification configurations.
idx := i
// Launch the index modify request in a goroutine.
eg.Go(func() error {
req := newReq(idx, strconv.FormatUint(idx, 10), vec, plan)
single(t, ctx, plan, req, call)
return nil
})
}
// Wait for all goroutines to complete.
eg.Wait()
}

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Capture goroutine errors.
In the unary function, errors from single() are exclusively logged through t.Errorf(). Consider returning them from the goroutines and capturing them via eg.Wait() to enforce clearer test failures.

 94     eg.Go(func() error {
 95       req := newReq(idx, strconv.FormatUint(idx, 10), vec, plan)
 96       single(t, ctx, plan, req, call)
-97       return nil
+97       // Return an error if single() fails. handleGRPCCallError currently logs errors but doesn't propagate them.
+98       // You could wrap single() to return errors if needed.
+99       // For example (pseudocode):
+100      // err := singleWithError(ctx, plan, req, call)
+101      // return err
+102      return nil
 98     })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func unary[Q, R proto.Message](
t *testing.T,
ctx context.Context,
data iter.Cycle[[][]float32, []float32],
plan *config.Execution,
call grpcCall[Q, R],
newReq newRequest[Q],
) {
t.Helper()
// Create an error group to manage concurrent requests.
eg, ctx := errgroup.New(ctx)
for i, vec := range data.Seq2(ctx) {
// For each test vector, iterate over all modification configurations.
idx := i
// Launch the index modify request in a goroutine.
eg.Go(func() error {
req := newReq(idx, strconv.FormatUint(idx, 10), vec, plan)
single(t, ctx, plan, req, call)
return nil
})
}
// Wait for all goroutines to complete.
eg.Wait()
}
func unary[Q, R proto.Message](
t *testing.T,
ctx context.Context,
data iter.Cycle[[][]float32, []float32],
plan *config.Execution,
call grpcCall[Q, R],
newReq newRequest[Q],
) {
t.Helper()
// Create an error group to manage concurrent requests.
eg, ctx := errgroup.New(ctx)
for i, vec := range data.Seq2(ctx) {
// For each test vector, iterate over all modification configurations.
idx := i
// Launch the index modify request in a goroutine.
eg.Go(func() error {
req := newReq(idx, strconv.FormatUint(idx, 10), vec, plan)
single(t, ctx, plan, req, call)
// Return an error if single() fails. handleGRPCCallError currently logs errors but doesn't propagate them.
// You could wrap single() to return errors if needed.
// For example (pseudocode):
// err := singleWithError(ctx, plan, req, call)
// return err
return nil
})
}
// Wait for all goroutines to complete.
eg.Wait()
}

@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch 4 times, most recently from f66d3cf to f316d56 Compare March 14, 2025 17:28
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (11)
pkg/tools/benchmark/job/service/option_test.go (1)

1632-1716: ⚠️ Potential issue

Implementation of test cases still needed for WithMetadata

The test function structure is in place, but there are no actual test cases implemented to verify the functionality of WithMetadata. The commented sections with "TODO test cases" should be replaced with proper test implementations.

Following the previous review suggestion, please implement at least these test cases:

  1. Test with nil map
  2. Test with empty map
  3. Test with populated map
  4. Test with map containing special characters

Here's a suggested implementation:

tests := []test{
- // TODO test cases
- /*
-    {
-        name: "test_case_1",
-        args: args {
-            m:nil,
-        },
-        want: want{},
-        checkFunc: defaultCheckFunc,
-        beforeFunc: func(t *testing.T, args args) {
-            t.Helper()
-        },
-        afterFunc: func(t *testing.T, args args) {
-            t.Helper()
-        },
-    },
- */
+    {
+        name: "nil map",
+        args: args{
+            m: nil,
+        },
+        want: want{
+            want: WithMetadata(nil),
+        },
+        checkFunc: defaultCheckFunc,
+    },
+    {
+        name: "empty map",
+        args: args{
+            m: map[string]string{},
+        },
+        want: want{
+            want: WithMetadata(map[string]string{}),
+        },
+        checkFunc: defaultCheckFunc,
+    },
+    {
+        name: "populated map",
+        args: args{
+            m: map[string]string{"key1": "value1", "key2": "value2"},
+        },
+        want: want{
+            want: WithMetadata(map[string]string{"key1": "value1", "key2": "value2"}),
+        },
+        checkFunc: defaultCheckFunc,
+    },
+    {
+        name: "map with special characters",
+        args: args{
+            m: map[string]string{"special@key": "value-with-special-chars!@#$%^&*()"},
+        },
+        want: want{
+            want: WithMetadata(map[string]string{"special@key": "value-with-special-chars!@#$%^&*()"}),
+        },
+        checkFunc: defaultCheckFunc,
+    },
internal/servers/server/option_test.go (1)

3727-4066: ⚠️ Potential issue

Implement the commented test functions for comprehensive gRPC options coverage

These four commented test functions are critical for validating gRPC configuration options used in the V2 E2E testing framework. These tests should be uncommented and implemented with actual test cases to ensure proper functionality.

Based on the established pattern in this file, each test function should include at least:

  • A "set success" case with valid parameters
  • A parameter validation case (e.g., "not set when size is invalid")
-// func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
+func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
     type args struct {
         size uint32
     }
-    type want struct {
-        want Option
-    }
     type test struct {
         name       string
         args       args
-        want       want
-        checkFunc  func(want, Option) error
-        beforeFunc func(*testing.T, args)
-        afterFunc  func(*testing.T, args)
+        checkFunc  func(opt Option) error
     }
-    defaultCheckFunc := func(w want, got Option) error {
-        if !reflect.DeepEqual(got, w.want) {
-            return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
-        }
-        return nil
-    }
     tests := []test{
-        // TODO test cases
-        /*
-           {
-               name: "test_case_1",
-               args: args {
-                   size:0,
-               },
-               want: want{},
-               checkFunc: defaultCheckFunc,
-               beforeFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-               afterFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-           },
-        */
+        {
+            name: "set success when size is more than 0",
+            args: args{
+                size: 100,
+            },
+            checkFunc: func(opt Option) error {
+                got := new(server)
+                opt(got)
+                if len(got.grpc.opts) != 1 {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
+        {
+            name: "not set when size is 0",
+            args: args{
+                size: 0,
+            },
+            checkFunc: func(opt Option) error {
+                gopts := []grpc.ServerOption{
+                    grpc.ConnectionTimeout(10 * time.Second),
+                }
+                got := new(server)
+                got.grpc.opts = gopts
+                opt(got)
+                if !reflect.DeepEqual(got.grpc.opts, gopts) {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
     }

     for _, tc := range tests {
         test := tc
         t.Run(test.name, func(tt *testing.T) {
-            tt.Parallel()
-            defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
-            if test.beforeFunc != nil {
-                test.beforeFunc(tt, test.args)
-            }
-            if test.afterFunc != nil {
-                defer test.afterFunc(tt, test.args)
-            }
-            checkFunc := test.checkFunc
-            if test.checkFunc == nil {
-                checkFunc = defaultCheckFunc
-            }
-
-            got := WithGRPCMaxConcurrentStreams(test.args.size)
-            if err := checkFunc(test.want, got); err != nil {
+            got := WithGRPCMaxConcurrentStreams(test.args.size)
+            if err := test.checkFunc(got); err != nil {
                 tt.Errorf("error = %v", err)
             }
         })
     }
-}
+}

Similar implementations should be applied to the other three test functions: TestWithGRPCNumStreamWorkers, TestWithGRPCSharedWriteBuffer, and TestWithGRPCWaitForHandlers.

pkg/index/job/deletion/usecase/deletion_test.go (3)

329-442: 🛠️ Refactor suggestion

Fix parameter naming in Test_run_PreStop and implement test cases.

The Test_run_PreStop function uses generic parameter names like in0 instead of meaningful names like ctx. This should be fixed when implementing the function.

- type args struct {
-   in0 context.Context
- }
+ type args struct {
+   ctx context.Context
+ }

And later:

- err := r.PreStop(test.args.in0)
+ err := r.PreStop(test.args.ctx)

559-672: 🛠️ Refactor suggestion

Fix parameter naming in Test_run_PostStop and implement test cases.

Similar to the PreStop function, the Test_run_PostStop uses generic parameter names (in0) instead of descriptive ones. This should be corrected when implementing the test.

- type args struct {
-   in0 context.Context
- }
+ type args struct {
+   ctx context.Context
+ }

And later:

- err := r.PostStop(test.args.in0)
+ err := r.PostStop(test.args.ctx)

1-672: 🛠️ Refactor suggestion

Add missing import statements for test dependencies.

The test file is missing import statements for required packages such as:

  • "errors"
  • "context"
  • "reflect"
  • "testing"
  • "go.uber.org/goleak"
  • "golang.org/x/sync/errgroup"
  • Any package containing config.Data
  • Any package containing service.Deleter
  • Any package containing runner.Runner
  • Any package containing starter.Server
  • Any package containing observability.Observability

Add the following import block at the top of the file:

 package usecase

+import (
+	"context"
+	"errors"
+	"reflect"
+	"testing"
+
+	"github.com/vdaas/vald/internal/config"
+	"github.com/vdaas/vald/internal/observability"
+	"github.com/vdaas/vald/internal/runner"
+	"github.com/vdaas/vald/internal/errors"
+	"github.com/vdaas/vald/pkg/index/job/deletion/service"
+	"github.com/vdaas/vald/pkg/index/job/starter"
+	"go.uber.org/goleak"
+	"golang.org/x/sync/errgroup"
+)
tests/v2/e2e/assets/unary_crud.yaml (1)

202-203: ⚠️ Potential issue

Fix duplicate key in YAML mapping

There's a duplication of the "name" key in the mapping. Line 203 defines a "name" key while the same key is already defined at the operation level on line 192.

Apply this fix:

  - concurrency: 1
    name: Initial Insert and Wait
    operations:
      - name: Inset Operation
        executions:
          - name: Insert
            type: insert
            mode: unary
            parallelism: 10
            num: 30000
            wait: 2m
          - mode: unary
            name: IndexInfo
            type: index_info
-        name: Insert -> IndexInfo
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 203-203: duplication of key "name" in mapping

(key-duplicates)

internal/net/net_test.go (2)

1201-1284: 🛠️ Refactor suggestion

Implement test cases for IsUDP function

The test function is well-structured but currently commented out and lacks actual test cases. Network type checking functions are critical for reliability and deserve thorough testing.

Implement test cases for:

  1. Standard network types (e.g., "udp")
  2. Variant types (e.g., "udp4", "udp6")
  3. Case sensitivity (e.g., "UDP", "Udp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings

Example implementation:

func TestIsUDP(t *testing.T) {
    type args struct {
        network string
    }
    type want struct {
        want bool
    }
    type test struct {
        name       string
        args       args
        want       want
        checkFunc  func(want, bool) error
        beforeFunc func(*testing.T, args)
        afterFunc  func(*testing.T, args)
    }
    defaultCheckFunc := func(w want, got bool) error {
        if !reflect.DeepEqual(got, w.want) {
            return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
        }
        return nil
    }
    tests := []test{
        {
            name: "return true when network is udp",
            args: args{
                network: "udp",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return true when network is udp4",
            args: args{
                network: "udp4",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return true when network is udp6",
            args: args{
                network: "udp6",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return true when network is uppercase UDP",
            args: args{
                network: "UDP",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return true when network is mixed case Udp",
            args: args{
                network: "Udp",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return false when network is tcp",
            args: args{
                network: "tcp",
            },
            want: want{
                want: false,
            },
        },
        {
            name: "return false when network is empty",
            args: args{
                network: "",
            },
            want: want{
                want: false,
            },
        },
        {
            name: "return false when network is invalid",
            args: args{
                network: "invalid",
            },
            want: want{
                want: false,
            },
        },
    }

    for _, tc := range tests {
        test := tc
        t.Run(test.name, func(tt *testing.T) {
            tt.Parallel()
            defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
            if test.beforeFunc != nil {
                test.beforeFunc(tt, test.args)
            }
            if test.afterFunc != nil {
                defer test.afterFunc(tt, test.args)
            }
            checkFunc := test.checkFunc
            if test.checkFunc == nil {
                checkFunc = defaultCheckFunc
            }

            got := IsUDP(test.args.network)
            if err := checkFunc(test.want, got); err != nil {
                tt.Errorf("error = %v", err)
            }
        })
    }
}

1286-1369: 🛠️ Refactor suggestion

Implement test cases for IsTCP function

Similar to the IsUDP test, this test function for IsTCP needs to be implemented with actual test cases.

Implement test cases for the TCP network type with the same comprehensive coverage as suggested for the UDP tests - standard types, variants, case sensitivity, invalid inputs, etc.

Example implementation:

func TestIsTCP(t *testing.T) {
    type args struct {
        network string
    }
    type want struct {
        want bool
    }
    type test struct {
        name       string
        args       args
        want       want
        checkFunc  func(want, bool) error
        beforeFunc func(*testing.T, args)
        afterFunc  func(*testing.T, args)
    }
    defaultCheckFunc := func(w want, got bool) error {
        if !reflect.DeepEqual(got, w.want) {
            return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
        }
        return nil
    }
    tests := []test{
        {
            name: "return true when network is tcp",
            args: args{
                network: "tcp",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return true when network is tcp4",
            args: args{
                network: "tcp4",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return true when network is tcp6",
            args: args{
                network: "tcp6",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return true when network is uppercase TCP",
            args: args{
                network: "TCP",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return true when network is mixed case Tcp",
            args: args{
                network: "Tcp",
            },
            want: want{
                want: true,
            },
        },
        {
            name: "return false when network is udp",
            args: args{
                network: "udp",
            },
            want: want{
                want: false,
            },
        },
        {
            name: "return false when network is empty",
            args: args{
                network: "",
            },
            want: want{
                want: false,
            },
        },
        {
            name: "return false when network is invalid",
            args: args{
                network: "invalid",
            },
            want: want{
                want: false,
            },
        },
    }

    for _, tc := range tests {
        test := tc
        t.Run(test.name, func(tt *testing.T) {
            tt.Parallel()
            defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
            if test.beforeFunc != nil {
                test.beforeFunc(tt, test.args)
            }
            if test.afterFunc != nil {
                defer test.afterFunc(tt, test.args)
            }
            checkFunc := test.checkFunc
            if test.checkFunc == nil {
                checkFunc = defaultCheckFunc
            }

            got := IsTCP(test.args.network)
            if err := checkFunc(test.want, got); err != nil {
                tt.Errorf("error = %v", err)
            }
        })
    }
}
internal/iter/iter.go (1)

52-59: 🛠️ Refactor suggestion

Return a non‑nil iterator for empty slices

This code still returns nil when array is nil or empty, which can cause nil pointer dereferences if methods are called downstream. Consider returning a no‑op iterator with zero length for consistency and safety. For example:

 func NewCycle[S ~[]E, E any](array S, num, offset uint64, mod func(uint64, E) E) Cycle[S, E] {
   if array == nil || len(array) == 0 {
-    return nil
+    // Return a no-op cycle to avoid nil pointer issues
+    return &cycle[S, E]{
+      array:   array,
+      size:    0,
+      num:     0,
+      offset:  offset,
+      modFunc: mod,
+    }
   }
   ...
 }
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 52-67: internal/iter/iter.go#L52-L67
Added lines #L52 - L67 were not covered by tests

tests/v2/e2e/crud/grpc_test.go (1)

98-107: 🛠️ Refactor suggestion

Return goroutine errors for better test visibility.
Currently, the goroutine always returns nil, preventing errgroup.Wait() from failing on errors. If a call in single fails, returning that error instead of nil would allow the test to fail properly, ensuring clearer indications of failure.

 eg.Go(func() error {
     single(t, ctx, plan, newReq(idx, strconv.FormatUint(idx, 10), vec, plan), call, callback...)
-    return nil
+    // Consider returning an error if the call fails:
+    // if single encountered an error, propagate it here.
+    return /* the error, if any */
 })
tests/v2/e2e/crud/strategy_test.go (1)

60-61: ⚠️ Potential issue

Use t.Fatalf for client creation errors to avoid proceeding with a nil client.

Right now, the code logs an error using t.Errorf at line 60 but continues execution, which can lead to a nil Kubernetes client further down. Converting it to t.Fatalf will immediately halt the test, preventing subsequent nil-pointer failures.

- t.Errorf("failed to create kubernetes client: %v", err)
+ t.Fatalf("failed to create kubernetes client: %v", err)
🧹 Nitpick comments (14)
tests/v2/e2e/assets/unary_crud.yaml (1)

192-192: Typo in operation name: "Inset" should be "Insert"

There is a typo in the operation name on line 192.

Apply this simple fix:

-      - name: Inset Operation
+      - name: Insert Operation
tests/v2/e2e/kubernetes/client.go (3)

41-46: Remove or initialize unused fields in client struct

The client struct includes manager and client fields that are never initialized or used in the implementation. These appear to be unused in the current code.

Consider either:

  1. Removing these fields if they're not needed
  2. Initializing them if they're intended to be used
  3. Adding a comment explaining their purpose if they're for future use
type client struct {
	rest      *rest.Config
	clientset *kubernetes.Clientset
-	manager   manager.Manager
-	client    kclient.WithWatch
}

48-91: Refactor error handling for better readability

The NewClient function contains repetitive error handling logic with multiple nested errors and fallbacks. This makes the code harder to follow and maintain.

Consider refactoring the error handling to improve readability and reduce duplication:

func NewClient(kubeConfig, currentContext string) (c Client, err error) {
	// Try to use provided kubeConfig or find from standard locations
	if kubeConfig == "" {
		kubeConfig = os.Getenv(clientcmd.RecommendedConfigPathEnvVar)
		if kubeConfig == "" && file.Exists(clientcmd.RecommendedHomeFile) {
			kubeConfig = clientcmd.RecommendedHomeFile
		}
	}

	// If no kubeConfig found, use in-cluster config
	if kubeConfig == "" {
		return inClusterConfigClient()
	}

	// Try to build config from kubeConfig path
	cfg, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
		&clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeConfig},
		&clientcmd.ConfigOverrides{
			ClusterInfo:    clientcmdapi.Cluster{},
			CurrentContext: currentContext,
		}).ClientConfig()
	if err != nil {
		log.Debugf("failed to build config from kubeConfig path %s, error: %v", kubeConfig, err)
		return inClusterConfigClient()
	}

	// Try to create client with config
	c, err = newClient(cfg)
	if err != nil {
		log.Debugf("failed to create client with config from path %s, error: %v", kubeConfig, err)
		return inClusterConfigClient()
	}
	return c, nil
}

93-108: Validate QPS and Burst configuration values

The code sets default values for QPS and Burst only when they're 0, but doesn't handle negative values which could also be problematic.

Consider adding validation to ensure positive values:

func newClient(cfg *rest.Config) (Client, error) {
-	if cfg.QPS == 0.0 {
+	// Ensure positive values for QPS and Burst
+	if cfg.QPS <= 0.0 {
		cfg.QPS = 20.0
	}
-	if cfg.Burst == 0 {
+	if cfg.Burst <= 0 {
		cfg.Burst = 30
	}
	// Rest of the function...
internal/errors/k8s.go (1)

20-46: Comprehensive Kubernetes error types added.

The addition of specialized Kubernetes error types improves error handling by:

  1. Providing clear, descriptive error messages
  2. Supporting parameterized errors (namespace/pod name)
  3. Following a consistent error creation pattern

These error types will make debugging and error handling more structured throughout the Kubernetes integration code.

Note: Consider standardizing capitalization in error messages - most messages use lowercase first letters, but ErrUndefinedNamespace and ErrUndefinedService use uppercase.

-	ErrUndefinedNamespace = New("Undefined namespace")
+	ErrUndefinedNamespace = New("undefined namespace")

-	ErrUndefinedService = New("Undefined service")
+	ErrUndefinedService = New("undefined service")
tests/v2/e2e/crud/index_test.go (1)

32-38: Consider logging the error in indexCallBack.
When err is non-nil, this function simply returns true without logging the error details. Logging it (or returning false) could help diagnose issues in E2E testing.

 func indexCallBack[R proto.Message](res R, err error) bool {
 	if err != nil {
+		log.Errorf("index callback error: %v", err)
 		return true
 	}
 	log.Infof("response: %v", res)
 	return true
 }
internal/test/data/vector/noise/noise_test.go (1)

97-196: Implement Test_noiseGenerator_Mod to increase coverage.

The function is present but commented out. Adding real test cases will confirm that noise is applied correctly to the vectors.

Would you like help generating sample test inputs and assertions?

tests/v2/e2e/crud/object_test.go (1)

65-89: Consider modularizing the nested switch logic.
The nested switch on plan.Type and plan.Mode is growing in complexity. Extracting individual cases into helper functions could simplify the code, improve readability, and make it easier to maintain.

tests/v2/e2e/crud/grpc_test.go (1)

125-146: Remove or implement the empty exec(batch []Q) function.
The function exec(batch []Q) appears incomplete and is never used. To reduce confusion and improve maintainability, either remove it or implement the necessary logic for processing bulk requests.

tests/v2/e2e/kubernetes/portforward/portforward.go (2)

286-286: Fix the function comment to match the actual function name.

The doc comment at line 286 references portForwardToServicePod, but the function name is portForwardToService. Updating this mismatch helps improve code clarity.

-// portForwardToServicePod
+// portForwardToService

269-270: Consider surfacing endpoint retrieval errors to the error channel.

When loadTargets fails to retrieve endpoints, an error is only logged. If endpoint unavailability is critical for continued test logic, pushing an error to pf.ech may help surface failures earlier and more transparently.

log.Errorf("failed to get endpoints for service %s: %v", pf.serviceName, err)
+select {
+case <-ctx.Done():
+	return
+case pf.ech <- err:
+}
tests/v2/e2e/crud/modification_test.go (1)

110-113: Nondeterministic timestamps may lead to inconsistent test results.

For remove-by-timestamp, using time.Now().UnixNano() when ts == 0 can cause unpredictable results across test runs. If reproducible E2E tests are needed, consider providing a fixed or user-configurable timestamp for improved consistency.

tests/v2/e2e/kubernetes/resources.go (2)

316-336: Consider using write locks for update and create operations.

Currently, these methods obtain a read lock (RLock) even though they perform resource-modifying operations. If the underlying ResourceInterface or its data structures are not guaranteed to be concurrency-safe for writes across multiple goroutines, consider using a write lock (Lock) instead or a different locking strategy to avoid potential data races or inconsistent states.


580-608: Consider logging updates to annotations for better debugging.

When updating annotations in SetPodAnnotations, adding an optional log entry (especially when encountering conflicts or partial successes) may simplify diagnosing annotation-related issues in E2E tests.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54c5093 and f316d56.

📒 Files selected for processing (134)
  • .gitfiles (14 hunks)
  • .github/workflows/_docker-image.yaml (1 hunks)
  • .github/workflows/_release-pr.yaml (1 hunks)
  • .github/workflows/build-binaries.yaml (1 hunks)
  • .github/workflows/build-protobuf.yaml (1 hunks)
  • .github/workflows/chatops.yaml (5 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/coverage.yaml (1 hunks)
  • .github/workflows/e2e-chaos.yaml (4 hunks)
  • .github/workflows/e2e-code-bench-agent.yaml (2 hunks)
  • .github/workflows/e2e-max-dim.yaml (1 hunks)
  • .github/workflows/e2e-profiling.yaml (1 hunks)
  • .github/workflows/e2e.yaml (8 hunks)
  • .github/workflows/format.yaml (2 hunks)
  • .github/workflows/fossa.yaml (1 hunks)
  • .github/workflows/helm-lint.yaml (3 hunks)
  • .github/workflows/helm.yaml (2 hunks)
  • .github/workflows/reviewdog-k8s.yaml (3 hunks)
  • .github/workflows/reviewdog.yaml (2 hunks)
  • .github/workflows/test-hack.yaml (1 hunks)
  • .github/workflows/unit-test-rust.yaml (1 hunks)
  • .github/workflows/unit-test.yaml (3 hunks)
  • .github/workflows/update-deps.yaml (1 hunks)
  • Makefile (5 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • buf.gen.yaml (1 hunks)
  • cmd/index/job/deletion/main_test.go (1 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/example/client/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/deletion/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • internal/backoff/option.go (0 hunks)
  • internal/client/v1/client/discoverer/discover_test.go (5 hunks)
  • internal/config/benchmark_test.go (4 hunks)
  • internal/config/config.go (2 hunks)
  • internal/config/index_deleter_test.go (1 hunks)
  • internal/core/algorithm/usearch/usearch_test.go (16 hunks)
  • internal/errors/errors.go (1 hunks)
  • internal/errors/errors_test.go (1 hunks)
  • internal/errors/k8s.go (1 hunks)
  • internal/info/info_test.go (17 hunks)
  • internal/iter/iter.go (1 hunks)
  • internal/net/dialer_test.go (1 hunks)
  • internal/net/grpc/errdetails/errdetails.go (6 hunks)
  • internal/net/grpc/metadata_test.go (1 hunks)
  • internal/net/grpc/option_test.go (44 hunks)
  • internal/net/grpc/pool/pool_test.go (5 hunks)
  • internal/net/grpc/server_test.go (2 hunks)
  • internal/net/grpc/stream.go (2 hunks)
  • internal/net/grpc/stream_test.go (4 hunks)
  • internal/net/http/client/client.go (1 hunks)
  • internal/net/http/client/client_test.go (1 hunks)
  • internal/net/net.go (1 hunks)
  • internal/net/net_test.go (1 hunks)
  • internal/net/quic/conn_test.go (1 hunks)
  • internal/net/quic/listener_test.go (1 hunks)
  • internal/params/option.go (2 hunks)
  • internal/params/option_test.go (1 hunks)
  • internal/params/params.go (5 hunks)
  • internal/params/params_test.go (1 hunks)
  • internal/rand/rand.go (1 hunks)
  • internal/servers/server/option_test.go (1 hunks)
  • internal/sync/errgroup/group.go (7 hunks)
  • internal/sync/errgroup/group_test.go (16 hunks)
  • internal/test/data/vector/gen.go (0 hunks)
  • internal/test/data/vector/noise/noise.go (1 hunks)
  • internal/test/data/vector/noise/noise_test.go (1 hunks)
  • internal/test/data/vector/noise/option.go (1 hunks)
  • internal/test/data/vector/noise/option_test.go (1 hunks)
  • internal/timeutil/time.go (1 hunks)
  • internal/timeutil/time_test.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (9 hunks)
  • pkg/discoverer/k8s/service/discover_test.go (4 hunks)
  • pkg/gateway/lb/handler/grpc/aggregation_test.go (2 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (2 hunks)
  • pkg/index/job/deletion/config/config_test.go (1 hunks)
  • pkg/index/job/deletion/service/deleter_test.go (1 hunks)
  • pkg/index/job/deletion/service/options_test.go (1 hunks)
  • pkg/index/job/deletion/usecase/deletion_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/insert_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/job_test.go (12 hunks)
  • pkg/tools/benchmark/job/service/object_test.go (8 hunks)
  • pkg/tools/benchmark/job/service/option_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/remove_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/search_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/update_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/upsert_test.go (4 hunks)
  • pkg/tools/cli/loadtest/service/insert_test.go (11 hunks)
  • pkg/tools/cli/loadtest/service/loader.go (1 hunks)
  • pkg/tools/cli/loadtest/service/loader_test.go (13 hunks)
  • pkg/tools/cli/loadtest/service/search_test.go (9 hunks)
  • tests/v2/e2e/assets/rollout.yaml (1 hunks)
  • tests/v2/e2e/assets/unary_crud.yaml (1 hunks)
  • tests/v2/e2e/config/config.go (1 hunks)
  • tests/v2/e2e/config/enums.go (1 hunks)
  • tests/v2/e2e/crud/crud_test.go (1 hunks)
  • tests/v2/e2e/crud/dataset_test.go (1 hunks)
  • tests/v2/e2e/crud/grpc_test.go (1 hunks)
  • tests/v2/e2e/crud/index_test.go (1 hunks)
  • tests/v2/e2e/crud/modification_test.go (1 hunks)
  • tests/v2/e2e/crud/object_test.go (1 hunks)
  • tests/v2/e2e/crud/search_test.go (1 hunks)
  • tests/v2/e2e/crud/strategy_test.go (1 hunks)
  • tests/v2/e2e/hdf5/hdf5.go (1 hunks)
  • tests/v2/e2e/kubernetes/client.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/option.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/portforward.go (1 hunks)
  • tests/v2/e2e/kubernetes/resources.go (1 hunks)
  • tests/v2/e2e/kubernetes/rollout.go (1 hunks)
  • tests/v2/e2e/kubernetes/status.go (1 hunks)
💤 Files with no reviewable changes (2)
  • internal/backoff/option.go
  • internal/test/data/vector/gen.go
🚧 Files skipped from review as they are similar to previous changes (96)
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/buildbase/Dockerfile
  • .github/workflows/build-binaries.yaml
  • .github/workflows/unit-test-rust.yaml
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/example/client/Dockerfile
  • dockers/tools/benchmark/operator/Dockerfile
  • dockers/index/operator/Dockerfile
  • .github/workflows/e2e-profiling.yaml
  • dockers/binfmt/Dockerfile
  • .github/workflows/e2e-code-bench-agent.yaml
  • .github/workflows/update-deps.yaml
  • .github/workflows/format.yaml
  • dockers/agent/core/agent/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • dockers/operator/helm/Dockerfile
  • dockers/manager/index/Dockerfile
  • .github/workflows/test-hack.yaml
  • dockers/ci/base/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • .github/workflows/helm-lint.yaml
  • .github/workflows/chatops.yaml
  • .github/workflows/unit-test.yaml
  • pkg/tools/benchmark/job/service/object_test.go
  • dockers/dev/Dockerfile
  • dockers/agent/core/faiss/Dockerfile
  • dockers/index/job/creation/Dockerfile
  • .github/workflows/_release-pr.yaml
  • dockers/index/job/deletion/Dockerfile
  • dockers/index/job/correction/Dockerfile
  • internal/errors/errors.go
  • .github/workflows/reviewdog.yaml
  • .github/workflows/reviewdog-k8s.yaml
  • tests/v2/e2e/assets/rollout.yaml
  • pkg/tools/benchmark/job/service/search_test.go
  • pkg/tools/benchmark/job/service/upsert_test.go
  • dockers/buildkit/Dockerfile
  • pkg/tools/benchmark/job/service/insert_test.go
  • .github/workflows/codeql-analysis.yml
  • dockers/tools/benchmark/job/Dockerfile
  • pkg/tools/benchmark/job/service/remove_test.go
  • pkg/tools/benchmark/job/service/update_test.go
  • buf.gen.yaml
  • .github/workflows/build-protobuf.yaml
  • Makefile.d/e2e.mk
  • Makefile.d/functions.mk
  • .github/workflows/helm.yaml
  • .github/workflows/e2e.yaml
  • dockers/gateway/mirror/Dockerfile
  • dockers/agent/sidecar/Dockerfile
  • dockers/tools/cli/loadtest/Dockerfile
  • internal/net/grpc/errdetails/errdetails.go
  • cmd/index/job/deletion/main_test.go
  • pkg/index/job/deletion/config/config_test.go
  • internal/net/quic/conn_test.go
  • dockers/index/job/save/Dockerfile
  • internal/test/data/vector/noise/option_test.go
  • .github/workflows/fossa.yaml
  • internal/net/net.go
  • internal/timeutil/time.go
  • internal/errors/errors_test.go
  • dockers/gateway/lb/Dockerfile
  • internal/config/index_deleter_test.go
  • pkg/tools/benchmark/job/service/job_test.go
  • internal/config/benchmark_test.go
  • dockers/discoverer/k8s/Dockerfile
  • tests/v2/e2e/kubernetes/rollout.go
  • tests/v2/e2e/crud/dataset_test.go
  • internal/core/algorithm/usearch/usearch_test.go
  • internal/net/http/client/client.go
  • tests/v2/e2e/crud/crud_test.go
  • .github/workflows/e2e-chaos.yaml
  • internal/rand/rand.go
  • internal/params/params_test.go
  • internal/net/grpc/stream_test.go
  • .github/workflows/_docker-image.yaml
  • pkg/agent/core/ngt/service/ngt_test.go
  • pkg/index/job/deletion/service/deleter_test.go
  • .github/workflows/e2e-max-dim.yaml
  • .github/workflows/coverage.yaml
  • internal/config/config.go
  • pkg/discoverer/k8s/service/discover_test.go
  • pkg/gateway/lb/handler/grpc/aggregation_test.go
  • internal/info/info_test.go
  • pkg/index/job/deletion/service/options_test.go
  • pkg/tools/cli/loadtest/service/search_test.go
  • internal/client/v1/client/discoverer/discover_test.go
  • internal/net/http/client/client_test.go
  • tests/v2/e2e/kubernetes/portforward/option.go
  • tests/v2/e2e/crud/search_test.go
  • pkg/tools/cli/loadtest/service/loader_test.go
  • pkg/tools/cli/loadtest/service/insert_test.go
  • tests/v2/e2e/config/enums.go
  • internal/net/grpc/server_test.go
  • pkg/agent/core/ngt/service/ngt.go
  • internal/net/grpc/option_test.go
🧰 Additional context used
🧠 Learnings (1)
.gitfiles (1)
Learnt from: datelier
PR: vdaas/vald#2807
File: rust/bin/agent/src/handler/object.rs:36-38
Timestamp: 2025-03-13T04:50:01.551Z
Learning: In Rust code for Vald handlers, avoid using unwrap() on Option types. Instead, handle None values explicitly by returning appropriate error statuses to maintain robustness.
🪛 GitHub Check: codecov/patch
internal/iter/iter.go

[warning] 52-67: internal/iter/iter.go#L52-L67
Added lines #L52 - L67 were not covered by tests


[warning] 72-77: internal/iter/iter.go#L72-L77
Added lines #L72 - L77 were not covered by tests


[warning] 81-87: internal/iter/iter.go#L81-L87
Added lines #L81 - L87 were not covered by tests


[warning] 89-91: internal/iter/iter.go#L89-L91
Added lines #L89 - L91 were not covered by tests


[warning] 96-97: internal/iter/iter.go#L96-L97
Added lines #L96 - L97 were not covered by tests


[warning] 101-107: internal/iter/iter.go#L101-L107
Added lines #L101 - L107 were not covered by tests


[warning] 109-111: internal/iter/iter.go#L109-L111
Added lines #L109 - L111 were not covered by tests


[warning] 117-123: internal/iter/iter.go#L117-L123
Added lines #L117 - L123 were not covered by tests


[warning] 125-127: internal/iter/iter.go#L125-L127
Added lines #L125 - L127 were not covered by tests


[warning] 132-137: internal/iter/iter.go#L132-L137
Added lines #L132 - L137 were not covered by tests


[warning] 139-141: internal/iter/iter.go#L139-L141
Added lines #L139 - L141 were not covered by tests


[warning] 145-146: internal/iter/iter.go#L145-L146
Added lines #L145 - L146 were not covered by tests


[warning] 150-151: internal/iter/iter.go#L150-L151
Added lines #L150 - L151 were not covered by tests

pkg/tools/cli/loadtest/service/loader.go

[warning] 207-207: pkg/tools/cli/loadtest/service/loader.go#L207
Added line #L207 was not covered by tests


[warning] 212-212: pkg/tools/cli/loadtest/service/loader.go#L212
Added line #L212 was not covered by tests

🪛 YAMLlint (1.35.1)
tests/v2/e2e/assets/unary_crud.yaml

[error] 203-203: duplication of key "name" in mapping

(key-duplicates)

⏰ Context from checks skipped due to timeout of 90000ms (110)
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
🔇 Additional comments (72)
internal/net/grpc/pool/pool_test.go (1)

2874-2893: Improved variable naming for better readability and consistency

The renaming of fields from generic names like want and want1 to more descriptive names like wantConn and wantOk makes the test code more readable and self-documenting. This type of refactoring enhances maintainability by clarifying what each variable represents.

The consistent application of this naming pattern across the test functions maintains a good coding standard throughout the file.

Also applies to: 3009-3010, 3043-3065, 3185-3186

pkg/gateway/lb/handler/grpc/handler_test.go (4)

804-807: Expanded the want struct to include attributes field.

The addition of the wantAttrs []attribute.KeyValue field to the want struct in Test_server_doSearch indicates that the test now validates additional data returned from the search operation, enhancing test coverage.


814-814: Updated function signature to handle additional attributes parameter.

The checkFunc signature has been modified to accommodate the new attribute data being returned from the doSearch method. This ensures proper validation of all return values.


818-827: Enhanced default check function with attribute validation.

The updated defaultCheckFunc now includes a comparison of the returned attributes against expected values, providing more comprehensive validation of the search operation's behavior.


923-924: Updated method invocation to capture and validate attributes.

The test now properly captures and validates the attributes returned by the doSearch method. This change ensures that the test maintains parity with the updated method signature.

pkg/index/job/deletion/usecase/deletion_test.go (4)

1-93: Uncomment and implement the TestNew function with actual test cases.

The entire TestNew function is currently commented out with a "NOT IMPLEMENTED BELOW" note. The function structure is well-designed with a table-driven test approach, but it needs to be uncommented and populated with actual test cases.

Would you like me to provide example test cases for the New function that test:

  1. Creating a runner with valid configuration
  2. Handling nil configuration
  3. Various error scenarios

95-208: Uncomment and implement the Test_run_PreStart function.

The Test_run_PreStart function is well-structured but currently commented out. Beyond just uncommenting, this test requires actual test cases that validate the PreStart functionality.

I can help by providing example test cases that verify:

  1. Successful initialization with valid context and dependencies
  2. Error handling for nil context
  3. Behavior when underlying components (server/indexer) return errors

210-327: Uncomment and implement the Test_run_Start function.

The Test_run_Start function tests a critical component that returns an error channel. This requires specialized test cases to verify proper channel behavior and error propagation.

I can provide example test cases that demonstrate:

  1. Successful start with proper channel setup
  2. Error conditions from server/indexer components
  3. Testing channel behavior using goroutines and context cancellation

444-557: Uncomment and implement the Test_run_Stop function.

The Test_run_Stop function is critical for validating graceful shutdown. It's well-structured but currently commented out and needs actual test cases.

I can provide example test cases that verify:

  1. Successful shutdown scenario
  2. Error propagation when server or indexer fails to stop
  3. Resource cleanup verification
pkg/tools/cli/loadtest/service/loader.go (2)

212-212: Function signature update consistently applied

The addition of l.concurrency parameter to this call is consistent with the change on line 207, ensuring uniform adoption of the updated API across both stream types.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 212-212: pkg/tools/cli/loadtest/service/loader.go#L212
Added line #L212 was not covered by tests


207-207:

❓ Verification inconclusive

Function signature change applied correctly

The addition of l.concurrency parameter to grpc.BidirectionalStreamClient call correctly implements the updated API signature. This change supports the new concurrency control feature in the streaming client.

Consider adding test coverage for these changed lines, as static analysis indicates they aren't covered by tests:


🏁 Script executed:

#!/bin/bash
# Check if there are any tests for the BidirectionalStreamClient with the new signature
rg -A 5 'BidirectionalStreamClient\(.+concurrency' pkg/tools/cli/loadtest/service/

Length of output: 954


Concurrency Control Signature Update Verified – Please Add Test Coverage

The change to include the l.concurrency parameter in the grpc.BidirectionalStreamClient call has been verified and correctly implements the updated API signature for the streaming client. However, our static analysis confirms that these modified lines (in pkg/tools/cli/loadtest/service/loader.go, around line 207) are not covered by any tests. Please add appropriate test cases to ensure this new concurrency behavior is thoroughly validated.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 207-207: pkg/tools/cli/loadtest/service/loader.go#L207
Added line #L207 was not covered by tests

tests/v2/e2e/assets/unary_crud.yaml (2)

16-119: Comprehensive test configuration setup looks good

The E2E test configuration is well structured with appropriate settings for the time zone, logging, dataset, Kubernetes integration, and target service connection parameters. The connection pool, backoff, dial options, and TLS configurations provide a complete test environment.


180-368: Well-structured test strategies covering key operations

The test strategies are comprehensive, covering index property checking, data insertion, parallel search operations with different algorithms, object operations, update/upsert/remove operations, and index statistics. The staged approach with appropriate wait times between operations will help ensure reliable test results.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 203-203: duplication of key "name" in mapping

(key-duplicates)

internal/net/grpc/metadata_test.go (1)

18-101: Implement or document commented test template

The TestNewMetadata function is commented out and exists only as a skeleton with TODO placeholders. This pattern of commented-out test templates doesn't appear to be a standard practice in the repository.

Please either implement concrete test cases for NewMetadata or add an inline comment explaining why this test remains inactive. Let's verify the implementation status of other test functions in this package:

#!/bin/bash
# Check the implementation status of test functions in this package
rg "^func Test.+\(" --type go internal/net/grpc/ | grep -v "_test" | wc -l
echo "Number of exported test functions:"
rg "^func Test.+\(" --type go internal/net/grpc/metadata_test.go | wc -l
echo "Number of commented test functions:"
rg "^// func Test.+\(" --type go internal/net/grpc/metadata_test.go | wc -l
internal/timeutil/time_test.go (2)

185-263: Implement test cases for TestDurationString_Duration.

The test function is well-structured but currently commented out and lacks actual test cases. Time handling is critical for system reliability and proper testing would ensure the Duration method works correctly across various inputs.

Consider implementing test cases that cover:

  • Valid duration strings with various time units (ns, ms, s, m, h)
  • Empty strings
  • Invalid formats
  • Edge cases (extremely large or small durations)

265-349: Implement test cases for TestDurationString_DurationWithDefault.

Similar to the previous function, this test has the proper structure but lacks actual test cases. The DurationWithDefault method appears to be important for handling default values when parsing fails.

Consider implementing test cases that verify:

  • Valid duration strings correctly parse and ignore the default
  • Empty strings return the default value
  • Invalid formats return the default value
  • Various default values are properly returned when needed
internal/net/quic/listener_test.go (1)

1-196: Test skeletons should be implemented or removed.

The file contains well-structured test skeletons for QUIC listener functionality, but they're entirely commented out. While the structure follows good testing practices with proper setup for test cases, check functions, and leak detection, they lack actual implementation.

Consider either:

  1. Implementing at least basic test cases to provide real test coverage, or
  2. Removing these commented-out skeletons until they're ready to be implemented

Commented-out code in the codebase can lead to confusion and maintenance challenges over time.

internal/net/grpc/stream.go (3)

169-172: LGTM: Good concurrency enhancement in BidirectionalStreamClient signature.

The addition of a concurrency parameter to control the maximum number of parallel operations is a good improvement to the function signature. This provides more flexibility in how clients use the streaming functionality.


179-181: LGTM: Proper implementation of concurrency limiting.

The conditional check to set the limit on the error group only when concurrency is greater than zero is well implemented. This ensures backward compatibility while enabling the new concurrency control feature.


212-237: LGTM: Well-structured concurrent sending implementation.

The addition of a WaitGroup to coordinate goroutines and wrapping the SendMsg operation in a goroutine managed by the error group is well implemented. The code correctly:

  1. Adds to the WaitGroup before launching each goroutine
  2. Waits for all send operations to complete before closing the stream
  3. Properly propagates errors from the goroutines
  4. Handles cleanup with defer statements

This change should improve performance for high-throughput streaming scenarios.

internal/params/option.go (5)

20-23: LGTM: Appropriate imports for new functionality.

Adding the necessary imports for os and filepath to support the executable name retrieval is correct.


27-36: LGTM: Good default name initialization.

Setting the default name to the executable's base name via filepath.Base(os.Args[0]) is a sensible default that improves usability. The addition of WithOverrideDefault(false) maintains backward compatibility while enabling the new feature.


38-45: LGTM: Well-implemented WithName option.

The WithName function appropriately validates the input name to prevent setting an empty string and correctly modifies the parser's name field.


89-94: LGTM: Clean implementation of WithOverrideDefault.

The WithOverrideDefault function is straightforward and correctly sets the parser's overrideDefault field.


96-109: LGTM: Well-designed WithArgumentFilters function.

The WithArgumentFilters function is well-implemented with:

  1. Early return if no filters are provided
  2. Proper initialization of the filters slice if it's nil
  3. Efficient capacity pre-allocation based on the number of filters
  4. Clear documentation explaining the filtering behavior

This design allows for flexible argument filtering while maintaining good performance.

internal/sync/errgroup/group_test.go (2)

946-1057: Unimplemented test functions should be addressed

The Test_group_exec function is commented out, similar to multiple other test functions in this file. This is especially concerning as there were multiple previous review comments requesting to resolve the commented-out Test_group_TryGo function.

Having commented-out test code creates technical debt and leaves the behavior of these methods untested. Please either:

  1. Implement and uncomment both test functions if both exec and TryGo methods are intended to coexist
  2. Implement only Test_group_exec and remove Test_group_TryGo if the latter is being deprecated

1172-1288: Address commented-out test functions

This Test_group_TryGo function remains commented out despite multiple previous review comments asking to either implement it or remove it. This creates confusion about whether the TryGo method is still supported in the API.

If both exec and TryGo methods are intended to coexist, please implement tests for both. Otherwise, remove the commented-out test to reduce confusion and technical debt.

internal/net/dialer_test.go (1)

1993-2079: Implement or remove commented test function

The Test_isQUICDial function is commented out entirely. This was already flagged in a previous review. Having placeholder tests in the codebase leads to technical debt if they're left unimplemented for extended periods.

Please either:

  1. Implement concrete test cases that validate the isQUICDial function's behavior, or
  2. Remove the commented-out code until you're ready to implement the tests

If this is part of a larger testing initiative, consider implementing tests incrementally in separate PRs rather than adding multiple commented-out skeletons.

internal/params/option_test.go (1)

452-705: Implement or remove commented test functions

Three new test functions are added but entirely commented out: TestWithName, TestWithOverrideDefault, and TestWithArgumentFilters. This issue was previously identified in a review.

These skeleton tests:

  1. Will never execute in their current form
  2. Contain TODO markers with no actual implementation
  3. Use different testing practices (tt.Parallel() and goleak.IgnoreCurrent()) compared to existing tests

Please either implement these tests with actual test cases or remove the commented code to reduce technical debt. If these are templates for future implementation, add a comment explaining their purpose and when they should be implemented.

internal/params/params.go (6)

29-35: Improved error handling with dedicated type and constants.

The addition of the ErrorHandling type alias and constants creates a more structured approach to error handling in parameter parsing, improving code readability and maintainability.


53-70: Enhanced parser struct with better configuration options.

The parser struct has been extended with useful configuration options like:

  • overrideDefault to control flag overriding
  • name for better identification
  • filters for argument filtering
  • f for FlagSet storage
  • Proper error handling strategy

This makes the parser more flexible and configurable.


78-82: Appropriate FlagSet initialization in New method.

The initialization of the FlagSet with name and error handling strategy is well-implemented, with proper handling of the override option.


105-115: Well-implemented argument filtering mechanism.

The addition of argument filtering using slices.DeleteFunc is a clean implementation that allows for selectively ignoring specific command-line arguments that match the provided filter functions.


117-118: Improved error handling for help flags.

The change to use errors.Is(err, flag.ErrHelp) provides more robust detection of help flags compared to the previous implementation.


135-145: Global FlagSet restoration mechanism has concurrency risks.

The Restore() and Override() methods modify the global flag.CommandLine, which can cause unexpected state changes if multiple parsers are active concurrently.

If concurrent parser instances are possible in your application, consider documenting usage limitations or implementing a concurrency-safe approach. This is especially important for libraries that may be used in concurrent contexts.

#!/bin/bash
# Check if there are any instances where multiple parser instances could be created concurrently
rg -A 3 -B 3 "New\(" --glob "**/*.go" | grep -v "test" | grep -E "go |goroutine|concurrently"
Makefile (6)

167-167: Added math library to HDF5 linker flags.

Addition of the -lm flag to HDF5_LDFLAGS ensures that mathematical functions are properly linked when building with HDF5, which is necessary for certain numerical operations.


169-169: Simplified test linker flags with CGO_LDFLAGS.

The change to use $(CGO_LDFLAGS) instead of individual flag variables simplifies maintenance and ensures consistency between build and test environments.


355-356: Added new E2E testing configuration variables.

The addition of E2E_CONFIG and E2E_ADDR variables supports the new end-to-end testing framework by providing default configuration file path and network address.


470-476: Improved .gitfiles initialization and update.

The updated files target implements a more robust approach to handling the .gitfiles file:

  1. Creates it with empty lines if it doesn't exist
  2. Preserves the first 15 lines when updating
  3. Appends the latest git-tracked files

This ensures that important header information is maintained across updates.


554-562: Streamlined Go code formatting with parallel processing.

The improved format/go target enhances efficiency by:

  1. Using .gitfiles to find Go files
  2. Processing files in parallel using xargs -P$(CORES)
  3. Applying multiple formatting tools in sequence

This approach speeds up formatting operations, particularly in large codebases.


573-581: Consistent formatting approach for test files.

The test file formatting follows the same efficient parallel approach as the main code formatting, ensuring consistency across the codebase.

internal/sync/errgroup/group.go (7)

17-18: Improved package documentation.

The updated package documentation clearly explains the purpose and behavior of the errgroup package, helping users understand its relationship to sync/errgroup.


31-41: Enhanced method documentation for Group interface.

The improved method documentation clearly explains the behavior of each Group method, making the API more intuitive for users.


121-134: Performance optimization for serial execution.

The optimization for limit <= 1 avoids unnecessary semaphore usage for serial execution:

  1. When limit is set to 1 or less, semaphore is set to nil
  2. For larger limits, semaphore is properly initialized or resized
  3. The limit value is stored atomically for thread-safe access

This change improves performance for cases where concurrency isn't needed.


141-164: Efficient function execution strategy with exec and run methods.

The new exec and run methods provide a clean separation of concerns:

  1. exec handles synchronous execution with proper error handling
  2. run handles asynchronous execution with proper goroutine management
  3. Both methods share consistent error handling logic

This refactoring improves code organization and maintenance.


174-177: Inline execution optimization for limit=1.

The Go method now intelligently chooses between inline execution and goroutine creation based on the limit:

  1. For limit=1, functions execute synchronously with lower overhead
  2. For larger limits, it uses goroutines with semaphore-based concurrency control

This optimization reduces goroutine creation overhead for serial execution.


200-203: Consistent execution strategy in TryGo.

The TryGo method implements the same intelligent execution strategy as Go, providing consistent behavior between the two methods.


261-267: Added convenient package-level Wait function.

The addition of a package-level Wait function simplifies usage of the global errgroup instance, ensuring proper initialization if needed.

internal/iter/iter.go (2)

52-153: Improve test coverage

Static analysis indicates that many lines in this file (e.g., 52-67, 72-77, 81-87, 89-91, etc.) are not covered by tests. Consider adding thorough unit tests to validate behavior such as:

  • NewCycle handling of nil or empty arrays.
  • Proper iteration termination when the context is canceled.
  • modFunc usage within each iteration.

Would you like a test suite template for starting coverage on these methods?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 52-67: internal/iter/iter.go#L52-L67
Added lines #L52 - L67 were not covered by tests


[warning] 72-77: internal/iter/iter.go#L72-L77
Added lines #L72 - L77 were not covered by tests


[warning] 81-87: internal/iter/iter.go#L81-L87
Added lines #L81 - L87 were not covered by tests


[warning] 89-91: internal/iter/iter.go#L89-L91
Added lines #L89 - L91 were not covered by tests


[warning] 96-97: internal/iter/iter.go#L96-L97
Added lines #L96 - L97 were not covered by tests


[warning] 101-107: internal/iter/iter.go#L101-L107
Added lines #L101 - L107 were not covered by tests


[warning] 109-111: internal/iter/iter.go#L109-L111
Added lines #L109 - L111 were not covered by tests


[warning] 117-123: internal/iter/iter.go#L117-L123
Added lines #L117 - L123 were not covered by tests


[warning] 125-127: internal/iter/iter.go#L125-L127
Added lines #L125 - L127 were not covered by tests


[warning] 132-137: internal/iter/iter.go#L132-L137
Added lines #L132 - L137 were not covered by tests


[warning] 139-141: internal/iter/iter.go#L139-L141
Added lines #L139 - L141 were not covered by tests


[warning] 145-146: internal/iter/iter.go#L145-L146
Added lines #L145 - L146 were not covered by tests


[warning] 150-151: internal/iter/iter.go#L150-L151
Added lines #L150 - L151 were not covered by tests


20-23:

❓ Verification inconclusive

Resolve potential circular import

Importing "iter" inside the iter package can lead to confusion or a circular dependency if it refers to this same package. Consider removing it or using a different alias (e.g., iterpkg) if referencing an external library, to avoid inadvertently creating a recursive import.

Please confirm the intent of this import by searching the codebase for its definition:


🏁 Script executed:

#!/bin/bash
# Description: Check all references to "iter" to confirm it’s an external package or a different internal package.

ast-grep --pattern $'import "iter"'

Length of output: 36


Potential Circular Dependency – Manual Verification Needed

The automated search via the provided script did not yield clear results, so it remains ambiguous whether the import of "iter" in internal/iter/iter.go refers to the same package (which would cause a circular import) or to a different one. Please verify manually that:

  • The file internal/iter/iter.go declares package iter.
  • The import "iter" isn’t mistakenly re-importing the same package.
  • If it is intended to reference an external or separate internal package, consider renaming the import (e.g., using an alias like iterpkg) to improve clarity and avoid circular dependency issues.

Once confirmed, adjust the import accordingly.

.gitfiles (4)

126-126: Validate new Rust test workflow

The newly added .github/workflows/unit-test-rust.yaml file can help ensure coverage for Rust code. Verify that:

  1. Cargo is properly installed.
  2. Tests run under a stable or pinned Rust version.
  3. Any additional test stages (linting, coverage, etc.) are included as needed.

Would you like to verify that the workflow is triggered for PRs by searching the YAML for “on: [pull_request]” or “on: [push]”?


161-177: Docs additions look good

The newly added .yaml and Markdown files under apis/docs/v1/ and apis/docs/buf.gen.* appear consistent with the existing doc structure. No syntax issues or broken references are evident at a glance.


2034-2053: New E2E assets

Additional E2E test files in tests/v2/e2e/ (e.g., rollout.yaml, unary_crud.yaml, etc.) appear aligned with the refactoring goals. Please ensure these are properly invoked in your E2E workflow to maintain full coverage of the new config-based approach.


2064-2064:

❓ Verification inconclusive

Confirm updated K3D version

Line 2064 indicates a K3D version update. Be sure to confirm it’s compatible with your local cluster environment, Helm charts, and any new E2E tests reliant on K3D.

Try searching for references to K3D across your GitHub Actions and scripts to ensure alignment:


🏁 Script executed:

#!/bin/bash
ast-grep --pattern $'K3D'

Length of output: 24


Action Required: Verify K3D References and Compatibility

The update at line 2064 in .gitfiles (showing versions/K3D_VERSION) indicates a K3D version change. However, the initial automated search with ast-grep for “K3D” produced no output. This inconclusive result suggests that the references might exist elsewhere (for example, in GitHub Actions configurations or other scripts), or that they might be missing entirely.

  • Next Steps:
    • Manually verify that all GitHub Actions workflows (e.g. in .github/workflows), Helm charts, and any E2E test scripts referencing K3D are aligned with the new version.
    • Optionally, run an additional search using a command like:
      rg -i "K3D" .
      to double-check for any references that might not have been caught by ast-grep.

Please ensure that the updated K3D version is compatible with your local cluster environment and related configurations.

tests/v2/e2e/kubernetes/status.go (3)

92-113: Guard against indefinite waits in WaitForStatus.
This function waits indefinitely at 5-second intervals until the status matches or the context is canceled. A fallback timeout or user-configurable polling interval may help prevent accidental hangs if context usage is not well-defined.


185-246: Check for DeploymentReplicaFailure condition.
Currently, only DeploymentProgressing and DeploymentAvailable conditions are evaluated. Including a check for DeploymentReplicaFailure can improve visibility and help detect issues sooner.


320-326: Refine DaemonSet condition checks.
The placeholder appsv1.DaemonSetConditionType("") may overlook real condition types (e.g., DaemonSetReplicaFailure). Enumerating known conditions helps ensure more reliable detection of issues.

tests/v2/e2e/config/config.go (1)

185-193: Improve metadata validation logic.
There are no checks for length, allowed characters, or trimming of white space, allowing potential misuse or unexpected values. Adding stricter validation can reduce errors and malicious inputs.

tests/v2/e2e/crud/index_test.go (1)

46-61: Verify the usage of empty requests.
All index operations except OpFlush pass an empty payload (new(payload.Empty)), which may not exercise certain code paths if the underlying RPC expects additional input. Confirm that these calls are sufficient for the intended tests.

Would you like to run a script searching for possible references to non-empty payload usage to confirm we don’t miss any required fields?

internal/test/data/vector/noise/option.go (2)

45-49: Prevent zero table division factor to avoid runtime errors.

If f is accidentally set to 0 when calling WithTableDivisionFactor, this will cause a division-by-zero in noise.go. Please replicate the minimum-value safeguard used in the past.

 func WithTableDivisionFactor(f uint64) Option {
   return func(ng *noiseGenerator) {
+    if f == 0 {
+      f = 1
+    }
     ng.noiseTableDivisionFactor = f
   }
 }

52-56: Prevent zero minimum table size from causing invalid shift operations.

Likewise, if s is 0, computation of the noise table size in noise.go will fail. Enforce a minimum value of 1.

 func WithMinTableSize(s uint64) Option {
   return func(ng *noiseGenerator) {
+    if s == 0 {
+      s = 1
+    }
     ng.minNoiseTableSize = s
   }
 }
internal/test/data/vector/noise/noise_test.go (1)

5-95: Fill out the commented test cases in TestNew.

This entire function is commented out, resulting in zero coverage for constructor logic. Un-comment and add tight test cases to validate option handling and noise table initialization.

internal/test/data/vector/noise/noise.go (3)

79-106: Guard against division by zero if all vectors are empty.

If every vector is skipped, count remains zero, causing a division-by-zero at line 105. Replicate the safeguard from past comments.

 if count == 0 {
-  return float32(totalStd/float64(count)) * ng.noiseLevelFactor
+  return 0.01 // or any small default
 }

108-123: Handle zero-valued noiseTableDivisionFactor before using it.

Dividing by ng.noiseTableDivisionFactor at line 117 will panic if it is 0. Ensure it’s checked or replaced with a safe default.


180-181: Confirm Go 1.21+ for slices.Clone.

The slices.Clone function is only available from Go 1.21 onward. Update the build environment to avoid compilation errors on older Go versions.

tests/v2/e2e/hdf5/hdf5.go (1)

110-114: Validate dataset dimensionality.
Accessing dims[1] may fail for non-2D data. This concern was raised before; please implement dimension checks to avoid unexpected behavior and ensure the dataset has exactly 2 dimensions.

tests/v2/e2e/crud/strategy_test.go (2)

161-161: Consider failing the test immediately to halt further operations.

When executeWithTimings fails, the error is logged with tt.Errorf, allowing the test to continue. If your intent is to stop the entire test on the first failure, you might prefer tt.Fatalf. Otherwise, retaining tt.Errorf is correct if you want to continue subsequent operations for better debugging.

Do you intend to continue testing operations after the first failure occurs within this strategy? If not, switching to tt.Fatalf may simplify error handling.


142-147: Concurrency limit usage looks good.

Using eg.SetLimit(int(st.Concurrency)) ensures that operations execute up to the specified concurrency limit. This is a clean approach for e2e tests, balancing parallelism yet preventing resource overload.

tests/v2/e2e/kubernetes/portforward/portforward.go (1)

311-312: Clarify intended health status after port-forward termination.

pf.healthy.Store(true) is set when the port-forwarding is established, then reverted via defer pf.healthy.Store(false). This indicates that upon returning from portForwardToService, the forwarder is no longer marked healthy. Confirm that this behavior is desired if you expect a persistent healthy state until the daemon is fully stopped.

tests/v2/e2e/crud/modification_test.go (1)

131-135: Error check for nil plan is appropriate.

Using t.Fatal("modification plan is nil") ensures the test halts if crucial configuration is missing, preventing potential nil-pointer dereferences in subsequent logic.

tests/v2/e2e/kubernetes/resources.go (2)

562-608: Avoid error overshadowing by wrapping errors with additional context.

This file’s SetPodAnnotations method returns the last encountered error, which can obscure or replace earlier errors. Wrap prior errors or log them so that debugging is easier if multiple failures occur in sequence. For instance:

- return obj, err
+ return obj, fmt.Errorf("failed to retrieve object or set pod annotation: %w", err)

Doing so ensures that the final return value preserves awareness of all encountered issues.


307-314: Ensure the interface is consistently set before accessing it.

In baseClient, each method checks for b == nil || b.Interface == nil before proceeding, returning ErrKubernetesClientNotFound. While this protects against misuse, confirm that the E2E flow always sets the interface via SetInterface() or a constructor. If concurrency is expected here, ensure that no race condition occurs between SetInterface() calls and method invocations.

Comment on lines +102 to +114
cnt++
res, err := stream.Recv()
if err != nil {
if err == io.EOF {
return
}
if plan.ExpectedStatusCodes != nil && plan.ExpectedStatusCodes.Equals(codes.ToString(res.GetStatus().GetCode())) {
t.Logf("expected error: %v", err)
} else {
t.Errorf("unexpected error: %v", err)
}

break
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Clarify handling of partial results on streaming errors.
When an error occurs mid-stream, the code breaks out of the loop, discarding subsequent vectors. If partial retrieval is acceptable, consider continuing after logging errors; otherwise, indicate that incomplete data is invalid.

@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch from f316d56 to d68d37c Compare March 14, 2025 17:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 3

♻️ Duplicate comments (10)
internal/servers/server/option_test.go (1)

3727-4066: ⚠️ Potential issue

Implement the commented test functions for comprehensive gRPC options coverage

These four commented test functions are required for testing key gRPC options that will be used in the V2 E2E testing framework. Currently, they're just template implementations with TODO markers, but they should be uncommented and properly implemented to ensure coverage of these important server options.

To implement these test functions properly, follow the pattern used in other option tests in this file:

  1. Uncomment each function
  2. Replace the template structure with actual test cases
  3. Implement at least a success case and an invalid parameter case for each

For example, for TestWithGRPCMaxConcurrentStreams:

-// func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
+func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
     type args struct {
         size uint32
     }
-    type want struct {
-        want Option
-    }
     type test struct {
         name       string
         args       args
-        want       want
-        checkFunc  func(want, Option) error
-        beforeFunc func(*testing.T, args)
-        afterFunc  func(*testing.T, args)
+        checkFunc  func(opt Option) error
     }
-    defaultCheckFunc := func(w want, got Option) error {
-        if !reflect.DeepEqual(got, w.want) {
-            return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
-        }
-        return nil
-    }
     tests := []test{
-        // TODO test cases
+        {
+            name: "set success when size is more than 0",
+            args: args{
+                size: 100,
+            },
+            checkFunc: func(opt Option) error {
+                got := new(server)
+                opt(got)
+                if len(got.grpc.opts) != 1 {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
+        {
+            name: "not set when size is 0",
+            args: args{
+                size: 0,
+            },
+            checkFunc: func(opt Option) error {
+                gopts := []grpc.ServerOption{}
+                got := new(server)
+                got.grpc.opts = gopts
+                opt(got)
+                if !reflect.DeepEqual(got.grpc.opts, gopts) {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
     }

     for _, tc := range tests {
         test := tc
         t.Run(test.name, func(tt *testing.T) {
-            tt.Parallel()
-            defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
-            if test.beforeFunc != nil {
-                test.beforeFunc(tt, test.args)
-            }
-            if test.afterFunc != nil {
-                defer test.afterFunc(tt, test.args)
-            }
-            checkFunc := test.checkFunc
-            if test.checkFunc == nil {
-                checkFunc = defaultCheckFunc
-            }
-
-            got := WithGRPCMaxConcurrentStreams(test.args.size)
-            if err := checkFunc(test.want, got); err != nil {
+            got := WithGRPCMaxConcurrentStreams(test.args.size)
+            if err := test.checkFunc(got); err != nil {
                 tt.Errorf("error = %v", err)
             }
         })
     }
-}
+}
tests/v2/e2e/assets/unary_crud.yaml (1)

192-203: ⚠️ Potential issue

Fix duplicate key in YAML mapping.

There's a duplication of the "name" key in this operation mapping. The operation already has a name defined at line 192 (name: Inset Operation), but then has another name defined at line 203 (name: Insert -> IndexInfo).

YAML doesn't allow duplicate keys in the same mapping, which can lead to unpredictable behavior.

Apply this fix:

  - concurrency: 1
    name: Initial Insert and Wait
    operations:
      - name: Inset Operation
        executions:
          - name: Insert
            type: insert
            mode: unary
            parallelism: 10
            num: 30000
            wait: 2m
          - mode: unary
            name: IndexInfo
            type: index_info
-        name: Insert -> IndexInfo
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 203-203: duplication of key "name" in mapping

(key-duplicates)

pkg/tools/benchmark/job/service/option_test.go (1)

1633-1692: 🛠️ Refactor suggestion

Implement actual test cases for TestWithMetadata.

The test function for WithMetadata has a good structure, but it only contains TODO comments and no actual test cases. This issue was previously identified in a review, with specific suggestions provided.

Consider implementing at least these test cases as suggested previously:

  1. Test with nil map
  2. Test with empty map
  3. Test with populated map
  4. Test with map containing special characters

Here's an implementation example:

tests := []test{
-    // TODO test cases
-    /*
-       {
-           name: "test_case_1",
-           args: args {
-               m:nil,
-           },
-           want: want{},
-           checkFunc: defaultCheckFunc,
-           beforeFunc: func(t *testing.T, args args) {
-               t.Helper()
-           },
-           afterFunc: func(t *testing.T, args args) {
-               t.Helper()
-           },
-       },
-    */
+    {
+        name: "nil map",
+        args: args{
+            m: nil,
+        },
+        want: want{
+            want: WithMetadata(nil),
+        },
+        checkFunc: defaultCheckFunc,
+    },
+    {
+        name: "empty map",
+        args: args{
+            m: map[string]string{},
+        },
+        want: want{
+            want: WithMetadata(map[string]string{}),
+        },
+        checkFunc: defaultCheckFunc,
+    },
+    {
+        name: "populated map",
+        args: args{
+            m: map[string]string{"key1": "value1", "key2": "value2"},
+        },
+        want: want{
+            want: WithMetadata(map[string]string{"key1": "value1", "key2": "value2"}),
+        },
+        checkFunc: defaultCheckFunc,
+    },
+    {
+        name: "map with special characters",
+        args: args{
+            m: map[string]string{"key-with-dash": "value:with:colons", "key_with_underscore": "value with spaces"},
+        },
+        want: want{
+            want: WithMetadata(map[string]string{"key-with-dash": "value:with:colons", "key_with_underscore": "value with spaces"}),
+        },
+        checkFunc: defaultCheckFunc,
+    },
internal/timeutil/time_test.go (2)

185-263: 🛠️ Refactor suggestion

Implement test cases for TestDurationString_Duration.

The test function for DurationString.Duration() has good structure but lacks actual test cases. This issue was previously identified in a review.

Consider implementing test cases that cover:

  • Valid duration strings with various time units (ns, ms, s, m, h)
  • Empty strings
  • Invalid formats
  • Edge cases (extremely large or small durations)

Here's an implementation example:

tests := []test{
-    // TODO test cases
-    /*
-       {
-           name: "test_case_1",
-           want: want{},
-           checkFunc: defaultCheckFunc,
-           beforeFunc: func(t *testing.T,) {
-               t.Helper()
-           },
-           afterFunc: func(t *testing.T,) {
-               t.Helper()
-           },
-       },
-    */
+    {
+        name: "valid duration string - seconds",
+        d: DurationString("5s"),
+        want: want{
+            want: 5 * time.Second,
+            err: nil,
+        },
+    },
+    {
+        name: "valid duration string - minutes",
+        d: DurationString("3m"),
+        want: want{
+            want: 3 * time.Minute,
+            err: nil,
+        },
+    },
+    {
+        name: "valid duration string - hours",
+        d: DurationString("2h"),
+        want: want{
+            want: 2 * time.Hour,
+            err: nil,
+        },
+    },
+    {
+        name: "empty string",
+        d: DurationString(""),
+        want: want{
+            want: 0,
+            err: nil,
+        },
+    },
+    {
+        name: "invalid format",
+        d: DurationString("invalid"),
+        want: want{
+            want: 0,
+            err: errors.New("time: invalid duration \"invalid\""),
+        },
+    },

265-349: 🛠️ Refactor suggestion

Implement test cases for TestDurationString_DurationWithDefault.

The test function for DurationString.DurationWithDefault() has good structure but lacks actual test cases. This issue was previously identified in a review.

Consider implementing test cases that verify:

  • Valid duration strings correctly parse and ignore the default
  • Empty strings return the default value
  • Invalid formats return the default value
  • Various default values are properly handled

Here's an implementation example:

tests := []test{
-    // TODO test cases
-    /*
-       {
-           name: "test_case_1",
-           args: args {
-               def:nil,
-           },
-           want: want{},
-           checkFunc: defaultCheckFunc,
-           beforeFunc: func(t *testing.T, args args) {
-               t.Helper()
-           },
-           afterFunc: func(t *testing.T, args args) {
-               t.Helper()
-           },
-       },
-    */
+    {
+        name: "valid duration string overrides default",
+        d: DurationString("10s"),
+        args: args{
+            def: 5 * time.Minute,
+        },
+        want: want{
+            want: 10 * time.Second,
+        },
+    },
+    {
+        name: "empty string returns default",
+        d: DurationString(""),
+        args: args{
+            def: 30 * time.Second,
+        },
+        want: want{
+            want: 30 * time.Second,
+        },
+    },
+    {
+        name: "invalid format returns default",
+        d: DurationString("invalid"),
+        args: args{
+            def: 1 * time.Hour,
+        },
+        want: want{
+            want: 1 * time.Hour,
+        },
+    },
+    {
+        name: "zero default with valid string",
+        d: DurationString("45s"),
+        args: args{
+            def: 0,
+        },
+        want: want{
+            want: 45 * time.Second,
+        },
+    },
internal/net/quic/listener_test.go (1)

1-196: 🛠️ Refactor suggestion

Implement or remove QUIC listener test skeletons.

This file contains well-structured test skeletons for QUIC listener functionality, but they're entirely commented out with a "NOT IMPLEMENTED BELOW" marker. While the structure follows good testing practices with proper setup for test cases, check functions, and leak detection, they lack actual implementation.

Consider either:

  1. Implementing at least basic test cases to provide real test coverage, or
  2. Removing these commented-out skeletons until they're ready to be implemented

For TestListen, you could implement test cases for:

  • Successful listening on a valid address
  • Error handling for invalid addresses
  • Context cancellation
  • TLS configuration options

For TestListener_Accept, you could implement test cases for:

  • Successful connection acceptance
  • Error handling when the listener is closed
  • Context cancellation during acceptance

Commented-out code in the codebase can lead to confusion and maintenance challenges over time.

tests/v2/e2e/crud/strategy_test.go (3)

152-155: 🛠️ Refactor suggestion

Surface errors within the error group.

The error group is used to manage concurrent operations, but errors from processOperation are not propagated since the anonymous function always returns nil.

Consider refactoring processOperation to return an error if a failure is encountered:

-eg.Go(func() error {
-    r.processOperation(ttt, egctx, i, op)
-    return nil
-})
+eg.Go(func() error {
+    return r.processOperation(ttt, egctx, i, op)
+})

And update the signature and implementation of processOperation to return errors.


160-162: 🛠️ Refactor suggestion

Use tt.Fatal when executeWithTimings fails to safeguard subsequent logic.

When executeWithTimings returns an error, the test continues with tt.Errorf, which may lead to additional errors and confusing test output.

Apply this change to fail fast when operations within the strategy fail:

if err != nil {
-   tt.Errorf("failed to process operations: %v", err)
+   tt.Fatalf("failed to process operations: %v", err)
}

175-184: 🛠️ Refactor suggestion

Return errors from processOperation.

Currently, processOperation swallows errors by returning nil unconditionally from executeWithTimings. This prevents the error group from propagating failures and stopping execution early.

Modify this function to return errors from executeWithTimings:

-func (r *runner) processOperation(
-   t *testing.T, ctx context.Context, idx int, op *config.Operation,
-) {
+func (r *runner) processOperation(
+   t *testing.T, ctx context.Context, idx int, op *config.Operation,
+) error {
    t.Helper()
    if r == nil || op == nil {
-       return
+       return nil
    }

+   var opErr error
    t.Run(fmt.Sprintf("#%d: operation=%s", idx, op.Name), func(tt *testing.T) {
        if err := executeWithTimings(tt, ctx, op, op.Name, "operation", func(ttt *testing.T, ctx context.Context) error {
            ttt.Helper()
            for i, e := range op.Executions {
                r.processExecution(ttt, ctx, i, e)
            }
            return nil
        }); err != nil {
            tt.Errorf("failed to process operation: %v", err)
+           opErr = err
        }
    })
+   return opErr
}
tests/v2/e2e/crud/search_test.go (1)

39-59: ⚠️ Potential issue

Prevent potential division by zero in recall().
If neighbors is empty (length zero), then float64(count) / float64(len(neighbors)) will produce a NaN or Inf. Consider returning 0 or logging a warning when neighbors is an empty slice.

Apply this diff to handle empty neighbors safely:

 func recall(t *testing.T, resultIDs []string, neighbors []int) float64 {
     t.Helper()
     ns := make(map[string]struct{})
     for _, n := range neighbors {
         ns[strconv.Itoa(n)] = struct{}{}
     }
     var count int
     for _, r := range resultIDs {
         if _, ok := ns[r]; ok {
             count++
         }
     }
-    return float64(count) / float64(len(neighbors))
+    ln := len(neighbors)
+    if ln == 0 {
+        t.Log("neighbors is empty; returning 0 recall")
+        return 0
+    }
+    return float64(count) / float64(ln)
 }
🧹 Nitpick comments (24)
pkg/index/job/deletion/usecase/deletion_test.go (1)

1-672: Consider using mock implementations for dependencies.

For effective testing of the runner's lifecycle methods, implement mock versions of the dependencies (server, indexer, observability) that can be configured to return specific errors or behaviors for testing different scenarios.

// Example mock implementation
type mockServer struct {
    startFunc func(context.Context) (<-chan error, error)
    stopFunc  func(context.Context) error
}

func (m *mockServer) Start(ctx context.Context) (<-chan error, error) {
    if m.startFunc != nil {
        return m.startFunc(ctx)
    }
    return nil, nil
}

func (m *mockServer) Stop(ctx context.Context) error {
    if m.stopFunc != nil {
        return m.stopFunc(ctx)
    }
    return nil
}
pkg/index/job/deletion/service/options_test.go (1)

3-4: Consider removing this file from PR if it's not ready

The comment "NOT IMPLEMENTED BELOW" suggests this file is intentionally incomplete. Since this PR focuses on introducing a new V2 E2E testing framework, consider removing this file from the PR if it's not part of the essential changes needed for the framework to function properly. Alternatively, complete the implementation before merging.

tests/v2/e2e/assets/unary_crud.yaml (1)

192-192: Fix typo in operation name.

The operation name contains a typo: "Inset" instead of "Insert".

- name: Inset Operation
+ name: Insert Operation
tests/v2/e2e/kubernetes/client.go (1)

122-124: Rename method for clarity.

The method GetRESRConfig() appears to have a typographical inconsistency. Consider renaming it to GetRESTConfig() for better readability and consistency.

-func (c *client) GetRESRConfig() *rest.Config {
+func (c *client) GetRESTConfig() *rest.Config {
Makefile (1)

355-356: Consider documenting new E2E vars.

E2E_CONFIG and E2E_ADDR are helpful additions for end-to-end testing configuration. Consider adding comments or documentation describing how these are used in e2e workflows.

tests/v2/e2e/hdf5/hdf5.go (2)

19-36: Add optional struct-level comment.
The Dataset struct is clear; consider adding a top-level doc comment describing the fields (Train, Test, Neighbors) to help future maintainers understand their relationships and usage.


69-98: Wrap errors with more context.
When returning errors from HDF5ToDataset, consider wrapping them to indicate which part of dataset loading failed (train/test/neighbors) for easier debugging.

 if err != nil {
-    return nil, err
+    return nil, fmt.Errorf("failed to load 'train' dataset: %w", err)
 }
tests/v2/e2e/config/enums.go (1)

23-52: Consider adding doc comments to constants.
Enumerating OperationType values is clear, but doc comments can help new contributors understand usage contexts (e.g., OpRemoveByTimestamp).

tests/v2/e2e/config/config.go (2)

336-340: Log default fallback for invalid timeout.
When an invalid duration is parsed, the code silently defaults to 3s without notifying the user. Logging a warning helps clarify why a different timeout was used.


610-615: Check for out-of-range ports in Port.Bind().
Currently, if parsing fails, it silently defaults to 0. Returning an error or warning users might avert misconfiguration.

tests/v2/e2e/kubernetes/resources.go (1)

316-375: Consider using a write lock when mutating resources.

These methods (Create, Update, UpdateStatus, Delete, DeleteCollection) acquire only a read lock via RLock(), yet they perform updates (or calls that lead to updates) on Kubernetes resources. Although each resource is returned by value, it may be safer to use a write lock or confirm that the underlying interface and data structures are concurrency-safe for both reading and writing.

tests/v2/e2e/kubernetes/portforward/portforward.go (2)

157-159: Expand the error channel buffer or handle send failures.

The error channel is buffered with capacity 2 but is used by multiple goroutines, potentially leading to blocked sends if errors occur rapidly. Consider increasing the buffer size or adding a non-blocking send approach to avoid deadlocks in error-reporting scenarios.


288-293: Preserve the original error context when no pods are available.

When pf.getNextPod() fails, the returned error is replaced by errors.ErrNoAvailablePods. Retaining the original error (e.g., by wrapping or joining it) can facilitate debugging and provide more granular context about why no pods were found.

pkg/tools/cli/loadtest/service/loader.go (2)

207-211: Add coverage for stream operations [StreamInsert].

The lines invoking grpc.BidirectionalStreamClient with l.concurrency are uncovered by tests. Consider creating a specialized test that exercises the StreamInsert case to validate concurrency handling and ensure error handling is robust when streaming data.

Would you like help generating a sample test covering concurrency for this functionality?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 207-207: pkg/tools/cli/loadtest/service/loader.go#L207
Added line #L207 was not covered by tests


212-216: Add coverage for stream operations [StreamSearch].

Similar to the StreamInsert case, these lines are also uncovered. Ensure correct parameter usage for l.concurrency in live streaming contexts.

Let me know if you’d like an example test to confirm concurrency behavior, especially around error scenarios.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 212-212: pkg/tools/cli/loadtest/service/loader.go#L212
Added line #L212 was not covered by tests

tests/v2/e2e/crud/index_test.go (2)

32-38: Clarify index callback behavior.

The indexCallBack function always returns true regardless of whether an error occurs. If you desire different behavior upon an error (e.g., stopping further processing), consider returning false when err != nil.

func indexCallBack[R proto.Message](res R, err error) bool {
  if err != nil {
-    return true
+    return false
  }
  log.Infof("response: %v", res)
  return true
}

40-62: Leverage table-driven testing for index operations.

The switch statement effectively dispatches multiple index operations (e.g., OpIndexInfo, OpIndexDetail). As the number of operations grows, consider using a table-driven approach to maintain clarity and scalability in test scenarios.

pkg/tools/cli/loadtest/service/search_test.go (1)

18-374: Enable or remove commented-out test code.

All test logic in this file is commented out, leading to zero coverage. Consider enabling the tests or removing them if they are obsolete.

I can help refactor and enable these tests if they are still relevant. Let me know if you’d like me to propose a working version.

tests/v2/e2e/crud/grpc_test.go (1)

112-150: Complete the bulk request logic.

The function exec := func(batch []Q) {} is declared but never used to finalize or transform the batched requests before calling single. Make sure to implement the logic for the bulk request if you intend to do any batch-specific pre-processing.

Do you want me to generate a snippet that handles batch transformations or remove the unused function?

tests/v2/e2e/crud/strategy_test.go (2)

187-256: Enhance error propagation in processExecution.

Similar to other methods, processExecution doesn't return errors that could be useful for failing tests early when issues occur.

Consider modifying the method to return errors from executeWithTimings and update the calling code in processOperation:

-func (r *runner) processExecution(t *testing.T, ctx context.Context, idx int, e *config.Execution) {
+func (r *runner) processExecution(t *testing.T, ctx context.Context, idx int, e *config.Execution) error {
    t.Helper()
    if r == nil || e == nil {
-       return
+       return nil
    }

+   var execErr error
    t.Run(fmt.Sprintf("#%d: execution=%s type=%s mode=%s", idx, e.Name, e.Type, e.Mode), func(tt *testing.T) {
        if err := executeWithTimings(tt, ctx, e, e.Name, "execution", func(ttt *testing.T, ctx context.Context) error {
            // ... existing code ...
            return nil
        }); err != nil {
            tt.Errorf("failed to process execution: %v", err)
+           execErr = err
        }
    })
+   return execErr
}

Then update the code in processOperation to check for and return this error.


243-246: Implement TODOs for Kubernetes and Client operations.

The code has placeholder TODO comments for implementing Kubernetes and gRPC client operations.

Would you like me to help implement these operations or create issues to track these TODOs? These operations would be important for comprehensive E2E testing, especially for testing resilience and recovery scenarios.

tests/v2/e2e/crud/search_test.go (3)

80-114: Log parsing errors when reading search query timeout.
Currently, the fallback silently uses 1 second if parsing fails. It might be helpful to log a warning when the timeout string cannot be parsed.

-   if query.Timeout != "" {
-       timeout, err := query.Timeout.Duration()
-       if err == nil {
-           return timeout.Nanoseconds()
-       }
-   }
+   if query.Timeout != "" {
+       timeout, err := query.Timeout.Duration()
+       if err != nil {
+           t.Logf("failed to parse query timeout '%s': %v, falling back to 1s", query.Timeout, err)
+       } else {
+           return timeout.Nanoseconds()
+       }
+   }

267-330: Process leftover requests under the same concurrency strategy.
The final batch is executed synchronously, which might slow large leftover batches if concurrency is otherwise used. Consider wrapping exec(reqs) in a goroutine to keep consistency with other batches.

-   exec(reqs)
+   leftoverBatch := slices.Clone(reqs)
+   reqs = reqs[:0]
+   eg.Go(func() error {
+       exec(leftoverBatch)
+       return nil
+   })

351-391: Validate request ID conversion in streamSearch.
If strconv.Atoi fails, idx, _ := strconv.Atoi(id) defaults to 0, risking collisions if multiple parse errors occur. Consider logging or handling parse errors.

-   idx, _ := strconv.Atoi(id)
+   parsedIdx, err := strconv.Atoi(id)
+   if err != nil {
+       t.Logf("failed to parse request id %s: %v", id, err)
+       // optionally decide how to handle collisions here
+   } else {
+       idx = parsedIdx
+   }
🛑 Comments failed to post (3)
tests/v2/e2e/kubernetes/resources.go (1)

562-608: 🛠️ Refactor suggestion

Use partial patch operations to avoid overwriting other fields.

Inside SetPodAnnotations, you retrieve the entire object, update the template, then call Update. This approach can overwrite unrelated changes if multiple updates occur concurrently. Consider using a patch-based approach (e.g., JSON/strategic merge) to limit updates to the annotation fields only.

tests/v2/e2e/crud/grpc_test.go (2)

67-85: 🛠️ Refactor suggestion

Validate callback behavior in single-call flows.

After calling handleGRPCCallError, additional callbacks in the loop might still execute even if an error was encountered. If a fatal error occurs, ensure the test reflects that outcome or consider returning early to avoid subsequent callback calls with invalid data.


87-110: ⚠️ Potential issue

Confirm error handling in concurrent unary calls.

Each request is performed in a goroutine, but errors from single() aren’t propagated back to fail the test if needed. Consider returning these errors from the goroutines and aggregating them with eg.Wait() to ensure a clear test failure signal upon errors.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🔭 Outside diff range comments (2)
internal/sync/errgroup/group_test.go (1)

946-1288: ⚠️ Potential issue

Both Test_group_exec and Test_group_TryGo are commented out

The changes have replaced the original Test_group_TryGo with a new Test_group_exec test function, but both remain commented out. This means neither function is actively being tested, despite previous review comments requesting resolution of this issue.

If both TryGo and exec methods are meant to coexist in the codebase:

  • Uncomment and implement both test functions to ensure complete test coverage
  • Document the differences between these methods and their intended use cases

If TryGo is being deprecated in favor of exec:

  • Uncomment and implement only the Test_group_exec function
  • Add documentation about the deprecation of TryGo
  • Consider removing the commented-out Test_group_TryGo entirely to reduce code clutter
pkg/tools/cli/loadtest/service/insert_test.go (1)

17-557: ⚠️ Potential issue

Update commented-out tests for type consistency

The changes updating function return types from func() any to func() *any and renaming dataProvider to sendDataProvider improve consistency across the codebase. However, these tests remain completely commented out.

Either implement these tests to validate the functionality or remove them from the codebase if they're not intended for immediate use. Maintaining commented-out code adds unnecessary maintenance burden.

If these tests are part of the new V2 E2E strategic testing framework, consider adding a clear comment at the top indicating their status and when they'll be implemented.

♻️ Duplicate comments (15)
pkg/tools/benchmark/job/service/option_test.go (1)

1654-1692: 🛠️ Refactor suggestion

Consider implementing actual test cases instead of TODO placeholders

The test function has been added but still contains only TODOs and commented-out template code without actual test cases to verify the WithMetadata functionality.

I recommend implementing at least these test cases as suggested in the previous review:

  1. Test with nil map
  2. Test with empty map
  3. Test with populated map
  4. Test with map containing special characters
 	tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       args: args {
-		           m:nil,
-		       },
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+			name: "nil map",
+			args: args{
+				m: nil,
+			},
+			want: want{
+				want: WithMetadata(nil),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "empty map",
+			args: args{
+				m: map[string]string{},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "populated map",
+			args: args{
+				m: map[string]string{"key1": "value1", "key2": "value2"},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{"key1": "value1", "key2": "value2"}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "map with special characters",
+			args: args{
+				m: map[string]string{"special!@#": "value$%^&*"},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{"special!@#": "value$%^&*"}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
pkg/index/job/deletion/service/deleter_test.go (5)

1-3: ⚠️ Potential issue

File requires implementation - all tests are commented out

The file is marked with "NOT IMPLEMENTED BELOW" and contains five well-structured but entirely commented-out test functions. To ensure proper test coverage, these tests need to be fully implemented.

This issue was previously flagged in a code review. The test structure is sound but needs actual implementation of test cases to be effective for testing the Deleter component.


116-153: ⚠️ Potential issue

Test_delDuplicateAddrs still lacks concrete test cases

While previous comments indicated this was addressed in commit c46fb80, the test cases for this function remain commented out and marked with TODO.

Implement test cases that verify:

  1. Empty array handling
  2. Arrays with no duplicates
  3. Arrays with duplicates
  4. Edge cases with multiple identical values

181-294: ⚠️ Potential issue

Test_index_StartClient needs mock implementations

This test function for the StartClient method requires implementation with proper mocks for the discoverer.Client interface.

Though previous comments indicated this was addressed in commit 54c5093, the test cases remain commented out here. When implementing, focus on:

  1. Using a mock client that returns predefined responses
  2. Testing error propagation from the client
  3. Testing successful channel creation
  4. Testing context cancellation handling

296-405: ⚠️ Potential issue

Test_index_Start requires implementation with context testing

The test structure for the Start method is defined but lacks actual test cases.

Implement test cases covering:

  1. Successful start operation
  2. Context cancellation handling
  3. Error propagation from downstream operations

407-519: ⚠️ Potential issue

Test_index_doDeleteIndex needs implementation with gRPC client mocks

This test requires proper implementation with mocks for the gRPC client functions.

Though previous comments indicated this was addressed in commit 54c5093, the test cases remain commented out. Focus on:

  1. Creating mock functions for successful and failing deletion operations
  2. Testing error handling across concurrent operations
  3. Testing different concurrency levels
  4. Verifying context cancellation handling
tests/v2/e2e/assets/unary_crud.yaml (1)

202-204: ⚠️ Potential issue

Eliminate duplicate YAML key.

Duplicating the "name" key at line 202 and line 204 may cause parsing errors. Rename or remove one of them to resolve the conflict.

Below is a suggested fix that removes the second key:

          - mode: unary
            name: IndexInfo
            type: index_info
-        name: Insert -> IndexInfo
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 204-204: duplication of key "name" in mapping

(key-duplicates)

tests/v2/e2e/crud/strategy_test.go (1)

60-61: 🛠️ Refactor suggestion

Use t.Fatalf for critical Kubernetes client errors.

After logging "failed to create kubernetes client", subsequent code attempts to use r.k8s if port forwarding is enabled. To avoid cascading issues, consider terminating the test immediately when the Kubernetes client fails to initialize.

- t.Errorf("failed to create kubernetes client: %v", err)
+ t.Fatalf("failed to create kubernetes client: %v", err)
tests/v2/e2e/crud/search_test.go (1)

77-78: ⚠️ Potential issue

Validate neighbors array length before slicing.

This code blindly slices neighbors[:len(topKIDs)], risking an out-of-range panic if len(neighbors) < len(topKIDs). This concern was raised in a prior review and still applies here.

-func calculateRecall(t *testing.T, neighbors []int, res *payload.Search_Response) float64 {
-    ...
-    return recall(t, topKIDs, neighbors[:len(topKIDs)])
+func calculateRecall(t *testing.T, neighbors []int, res *payload.Search_Response) float64 {
+    ...
+    minLen := len(neighbors)
+    if minLen > len(topKIDs) {
+        minLen = len(topKIDs)
+    }
+    return recall(t, topKIDs[:minLen], neighbors[:minLen])
 }
internal/net/grpc/metadata_test.go (1)

18-101: ⚠️ Potential issue

Implement actual test cases for NewMetadata function

This test function is well-structured with appropriate argument declarations, check functions, and parallel test execution. However, it remains commented out and contains only TODO placeholders rather than actual test cases. This pattern does not appear to be standard practice in the project.

Consider implementing concrete test cases for NewMetadata to improve test coverage, or add a clear inline comment explaining why this test remains commented out.

internal/params/params_test.go (2)

452-570: ⚠️ Potential issue

Implement test cases for parser.Restore() method

The test function is properly structured but remains commented out with TODO placeholders instead of actual test cases. Testing state restoration functionality is critical for ensuring correct behavior when parser state needs to be reset.

Consider implementing test cases covering:

  1. Basic restoration with default state
  2. Restoration after various modifications
  3. Edge cases with nil or invalid fields
  4. Verification that all fields are correctly restored

572-689: ⚠️ Potential issue

Implement test cases for parser.Override() method

This test function is properly structured but remains commented out with TODO placeholders instead of actual test cases. Testing the override functionality is essential for ensuring correct behavior when parser state needs to be modified.

Consider implementing test cases covering:

  1. Basic override with simple values
  2. Complex overrides with various field combinations
  3. Edge cases with nil or invalid fields
  4. Verification that all specified fields are correctly overridden
internal/info/info_test.go (1)

996-1094: ⚠️ Potential issue

Implement test cases for TestStackTrace_ShortString

The new test function for ShortString has a good structure but lacks actual test cases. As this appears to be testing a new method, verifying its functionality with various scenarios is important.

Consider adding test cases that:

  1. Test with various URL, FuncName, File, and Line combinations
  2. Test edge cases like empty fields
  3. Verify the correct formatting of the short string output
internal/params/option_test.go (1)

450-705: ⚠️ Potential issue

Implement or remove the commented-out test functions

These test functions (TestWithName, TestWithOverrideDefault, and TestWithArgumentFilters) are still commented out with "TODO test cases" placeholders. These look like they are intended to test new functionality being added to the codebase as part of the V2 E2E testing framework.

Either:

  1. Implement these test functions with actual test cases
  2. Remove the commented code if it's not ready for inclusion

Alternatively, if these are being actively developed:

-// NOT IMPLEMENTED BELOW
+// WORK IN PROGRESS: These tests are being developed for the v2 E2E strategic testing framework
internal/params/params.go (1)

135-145: 🛠️ Refactor suggestion

⚠️ Potential issue

Document concurrency limitations for Restore and Override methods

The Restore and Override methods modify the global flag.CommandLine, which can lead to unpredictable behavior if multiple parsers are used concurrently.

Add documentation to clarify the concurrency limitations:

+// Restore restores the global flag.CommandLine to its default state.
+// Note: This method modifies global state and should not be used in concurrent contexts
+// where multiple parser instances might be active.
 func (p *parser) Restore() {
     if p.defaults != nil {
         flag.CommandLine = p.defaults
     }
 }

+// Override replaces the global flag.CommandLine with this parser's FlagSet.
+// Note: This method modifies global state and should not be used in concurrent contexts
+// where multiple parser instances might be active.
 func (p *parser) Override() {
     if p.f != nil {
         flag.CommandLine = p.f
     }
 }
🧹 Nitpick comments (24)
pkg/index/job/deletion/service/options_test.go (1)

3-4: Consider removing or updating the "NOT IMPLEMENTED BELOW" comment

This comment indicates that the file is a work in progress, which is fine during development but should be removed or updated before submitting the final PR. Either implement the tests or add a more specific TODO with timeline or assignee.

-// NOT IMPLEMENTED BELOW
-//
+// TODO: Implement test cases for service options
+// Issue: #xxxx
pkg/index/job/deletion/usecase/deletion_test.go (1)

1-672: Consider a structured approach to implementing these tests.

All test functions follow a good table-driven pattern but are commented out. I recommend:

  1. Start by uncommenting one test at a time
  2. Add proper imports at the top of the file
  3. Implement concrete test cases for happy paths first
  4. Add test cases for error conditions
  5. Pay special attention to the Start test which needs channel testing
  6. Use mocks for dependencies (server, indexer, observability)

This approach will help build test coverage methodically.

tests/v2/e2e/kubernetes/client.go (2)

41-46: Consider removing unused fields or adding usage.

The manager manager.Manager and client kclient.WithWatch fields are currently not used. If they are not needed for future functionality, consider removing them to keep the struct lightweight and maintainable.


37-39: Fix typographical method name.

The method GetRESRConfig() suggests a small typo. Renaming it to GetRESTConfig() would improve code clarity and standardize naming.

- GetRESRConfig() *rest.Config
+ GetRESTConfig() *rest.Config

Also applies to: 118-124

tests/v2/e2e/kubernetes/portforward/portforward.go (2)

153-239: Add an upper bound or user-defined limit for the retry loop.

Your backoff-based loop will keep attempting port-forward indefinitely. If the user doesn’t provide a context with a timeout, the loop may never exit. Consider adding a maximum number of retries or a user-configurable limit for better control and faster failure detection.


158-163: Initialize errgroup in the constructor.

You are conditionally creating pf.eg if it is nil. Typically, this initialization might be more transparent within NewForwarder. If there’s no scenario where pf.eg is pre-initialized, consider setting it unconditionally during construction for consistency.

tests/v2/e2e/kubernetes/status.go (4)

83-114: Consider configurable polling intervals.

WaitForStatus uses a 5-second ticker in an indefinite loop. If the context has no deadline, this may lead to a long wait. Allowing configuration of the polling interval or enforcing a default maximum duration can improve test predictability.


86-89: Validate status patterns upfront.

If the user provides statuses not listed in PossibleStatuses(obj), the function immediately returns ErrStatusPatternNeverMatched. Ensure that the caller is aware of valid statuses early, and consider logging or throwing an error with more actionable guidance (e.g. which status was invalid).


153-174: Handle CRD or unknown resource types.

CheckResourceState returns StatusUnknown and an error for unsupported resources. If CRDs or custom resource types might appear in your E2E tests, consider a pluggable mechanism or a fallback. Otherwise, clarify that only the listed core objects are supported.


409-451: Refine the logic for pods with multiple containers.

The current evaluation checks only the PodReady condition. If pods have multiple containers, container-level checks might offer finer-grained insights (e.g. partially ready states). If relevant, consider enumerating container statuses to detect partial failures or readiness states.

tests/v2/e2e/config/enums.go (1)

23-113: Consider adding doc comments or leveraging iota for typed enumerations.

While the current string-based approach is valid for configuration datatypes, adding doc comments for each enumeration value can enhance maintainability. You could also evaluate switching to numeric enumerations using iota if stronger type safety is needed, though the current method is perfectly acceptable in many use cases.

tests/v2/e2e/crud/index_test.go (1)

32-38: Reconsider return value on error in callback.

Returning true even when an error occurs might inadvertently indicate success to upstream code. If you intend to abort subsequent steps on error, consider returning false or propagating the error to signal failure.

tests/v2/e2e/crud/object_test.go (3)

34-52: Consider documenting how the newRequest functions should be used.

Each of these functions (e.g., objectRequest, existsRequest, timestampRequest) encapsulates request construction logic. Adding brief documentation about the expected parameters and usage context (e.g., how they integrate with the plan or dataset) can make the code more maintainable and self-explanatory.


65-73: Provide coverage for the unsupported operation paths.

You currently emit an error via t.Errorf for unsupported operations (e.g., OperationMultiple for OpObject). However, it might be useful to test these paths to ensure that future code changes do not inadvertently introduce partial implementation for these modes.


89-90: Clarify rationale behind restricting certain modes in ListObject operation.

For OpListObject, you mark OperationMultiple and OperationStream as unsupported and emit a test error. Consider explaining why these modes are intentionally skipped and whether there is any plan to support them in the future.

tests/v2/e2e/crud/grpc_test.go (2)

51-65: Rename or generalize the error message in handleGRPCCallError.

Currently, the fallback error message is "failed to search vector", but the function is used for all gRPC operations, not just search. A more generalized message (e.g., "gRPC call error") would be more accurate.

- t.Errorf("failed to search vector: %v", err)
+ t.Errorf("gRPC call error: %v", err)

120-136: Implement the empty exec function body or remove it.

In multi(...), the exec := func(batch []Q) {} function is invoked but contains no logic. This may be a placeholder for future processing (e.g., handling partial results or post-processing). Consider removing it if it's not needed or adding a TODO comment to clarify its purpose.

tests/v2/e2e/crud/strategy_test.go (2)

139-161: Assess concurrency handling and partial failures.

The strategy test runs operations concurrently via eg.Go. Ensure any operation error is properly surfaced. Currently, processOperation never returns an error (always returns nil). If you need to fail fast on partial errors, consider propagating them.


315-338: Consider adding logs or validations when creating the client with metadata.

While adding metadata can be beneficial, it might be useful to log the presence of any critical keys or do a quick validation (e.g., ensuring required keys are set) to avoid silent failures or misconfiguration at runtime.

tests/v2/e2e/crud/modification_test.go (1)

136-175: Consider handling unexpected operation modes in processModification.

Currently, there is no default branch for handling unknown operation modes when switching on plan.Mode. If a user accidentally configures an unsupported mode, it silently does nothing. Adding a default branch to log or error out could improve debuggability.

 switch plan.Mode {
 case config.OperationUnary, config.OperationOther:
     ...
 case config.OperationMultiple:
     ...
 case config.OperationStream:
     ...
+default:
+    t.Errorf("unsupported operation mode: %v", plan.Mode)
     return
 }
tests/v2/e2e/kubernetes/resources.go (1)

156-156: Correct the "endponts" type alias typo.

There is a minor spelling mistake in the type alias endponts. For consistency and clarity, rename it to endpoints.

-type endponts    = baseClient[*corev1.Endpoints, *corev1.EndpointsList, *applyconfigurationscorev1.EndpointsApplyConfiguration]
+type endpoints   = baseClient[*corev1.Endpoints, *corev1.EndpointsList, *applyconfigurationscorev1.EndpointsApplyConfiguration]
internal/net/dialer_test.go (1)

1993-2079: PR contains multiple unimplemented test skeletons

This PR introduces commented-out test skeletons across multiple files without actual implementation. This seems contrary to the PR's goal of improving test coverage and framework.

Consider adopting one of these approaches for a more disciplined testing strategy:

  1. Implement tests when they're added: Add tests only when you're ready to implement them, avoiding commented-out placeholders
  2. Create separate issues/tickets: For tests you plan to implement later, create specific tickets rather than adding TODOs in the code
  3. Add minimal test implementations: Even simple assertions are better than commented-out code - they verify basic functionality and can be expanded later

This approach will ensure that each PR actually improves test coverage rather than increasing technical debt with unimplemented tests.

internal/sync/errgroup/group.go (1)

136-153: Consider elaborating on runtime.Gosched usage.
Calling runtime.Gosched() after capturing non-cancellation errors is functional but somewhat unusual. A brief clarification in comments may be helpful for future maintainers.

internal/iter/iter.go (1)

52-67: Add test coverage for iterator behavior.
The lines reported by the static analysis tool are not covered by tests. Consider adding unit tests verifying creation with various offsets, negative num, context cancellation, and modification functions (modFunc), especially for boundary conditions (e.g., zero-length slice).

Would you like me to open a ticket or provide a sample test file to help improve coverage?

Also applies to: 72-77, 81-87, 89-91, 96-97, 101-107, 109-111, 117-123, 125-127, 132-137, 139-141, 145-146, 150-151

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 52-67: internal/iter/iter.go#L52-L67
Added lines #L52 - L67 were not covered by tests

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f316d56 and d68d37c.

📒 Files selected for processing (135)
  • .gitfiles (14 hunks)
  • .github/workflows/_docker-image.yaml (1 hunks)
  • .github/workflows/_release-pr.yaml (1 hunks)
  • .github/workflows/build-binaries.yaml (1 hunks)
  • .github/workflows/build-protobuf.yaml (1 hunks)
  • .github/workflows/chatops.yaml (5 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/coverage.yaml (1 hunks)
  • .github/workflows/e2e-chaos.yaml (4 hunks)
  • .github/workflows/e2e-code-bench-agent.yaml (2 hunks)
  • .github/workflows/e2e-max-dim.yaml (1 hunks)
  • .github/workflows/e2e-profiling.yaml (1 hunks)
  • .github/workflows/e2e.yaml (8 hunks)
  • .github/workflows/format.yaml (2 hunks)
  • .github/workflows/fossa.yaml (1 hunks)
  • .github/workflows/helm-lint.yaml (3 hunks)
  • .github/workflows/helm.yaml (2 hunks)
  • .github/workflows/reviewdog-k8s.yaml (3 hunks)
  • .github/workflows/reviewdog.yaml (2 hunks)
  • .github/workflows/test-hack.yaml (1 hunks)
  • .github/workflows/unit-test-rust.yaml (1 hunks)
  • .github/workflows/unit-test.yaml (3 hunks)
  • .github/workflows/update-deps.yaml (1 hunks)
  • Makefile (5 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • buf.gen.yaml (1 hunks)
  • cmd/index/job/deletion/main_test.go (1 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/example/client/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/deletion/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • internal/backoff/option.go (0 hunks)
  • internal/client/v1/client/discoverer/discover_test.go (5 hunks)
  • internal/config/benchmark_test.go (4 hunks)
  • internal/config/config.go (2 hunks)
  • internal/config/index_deleter_test.go (1 hunks)
  • internal/core/algorithm/usearch/usearch_test.go (16 hunks)
  • internal/errors/errors.go (1 hunks)
  • internal/errors/errors_test.go (1 hunks)
  • internal/errors/k8s.go (1 hunks)
  • internal/info/info_test.go (17 hunks)
  • internal/iter/iter.go (1 hunks)
  • internal/net/dialer_test.go (1 hunks)
  • internal/net/grpc/errdetails/errdetails.go (6 hunks)
  • internal/net/grpc/metadata_test.go (1 hunks)
  • internal/net/grpc/option_test.go (44 hunks)
  • internal/net/grpc/pool/pool.go (1 hunks)
  • internal/net/grpc/pool/pool_test.go (5 hunks)
  • internal/net/grpc/server_test.go (2 hunks)
  • internal/net/grpc/stream.go (2 hunks)
  • internal/net/grpc/stream_test.go (4 hunks)
  • internal/net/http/client/client.go (1 hunks)
  • internal/net/http/client/client_test.go (1 hunks)
  • internal/net/net.go (1 hunks)
  • internal/net/net_test.go (1 hunks)
  • internal/net/quic/conn_test.go (1 hunks)
  • internal/net/quic/listener_test.go (1 hunks)
  • internal/params/option.go (2 hunks)
  • internal/params/option_test.go (1 hunks)
  • internal/params/params.go (5 hunks)
  • internal/params/params_test.go (1 hunks)
  • internal/rand/rand.go (1 hunks)
  • internal/servers/server/option_test.go (1 hunks)
  • internal/sync/errgroup/group.go (7 hunks)
  • internal/sync/errgroup/group_test.go (16 hunks)
  • internal/test/data/vector/gen.go (0 hunks)
  • internal/test/data/vector/noise/noise.go (1 hunks)
  • internal/test/data/vector/noise/noise_test.go (1 hunks)
  • internal/test/data/vector/noise/option.go (1 hunks)
  • internal/test/data/vector/noise/option_test.go (1 hunks)
  • internal/timeutil/time.go (1 hunks)
  • internal/timeutil/time_test.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (9 hunks)
  • pkg/discoverer/k8s/service/discover_test.go (4 hunks)
  • pkg/gateway/lb/handler/grpc/aggregation_test.go (2 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (2 hunks)
  • pkg/index/job/deletion/config/config_test.go (1 hunks)
  • pkg/index/job/deletion/service/deleter_test.go (1 hunks)
  • pkg/index/job/deletion/service/options_test.go (1 hunks)
  • pkg/index/job/deletion/usecase/deletion_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/insert_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/job_test.go (12 hunks)
  • pkg/tools/benchmark/job/service/object_test.go (8 hunks)
  • pkg/tools/benchmark/job/service/option_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/remove_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/search_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/update_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/upsert_test.go (4 hunks)
  • pkg/tools/cli/loadtest/service/insert_test.go (11 hunks)
  • pkg/tools/cli/loadtest/service/loader.go (1 hunks)
  • pkg/tools/cli/loadtest/service/loader_test.go (13 hunks)
  • pkg/tools/cli/loadtest/service/search_test.go (9 hunks)
  • tests/v2/e2e/assets/rollout.yaml (1 hunks)
  • tests/v2/e2e/assets/unary_crud.yaml (1 hunks)
  • tests/v2/e2e/config/config.go (1 hunks)
  • tests/v2/e2e/config/enums.go (1 hunks)
  • tests/v2/e2e/crud/crud_test.go (1 hunks)
  • tests/v2/e2e/crud/dataset_test.go (1 hunks)
  • tests/v2/e2e/crud/grpc_test.go (1 hunks)
  • tests/v2/e2e/crud/index_test.go (1 hunks)
  • tests/v2/e2e/crud/modification_test.go (1 hunks)
  • tests/v2/e2e/crud/object_test.go (1 hunks)
  • tests/v2/e2e/crud/search_test.go (1 hunks)
  • tests/v2/e2e/crud/strategy_test.go (1 hunks)
  • tests/v2/e2e/hdf5/hdf5.go (1 hunks)
  • tests/v2/e2e/kubernetes/client.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/option.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/portforward.go (1 hunks)
  • tests/v2/e2e/kubernetes/resources.go (1 hunks)
  • tests/v2/e2e/kubernetes/rollout.go (1 hunks)
  • tests/v2/e2e/kubernetes/status.go (1 hunks)
💤 Files with no reviewable changes (2)
  • internal/backoff/option.go
  • internal/test/data/vector/gen.go
🚧 Files skipped from review as they are similar to previous changes (90)
  • dockers/buildbase/Dockerfile
  • .github/workflows/build-binaries.yaml
  • dockers/dev/Dockerfile
  • .github/workflows/e2e-code-bench-agent.yaml
  • .github/workflows/coverage.yaml
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • internal/errors/errors.go
  • .github/workflows/test-hack.yaml
  • dockers/binfmt/Dockerfile
  • dockers/operator/helm/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • dockers/index/operator/Dockerfile
  • dockers/ci/base/Dockerfile
  • dockers/discoverer/k8s/Dockerfile
  • tests/v2/e2e/assets/rollout.yaml
  • dockers/manager/index/Dockerfile
  • dockers/gateway/lb/Dockerfile
  • dockers/index/job/readreplica/rotate/Dockerfile
  • .github/workflows/helm.yaml
  • .github/workflows/unit-test.yaml
  • dockers/buildkit/Dockerfile
  • dockers/tools/benchmark/job/Dockerfile
  • pkg/tools/benchmark/job/service/upsert_test.go
  • dockers/agent/core/faiss/Dockerfile
  • .github/workflows/chatops.yaml
  • dockers/example/client/Dockerfile
  • cmd/index/job/deletion/main_test.go
  • internal/rand/rand.go
  • .github/workflows/fossa.yaml
  • .github/workflows/reviewdog.yaml
  • dockers/agent/core/agent/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • .github/workflows/e2e-max-dim.yaml
  • .github/workflows/build-protobuf.yaml
  • dockers/index/job/deletion/Dockerfile
  • .github/workflows/update-deps.yaml
  • .github/workflows/e2e-chaos.yaml
  • .github/workflows/format.yaml
  • .github/workflows/codeql-analysis.yml
  • dockers/index/job/correction/Dockerfile
  • .github/workflows/_release-pr.yaml
  • pkg/tools/benchmark/job/service/insert_test.go
  • pkg/tools/benchmark/job/service/remove_test.go
  • pkg/tools/benchmark/job/service/object_test.go
  • pkg/tools/benchmark/job/service/update_test.go
  • internal/net/quic/conn_test.go
  • internal/timeutil/time.go
  • internal/config/benchmark_test.go
  • dockers/tools/cli/loadtest/Dockerfile
  • .github/workflows/e2e-profiling.yaml
  • buf.gen.yaml
  • internal/net/grpc/errdetails/errdetails.go
  • Makefile.d/e2e.mk
  • dockers/agent/sidecar/Dockerfile
  • .github/workflows/e2e.yaml
  • .github/workflows/reviewdog-k8s.yaml
  • pkg/tools/benchmark/job/service/job_test.go
  • internal/net/http/client/client.go
  • dockers/index/job/creation/Dockerfile
  • .github/workflows/helm-lint.yaml
  • tests/v2/e2e/crud/crud_test.go
  • internal/config/index_deleter_test.go
  • tests/v2/e2e/crud/dataset_test.go
  • internal/core/algorithm/usearch/usearch_test.go
  • internal/test/data/vector/noise/option.go
  • dockers/tools/benchmark/operator/Dockerfile
  • pkg/index/job/deletion/config/config_test.go
  • internal/net/net.go
  • dockers/index/job/save/Dockerfile
  • internal/net/grpc/server_test.go
  • pkg/agent/core/ngt/service/ngt.go
  • .github/workflows/_docker-image.yaml
  • pkg/agent/core/ngt/service/ngt_test.go
  • pkg/tools/benchmark/job/service/search_test.go
  • internal/net/grpc/stream_test.go
  • pkg/tools/cli/loadtest/service/search_test.go
  • internal/errors/errors_test.go
  • tests/v2/e2e/kubernetes/rollout.go
  • tests/v2/e2e/kubernetes/portforward/option.go
  • pkg/gateway/lb/handler/grpc/aggregation_test.go
  • Makefile
  • pkg/discoverer/k8s/service/discover_test.go
  • .github/workflows/unit-test-rust.yaml
  • Makefile.d/functions.mk
  • internal/client/v1/client/discoverer/discover_test.go
  • tests/v2/e2e/hdf5/hdf5.go
  • internal/config/config.go
  • pkg/tools/cli/loadtest/service/loader_test.go
  • pkg/gateway/lb/handler/grpc/handler_test.go
🧰 Additional context used
🧠 Learnings (1)
.gitfiles (1)
Learnt from: datelier
PR: vdaas/vald#2807
File: rust/bin/agent/src/handler/object.rs:36-38
Timestamp: 2025-03-13T04:50:01.551Z
Learning: In Rust code for Vald handlers, avoid using unwrap() on Option types. Instead, handle None values explicitly by returning appropriate error statuses to maintain robustness.
🪛 GitHub Check: codecov/patch
internal/iter/iter.go

[warning] 52-67: internal/iter/iter.go#L52-L67
Added lines #L52 - L67 were not covered by tests


[warning] 72-77: internal/iter/iter.go#L72-L77
Added lines #L72 - L77 were not covered by tests


[warning] 81-87: internal/iter/iter.go#L81-L87
Added lines #L81 - L87 were not covered by tests


[warning] 89-91: internal/iter/iter.go#L89-L91
Added lines #L89 - L91 were not covered by tests


[warning] 96-97: internal/iter/iter.go#L96-L97
Added lines #L96 - L97 were not covered by tests


[warning] 101-107: internal/iter/iter.go#L101-L107
Added lines #L101 - L107 were not covered by tests


[warning] 109-111: internal/iter/iter.go#L109-L111
Added lines #L109 - L111 were not covered by tests


[warning] 117-123: internal/iter/iter.go#L117-L123
Added lines #L117 - L123 were not covered by tests


[warning] 125-127: internal/iter/iter.go#L125-L127
Added lines #L125 - L127 were not covered by tests


[warning] 132-137: internal/iter/iter.go#L132-L137
Added lines #L132 - L137 were not covered by tests


[warning] 139-141: internal/iter/iter.go#L139-L141
Added lines #L139 - L141 were not covered by tests


[warning] 145-146: internal/iter/iter.go#L145-L146
Added lines #L145 - L146 were not covered by tests


[warning] 150-151: internal/iter/iter.go#L150-L151
Added lines #L150 - L151 were not covered by tests

pkg/tools/cli/loadtest/service/loader.go

[warning] 207-207: pkg/tools/cli/loadtest/service/loader.go#L207
Added line #L207 was not covered by tests


[warning] 212-212: pkg/tools/cli/loadtest/service/loader.go#L212
Added line #L212 was not covered by tests

🪛 YAMLlint (1.35.1)
tests/v2/e2e/assets/unary_crud.yaml

[error] 204-204: duplication of key "name" in mapping

(key-duplicates)

⏰ Context from checks skipped due to timeout of 90000ms (88)
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: runner / go build
  • GitHub Check: Run tests for internal packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
🔇 Additional comments (96)
internal/net/quic/listener_test.go (1)

1-196: Test skeletons should be implemented or removed

The file contains well-structured test skeletons for QUIC listener functionality, but they're entirely commented out. While the structure follows good testing practices with proper setup for test cases, check functions, and leak detection, they lack actual implementation.

Consider either:

  1. Implementing at least basic test cases to provide real test coverage, or
  2. Removing these commented-out skeletons until they're ready to be implemented

Commented-out code in the codebase can lead to confusion and maintenance challenges over time.

internal/net/net_test.go (1)

1201-1284: Implement test cases for IsUDP and IsTCP functions.

Both test functions are currently commented out and only provide a testing framework without actual test cases. Network type validation functions are critical for reliability and should be thoroughly tested.

Consider implementing test cases for:

  1. Standard network types (e.g., "udp", "tcp")
  2. Variant types (e.g., "udp4", "udp6", "tcp4", "tcp6")
  3. Case sensitivity (e.g., "UDP", "Tcp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings

Also applies to: 1286-1369

internal/net/http/client/client_test.go (1)

214-305: The test function for NewWithTransport needs to be implemented and uncommented.

The test structure is well-designed, but the entire test remains commented out and lacks actual test cases. Since NewWithTransport is likely part of the public API, it needs proper test coverage.

Additionally, I noticed a few potential issues in the test implementation:

  1. The defaultCheckFunc uses reflect.DeepEqual directly instead of the custom comparator.Diff with comparators used in the TestNew function, which may cause issues with complex objects.
  2. The signatures of beforeFunc and afterFunc are inconsistent with those in TestNew (they include a *testing.T parameter).
  3. The test uses goleak.IgnoreCurrent() instead of the global goleakIgnoreOptions defined at the top of the file.

Please implement test cases for various scenarios, such as:

  • Basic usage with default options
  • Custom transport options
  • Error handling cases
internal/servers/server/option_test.go (1)

3728-4066: Implement the commented test functions for comprehensive gRPC options coverage

The PR adds templates for four important gRPC configuration option tests that are currently commented out. These tests are critical for validating the gRPC configuration options that affect the V2 E2E testing framework's performance and reliability.

To complete the implementation:

  1. Uncomment all four test functions
  2. Implement at least two test cases for each function:
    • A "set success" case with valid parameters
    • A parameter validation case (e.g., "not set when size is invalid")

Example implementation for TestWithGRPCMaxConcurrentStreams:

-// func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
+func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
     type args struct {
         size uint32
     }
-    type want struct {
-        want Option
-    }
     type test struct {
         name       string
         args       args
-        want       want
-        checkFunc  func(want, Option) error
-        beforeFunc func(*testing.T, args)
-        afterFunc  func(*testing.T, args)
+        checkFunc  func(opt Option) error
     }
-    defaultCheckFunc := func(w want, got Option) error {
-        if !reflect.DeepEqual(got, w.want) {
-            return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
-        }
-        return nil
-    }
     tests := []test{
-        // TODO test cases
-        /*
-           {
-               name: "test_case_1",
-               args: args {
-                   size:0,
-               },
-               want: want{},
-               checkFunc: defaultCheckFunc,
-               beforeFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-               afterFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-           },
-        */
+        {
+            name: "set success when size is more than 0",
+            args: args{
+                size: 100,
+            },
+            checkFunc: func(opt Option) error {
+                got := new(server)
+                opt(got)
+                if len(got.grpc.opts) != 1 {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
+        {
+            name: "not set when size is 0",
+            args: args{
+                size: 0,
+            },
+            checkFunc: func(opt Option) error {
+                gopts := []grpc.ServerOption{
+                    grpc.ConnectionTimeout(10 * time.Second),
+                }
+                got := new(server)
+                got.grpc.opts = gopts
+                opt(got)
+                if !reflect.DeepEqual(got.grpc.opts, gopts) {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
     }

     for _, tc := range tests {
         test := tc
         t.Run(test.name, func(tt *testing.T) {
-            tt.Parallel()
-            defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
-            if test.beforeFunc != nil {
-                test.beforeFunc(tt, test.args)
-            }
-            if test.afterFunc != nil {
-                defer test.afterFunc(tt, test.args)
-            }
-            checkFunc := test.checkFunc
-            if test.checkFunc == nil {
-                checkFunc = defaultCheckFunc
-            }
-
-            got := WithGRPCMaxConcurrentStreams(test.args.size)
-            if err := checkFunc(test.want, got); err != nil {
+            got := WithGRPCMaxConcurrentStreams(test.args.size)
+            if err := test.checkFunc(got); err != nil {
                 tt.Errorf("error = %v", err)
             }
         })
     }
-}
+}

Apply similar modifications to the other three test functions.

pkg/index/job/deletion/service/options_test.go (5)

1-348: Implementation placeholder with commented-out test code.

The entire file consists of commented-out test templates with no actual implementation. While the test structure is well-designed with parallel execution, goroutine leak checking, and comprehensive argument/expectation patterns, none of the tests are functional in their current state.

For these tests to be useful, you need to:

  1. Uncomment the code
  2. Add missing imports (reflect, errors, goleak, and discoverer)
  3. Implement the actual test cases replacing the TODOs

5-89: Uncomment and implement test cases for WithDiscoverer

Please uncomment this test function and implement concrete test cases to verify the WithDiscoverer option works correctly. Consider including:

  1. A case with a valid discoverer client mock
  2. A case with nil client to test error handling
  3. Edge cases such as a client that returns errors
#!/bin/bash
# Check if the WithDiscoverer function handles nil clients properly

# First, find the implementation
echo "Checking WithDiscoverer implementation:"
rg -A 3 "func WithDiscoverer" pkg/index/job/deletion/service/

91-175: Uncomment and implement test cases for WithIndexingConcurrency

This test function needs to be uncommented and implemented with concrete test cases. Based on standard practices for testing concurrency parameters, include:

  1. Zero value test case (test handling of invalid input)
  2. Negative value test case (test handling of invalid input)
  3. Valid/typical concurrency values
  4. Extremely high values to verify there are no performance issues
#!/bin/bash
# Check how WithIndexingConcurrency implementation handles invalid values

echo "Checking WithIndexingConcurrency implementation:"
rg -A 5 "func WithIndexingConcurrency" pkg/index/job/deletion/service/

177-261: Uncomment and implement test cases for WithTargetAddrs

This test function needs to be uncommented and fully implemented. Consider adding test cases for:

  1. Empty address slice
  2. Single address
  3. Multiple addresses
  4. Invalid address formats (if validation is performed)
  5. Duplicate addresses (if deduplication is expected)
#!/bin/bash
# Check WithTargetAddrs implementation details

echo "Checking WithTargetAddrs implementation:"
rg -A 3 "func WithTargetAddrs" pkg/index/job/deletion/service/

263-347: Uncomment and implement test cases for WithTargetIndexID

This test function needs to be uncommented and implemented with appropriate test cases:

  1. Empty index ID
  2. Valid index ID
  3. Special character handling (if relevant)
  4. Very long index IDs (if there are length constraints)
#!/bin/bash
# Check WithTargetIndexID implementation details

echo "Checking WithTargetIndexID implementation:"
rg -A 3 "func WithTargetIndexID" pkg/index/job/deletion/service/
pkg/index/job/deletion/usecase/deletion_test.go (7)

1-2: Add missing import statements for test file.

The file is missing necessary import statements for packages required by these tests, such as testing, context, errors, reflect, golang.org/x/sync/errgroup, and goleak.


3-93: Uncomment and implement TestNew with actual test cases.

The TestNew function is fully commented out. To make this test functional:

  1. Uncomment the entire function
  2. Add at least one test case for valid configuration
  3. Add test cases for nil and invalid configurations
  4. Ensure import statements are added for required packages

The structure is well-designed with appropriate error handling, but without implementation it's not providing any test coverage.


95-208: Uncomment Test_run_PreStart and improve parameter naming.

This test function has a well-structured table-driven approach but is completely commented out. The parameter naming could be improved - for example, rename generic field names to more descriptive ones that reflect their purpose in the test.


210-327: Uncomment and implement Test_run_Start with channel tests.

The Start method returns a channel, so test cases should verify both:

  1. Channel behavior (returning correct errors)
  2. Error conditions when components fail to start properly

The test structure is sound but needs implementation of actual test cases.


329-442: Uncomment and implement Test_run_PreStop with proper test cases.

The PreStop function needs test coverage to ensure resources are properly prepared for shutdown. Consider implementing test cases that verify:

  1. Proper notification to downstream components
  2. Error handling during preparation for shutdown
  3. Context propagation

Also, parameter naming can be improved - in0 should be renamed to a more descriptive name like ctx.


444-557: Uncomment Test_run_Stop and implement tests for graceful shutdown.

The Stop function is crucial for clean shutdown. Test cases should cover:

  1. Graceful shutdown scenarios
  2. Error propagation when dependencies fail to stop properly
  3. Timeout handling during shutdown

The table-driven approach is appropriate but needs actual implementation.


559-672: Uncomment and implement Test_run_PostStop function.

The PostStop function requires test coverage to ensure proper cleanup after service shutdown. Implement test cases that validate:

  1. Resources are fully released
  2. No lingering connections remain
  3. Error handling during cleanup operations

Also, parameter naming should be improved - in0 should be renamed to ctx for clarity.

internal/net/grpc/option_test.go (17)

532-615: Function renamed with parameter type change

The function TestWithDialOptions has been renamed to TestWithBackoffMaxDelay with its parameter type changed from []grpc.DialOption to string. This is part of the larger refactoring to support the new V2 E2E testing framework.


617-700: Function renamed with consistent parameter type

The function TestWithBackoffMaxDelay has been renamed to TestWithBackoffBaseDelay, maintaining the same parameter type (string). This renaming follows a consistent pattern throughout the file's refactoring.


702-785: Function renamed with parameter type change

The function TestWithBackoffBaseDelay has been renamed to TestWithBackoffMultiplier, with its parameter type changed from string to float64. This change reflects the specific data type needed for testing backoff multipliers.


787-870: Function renamed with parameter type change

The function TestWithBackoffMultiplier has been renamed to TestWithBackoffJitter, with parameter type changed from float64 to float64 (same type but different semantic meaning). This continues the logical progression of backoff parameter testing.


872-955: Function renamed with parameter type change

The function TestWithBackoffJitter has been renamed to TestWithMinConnectTimeout, changing parameter type from float64 to string to accommodate duration formatting.


957-1040: Function renamed with parameter type change

The function TestWithMinConnectTimeout has been renamed to TestWithErrGroup, changing parameter type from string to errgroup.Group to test error group functionality.


1042-1125: Function renamed with parameter type change

The function TestWithCallOptions has been renamed to TestWithBackoff, changing parameter type from []grpc.CallOption to backoff.Backoff, allowing for testing of backoff strategies.


1127-1210: Function renamed with parameter type change

The function TestWithErrGroup has been renamed to TestWithCircuitBreaker, changing parameter type from errgroup.Group to circuitbreaker.CircuitBreaker to test circuit breaker functionality.


1212-1295: Function renamed with parameter type change

The function TestWithCircuitBreaker has been renamed to TestWithCallOptions, with parameter type changed to []grpc.CallOption. This completes a cycle of test function reorganization.


1297-1380: New test function for call content subtype

A new test function TestWithCallContentSubtype has been added to test the WithCallContentSubtype functionality, supporting the specification of content subtypes in gRPC calls.


1382-1465: Function renamed for max receive message size

The function TestWithMaxRecvMsgSize has been renamed but maintains the same purpose and parameter type, continuing the testing reorganization.


1467-1550: Function renamed for max send message size

The function TestWithMaxSendMsgSize has been renamed from a different source function as part of the comprehensive test reorganization.


1552-1635: Function renamed for max retry buffer size

The function TestWithMaxRetryRPCBufferSize now tests max retry buffer size configuration, a crucial aspect of gRPC retry mechanics.


1637-1720: Function renamed for wait-for-ready flag

The function TestWithWaitForReady tests the wait-for-ready flag configuration, important for robust gRPC connection handling.


1722-1805: Function renamed for dial options

The function TestWithDialOptions has been placed later in the file, maintaining testing coverage for dial options configuration.


2408-2494: Updated dialer test with network parameter

The function TestWithDialer has been enhanced with an additional network parameter, providing more specific network configuration testing.


2581-3174: Added several new gRPC option test functions

Seven new test functions have been added:

  • TestWithAuthority
  • TestWithDisableRetry
  • TestWithIdleTimeout
  • TestWithMaxCallAttempts
  • TestWithMaxHeaderListSize
  • TestWithSharedWriteBuffer
  • TestWithUserAgent

These additions significantly expand the test coverage for gRPC connection options, which is crucial for the new E2E testing framework.

However, as noted in a previous review, all test cases within these functions remain commented out. Consider implementing at least one test case for each function to ensure actual coverage.

.gitfiles (7)

126-126: New Rust unit testing workflow added

The addition of a unit-test-rust.yaml workflow file improves the CI/CD pipeline by providing dedicated testing for Rust components, which aligns well with the project's multi-language architecture.


1087-1087: New iterator abstraction package added

The internal/iter/iter.go file introduces the new iterator package mentioned in the PR objectives. This abstraction will likely improve code reusability and standardize iteration patterns across the codebase.


1273-1273: QUIC test files modified

The QUIC-related test files have been updated. Note that there were previous spell check warnings about the term "quic" but this is a valid protocol name (Quick UDP Internet Connections).

Also applies to: 1275-1275


1985-1989: New QBG algorithm implementation added to Rust libraries

The addition of the QBG (Quantized Binary Graphs) algorithm implementation in Rust expands the available vector search algorithm options, which is a valuable enhancement to the system's capabilities.


2034-2052: New V2 E2E strategic testing framework implemented

The introduction of a comprehensive V2 E2E testing framework is a significant improvement to the project's testing infrastructure. The framework includes:

  1. Configurable operations and dataset handling (tests/v2/e2e/crud/ files)
  2. Kubernetes integration for testing in realistic environments
  3. Port forwarding capabilities for service communication
  4. Structured test organization and strategy patterns

This aligns perfectly with the PR objectives and will enhance the project's testing capabilities.


488-488: New QBG configuration sample added

A sample configuration file for the QBG component has been added, providing users with a reference implementation for this feature.


1406-1409: New vector noise generation utilities added for testing

The addition of noise generation utilities for vector data will improve testing by allowing the creation of realistic but controllable test data with various noise characteristics.

tests/v2/e2e/kubernetes/client.go (1)

48-91:

❓ Verification inconclusive

Verify fallback logic for kubeconfig resolution.

In the event that no kubeconfig is provided or discovered, the code attempts to build an in-cluster config. Ensure that this fallback design is acceptable for your local testing scenario. If you rely heavily on environment-based configurations for local runs, consider logging more explicit messages or prompting the user when failing to find a kubeconfig file.


🏁 Script executed:

#!/bin/bash
# This script checks logs or debug prints ensuring pool fallback is triggered only when no config is found
ast-grep --pattern $'log.Debugf("failed to build config from kubeConfig path $_")'

Length of output: 83


Below is a new verification script using rg (ripgrep) to search for the expected fallback debug log lines. This should help confirm that the fallback logging is indeed present in the file:

Once you run this script, please verify that the output matches the two occurrences of the call to

log.Debugf("failed to build config from kubeConfig path %s,\terror: %v", kubeConfig, err)

found in the fallback branches. If these debug messages appear as expected, it indicates that the fallback logic is being exercised when a kubeconfig is not found.

Action Items:

  • Confirm Fallback Behavior: Double-check that the fallback to inClusterConfigClient() is only triggered when no kubeconfig is available.
  • Enhance Visibility: If your local testing environment relies heavily on environment-based configuration, consider adding additional explicit logging or user prompts to make troubleshooting easier when the fallback is triggered.

Please run the provided script to manually confirm these details.

Next Steps:
Once you’ve confirmed the above, you can decide if any additional logging is necessary for clarity or if the current design meets your needs.


🏁 Script executed:

#!/bin/bash
# Using ripgrep to search for the fallback debug log message in the client.go file.
rg 'log\.Debugf\("failed to build config from kubeConfig path' tests/v2/e2e/kubernetes/client.go

Length of output: 404


Fallback Behavior Reviewed: Verify Configuration Logic

The code correctly falls back to using the in-cluster configuration when a kubeconfig isn’t provided—as evidenced by the duplicate debug log calls:

log.Debugf("failed to build config from kubeConfig path %s,\terror: %v", kubeConfig, err)

Please ensure that this fallback design aligns with your local testing needs. If you rely heavily on environment-based configurations, consider enhancing the logging (or adding user prompts) to provide clearer feedback when the fallback is triggered.

tests/v2/e2e/kubernetes/portforward/portforward.go (3)

125-134: Confirm slice usage correctness.

slices.Clip, slices.Sort, and slices.Compact are used in sequence to reduce, sort, and deduplicate targets. This is valid and efficient, but verify that the final target array order is the desired approach for your round-robin logic.


288-292: Provide more informative error messages.

When no pods are available, the code logs a generic message and returns errors.ErrNoAvailablePods. Including the intended namespace or service name in the error could make troubleshooting easier.


330-424:

❓ Verification inconclusive

Validate concurrency for SPDY transport usage.

While PortforwardExtended launches a goroutine to execute pf.ForwardPorts(), ensure it’s safe to reuse the underlying HTTP client or SPDY transport from multiple goroutines if you plan on port-forwarding multiple pods concurrently. If concurrency is needed, consider employing separate transports or verifying thread safety in your usage.


🏁 Script executed:

#!/bin/bash
# Checking references to shared http.Client or spdy.RoundTripper usage
rg -A 5 "httpClient *http.Client"

Length of output: 35


Attention: Concurrency Concern with Shared HTTP Client/Transport

The PortforwardExtended function updates the HTTP client's transport by assigning the SPDY round tripper obtained from spdy.RoundTripperFor. When no HTTP client is provided, it defaults to using http.DefaultClient, which is globally shared. This raises potential concurrency issues if multiple port-forward operations run concurrently, as modifying a shared client’s transport can lead to race conditions.

  • Action Required: Verify that the SPDY round tripper and its associated HTTP client are safe for concurrent use.
  • Suggestion: If you intend to run multiple port-forward sessions concurrently, consider creating a dedicated HTTP client instance (or at least a copy of the default client) for each call instead of using the global http.DefaultClient.
tests/v2/e2e/config/config.go (2)

188-196: Add validation for metadata inputs.

Currently, metadata is split and inserted into the Metadata map without checks or whitespace trimming. This can lead to unexpected values or potential misuse if inputs are not trusted. Please consider adding a robust validation mechanism for the Metadata inputs.


602-613: Confirm default ports logic.

Using a default port (8081) when the bound port is zero is a sensible fallback. Ensure that 8081 is indeed the intended default for your use case, and consider exposing it as a configurable parameter if different or multiple defaults may be needed in the future.

tests/v2/e2e/crud/index_test.go (1)

40-62: Well-structured switch for index operations.

The switch statement cleanly covers supported operations and handles unexpected ones correctly. This approach is straightforward to maintain and extend as new operations are introduced.

internal/test/data/vector/noise/option_test.go (1)

3-261: Implement or remove placeholder tests.

All three test functions (TestWithLevelFactor, TestWithTableDivisionFactor, and TestWithMinTableSize) are fully commented out. Revisit the placeholder tests, either by implementing actual test cases or removing them if they are no longer needed.

internal/test/data/vector/noise/noise_test.go (1)

5-95: Complete the TestNew function.

All logic for TestNew is commented out, leaving zero test coverage. Reinstate and fill in realistic test scenarios to validate the constructor’s behavior.

internal/test/data/vector/noise/noise.go (3)

80-106: Guard against division by zero in average standard deviation calculation.

If count remains zero (e.g., all vectors are empty), your current code attempts to compute totalStd / float64(count), which will crash.

Below is a possible fix that returns a default value when count is zero:

 for _, vec := range data {
   ...
 }
 if count == 0 {
+  return 0.01 // fallback to avoid division by zero
 }
 return float32(totalStd/float64(count)) * ng.noiseLevelFactor

108-123: Check for zero-valued noiseTableDivisionFactor.

Dividing by ng.noiseTableDivisionFactor (line 117) without validating its value can lead to runtime errors. Ensure you assert a minimum of 1 or handle zero gracefully.


180-181: Confirm Go 1.21+ for slices.Clone.

This code relies on slices.Clone, which is part of the standard library since Go 1.21. Verify the build environment uses Go 1.21 or later to prevent compatibility issues.

tests/v2/e2e/crud/object_test.go (1)

99-122: Consider partial data handling in the streaming loop.

The streaming loop breaks immediately on encountering an unexpected error or hitting the record limit (cnt >= train.Len()). For completeness, confirm if partial data handling is acceptable or if additional logic is required when truncated streams occur. This helps ensure consistent test behavior.

tests/v2/e2e/crud/grpc_test.go (1)

180-202: Validate potential partial streams.

The stream(...) method sets up a bidirectional streaming client and returns early if the index passes data.Len(). If the server unexpectedly closes the stream sooner, ensure that partial responses are verified (or properly handled). You may wish to add a callback to handle a partial dataset scenario more explicitly.

tests/v2/e2e/crud/modification_test.go (1)

136-175: Verify leftover batch handling in multi modification functions.

Ensure the logic that handles the leftover batch (if plan.BulkSize does not evenly divide the total requests) is properly implemented in the multi(...) function. If the leftover is never sent, some modifications might be skipped.

Please confirm by reviewing or testing the multi function to ensure it calls any remaining requests after the main loop. If this functionality is missing, I can help propose a fix.

tests/v2/e2e/kubernetes/resources.go (1)

562-608: ** Avoid overshadowing errors when updating annotations.**

As noted previously, if the Update call fails after setting the pod template, you risk losing context on the underlying retrieval or template-setting errors. Consider wrapping errors with additional context instead of returning them directly to aid in debugging.

For instance:

 obj, err = b.SetPodTemplate(obj, tmpl)
 if err != nil {
-  return obj, err
+  return obj, fmt.Errorf("failed to set pod template: %w", err)
 }
 return b.Update(ctx, obj, uopts)
internal/net/grpc/pool/pool.go (1)

224-230: Thread-safe modification in store method using exclusive lock

The change from RLock (read lock) to Lock (exclusive lock) is a significant improvement for thread safety. Since store is a writing operation that modifies the connection pool, using an exclusive lock ensures proper synchronization and prevents potential race conditions that could occur with multiple goroutines.

internal/info/info_test.go (1)

341-343: Support for valdReplacer field added to existing structs

The addition of the valdReplacer field properly extends the test structure to accommodate changes in the implementation. This field is likely used for replacing paths in stack traces or error messages, which is important for consistent testing.

internal/timeutil/time_test.go (2)

184-263: Implement test cases for TestDurationString_Duration

The test function has a proper structure but is completely commented out with only TODOs. Since this is part of the E2E testing framework refactoring, having proper test coverage for time utilities is important.

Consider implementing test cases that cover:

  • Valid duration strings with various time units (ns, ms, s, m, h)
  • Empty strings
  • Invalid formats
  • Edge cases (extremely large or small durations)

This will ensure the Duration() method of DurationString works as expected in all scenarios.


265-349: Implement test cases for TestDurationString_DurationWithDefault

Similar to the previous function, this test has the proper structure but is completely commented out with only TODOs. The DurationWithDefault method appears to be important for handling default values when parsing fails.

Consider implementing test cases that verify:

  • Valid duration strings correctly parse and ignore the default
  • Empty strings return the default value
  • Invalid formats return the default value
  • Various default values are properly returned when needed

These tests will help ensure robust time handling in the E2E testing framework.

internal/net/grpc/stream.go (2)

171-181: Good improvement adding concurrency control to BidirectionalStreamClient

The addition of the concurrency parameter allows for better control over the number of concurrent operations, which can help prevent resource exhaustion and manage performance.


211-237: Well-implemented asynchronous message sending

The implementation correctly uses a sync.WaitGroup to manage the goroutines that send messages, ensuring all send operations complete before closing the stream. The error handling is also properly maintained.

pkg/tools/cli/loadtest/service/loader.go (2)

207-211:

❓ Verification inconclusive

Updated function call to match new BidirectionalStreamClient signature

The code has been correctly updated to include the concurrency parameter in the function call.

Note that static analysis indicates this line isn't covered by tests. Consider adding test coverage for this scenario:


🏁 Script executed:

#!/bin/bash
# Find existing tests for this file or similar functionality
rg -t go "func Test.*StreamInsert" --include "*.go" 

Length of output: 495


Action Required: Verify Test Coverage for Updated BidirectionalStreamClient Call

The updated call now correctly includes the concurrency parameter as per the new signature. However, static analysis indicates that the corresponding code path (in pkg/tools/cli/loadtest/service/loader.go, lines 207–211) is not covered by tests. Note that the initial rg command failed due to an invalid flag (--include), so please manually verify the test coverage using a corrected command (for example, using rg -t go "func Test.*StreamInsert" -g "*.go") or confirm via your test suite.

  • Confirm that the updated call aligns with the new BidirectionalStreamClient signature.
  • Add tests to cover the scenario implemented in these lines if none exist.
  • Verify test coverage manually if automated search commands (like rg) are misbehaving.
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 207-207: pkg/tools/cli/loadtest/service/loader.go#L207
Added line #L207 was not covered by tests


212-216:

❓ Verification inconclusive

Updated function call to match new BidirectionalStreamClient signature

The code has been correctly updated to include the concurrency parameter in the function call.

Note that static analysis indicates this line isn't covered by tests. Consider adding test coverage for this scenario:


🏁 Script executed:

#!/bin/bash
# Find existing tests for this file or similar functionality
rg -t go "func Test.*StreamSearch" --include "*.go"

Length of output: 495


Attention: Verify gRPC Client Call Update & Test Coverage

The update to include the concurrency parameter in the BidirectionalStreamClient call (in pkg/tools/cli/loadtest/service/loader.go at lines 212–216) is correct. However, our attempt to locate related test cases using the provided search command returned an error due to an unsupported flag. Please manually verify that tests exist to cover this functionality—specifically, cases that exercise a bidirectional stream scenario similar to what Test…StreamSearch tests would cover—or add new tests accordingly.

  • Action Items:
    • Confirm that the updated call is exercised by tests.
    • Adjust the test search command if needed (e.g., using rg -t go "func Test.*StreamSearch") or manually inspect test files.
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 212-212: pkg/tools/cli/loadtest/service/loader.go#L212
Added line #L212 was not covered by tests

internal/params/option.go (4)

20-36: Good enhancement to default parser options

The changes update the default configuration to automatically set the parser name based on the executable name and initialize the override default flag. This provides better out-of-the-box behavior for the argument parser.


38-45: Well-implemented name configuration option

The WithName option correctly sets the parser name with proper validation to ensure non-empty strings.


89-95: Good addition of override default configuration option

The WithOverrideDefault option provides a way to control whether the parser should override the default command line flags, increasing flexibility.


96-109: Well-designed argument filtering capability

The WithArgumentFilters option implements a clean pattern for adding argument filters with appropriate initialization and validation. The comments clearly explain the purpose and behavior of the filters.

internal/sync/errgroup/group_test.go (1)

953-953:

❓ Verification inconclusive

Field type change to atomic.Int64 lacks testing

The test code has been updated to use atomic.Int64 for the limit field, which is a good practice for thread-safe operations in concurrent code. However, since the test is commented out, there's no active verification that this implementation works correctly.

When making changes to concurrent code, especially involving atomic operations, it's critical to have proper test coverage to ensure thread safety and correct behavior.

Please uncomment and implement the test to verify that the atomic operations work as expected. Additionally, run the tests with the race detector enabled to catch any potential concurrency issues:


🏁 Script executed:

#!/bin/bash
go test -race ./internal/sync/errgroup/...

Length of output: 143


Ensure atomic operations are properly verified with CGO enabled

The updated code now correctly uses atomic.Int64 for thread-safe operations. However, the tests that would exercise this change remain commented out, and the initial test run with the race detector did not execute as expected because CGO_ENABLED wasn’t set. To avoid any false negatives regarding concurrency safety, please:

  • Uncomment and enable the tests targeting the limit field.
  • Re-run the tests with the race detector after enabling cgo, for example:
    CGO_ENABLED=1 go test -race ./internal/sync/errgroup/...

Once these steps are completed, we can be confident that the atomic operations behave correctly under concurrent conditions.

internal/net/dialer_test.go (1)

1993-2079: Implement or remove the Test_isQUICDial skeleton

This PR introduces a commented-out test skeleton for isQUICDial without any actual test cases. Adding placeholder tests like this creates technical debt if left unimplemented, especially in a PR focused on test improvements.

Please either:

  1. Implement concrete test cases that validate the behavior of the isQUICDial function, or
  2. Remove this commented-out code until you're ready to properly implement the tests

If you're planning a phased approach to testing, consider adding these tests in follow-up PRs when they're ready for implementation rather than adding multiple commented-out skeletons.

internal/net/grpc/pool/pool_test.go (5)

2874-2877: Improved naming convention for better readability.

The renaming of struct fields from generic names (want, want1) to more descriptive ones (wantConn, wantOk) enhances code clarity by explicitly indicating what each field represents - a connection and a boolean status respectively.


2887-2893: Consistent parameter naming improves function clarity.

The parameter names in defaultCheckFunc have been updated to match the renamed struct fields, making the function more readable and maintaining naming consistency throughout the test code.


3009-3010: Updated variable usage reflects the new naming convention.

The variable names used when calling and handling the return values from Get() now consistently use the improved naming pattern, completing the naming refactor for this test case.


3043-3046: Enhanced function signature with additional return value for better debugging.

The want struct and function signature have been updated to include an index value (wantIdx), providing more context about which connection from the pool is being used. The defaultCheckFunc has been appropriately modified to validate this additional information, improving test diagnostics.

Also applies to: 3052-3065


3185-3186: Function call updated to handle the extended return value set.

The function call has been properly updated to handle the new three-value return (index, connection, status) from getHealthyConn, completing the consistent refactoring of this component.

internal/params/params.go (5)

29-35: Good addition of typed error handling constants

The addition of a type alias for flag.ErrorHandling and the corresponding constants improves code readability and maintainability by providing well-named constants for error handling strategies.


53-70: Enhanced parser struct with improved configuration options

The additions to the parser struct (overrideDefault, name, filters, FlagSet handling) provide better flexibility and control over the argument parsing process, which will be beneficial for the E2E testing framework.


105-115: Good filtering mechanism for arguments

The new filtering mechanism allows for more fine-grained control over which arguments are processed, which is useful for E2E testing scenarios. The use of slices.DeleteFunc is an elegant solution.


117-123: Improved error handling with proper error checking

The change to use errors.Is(err, flag.ErrHelp) is more robust than direct error comparison, following Go best practices for error handling.


78-82:

❓ Verification inconclusive

Be cautious with global state management in concurrent scenarios

The use of flag.CommandLine (global state) together with overrideDefault can cause issues if multiple parser instances run concurrently.


🏁 Script executed:

#!/bin/bash
# Check for potential concurrent usage of parser instances in the codebase
echo "Searching for potential concurrent usage of parsers..."
rg -A 3 'New\(' --glob '*.go' | rg -i 'concurr|goroutine|go func'

Length of output: 6031


Attention: Verify Concurrency Safety with Global Flag Usage

The current implementation in internal/params/params.go still uses the global flag.CommandLine when initializing p.defaults and creating a new flag set. While this approach is standard for many applications, combining this with conditional overrides via p.Override() (triggered when p.overrideDefault is true) may lead to race conditions if multiple parser instances run concurrently. Although our repository-wide search indicates that concurrency is managed in various components (mainly in tests and specific service modules), it doesn’t confirm that parser instances won’t be used concurrently. Please verify that:

  • Parser instances that rely on this global state are not initialized concurrently, or
  • Appropriate safeguards (e.g., synchronization or isolated flag sets) are in place if concurrency is expected.
internal/errors/k8s.go (1)

20-46: Good addition of specific Kubernetes error types

The addition of specialized error variables for Kubernetes operations improves error handling specificity and will make the E2E testing framework more robust. Using error functions with parameters (like ErrPodIsNotRunning) allows for more informative error messages.

One minor suggestion for consistency:

-	ErrUndefinedNamespace = New("Undefined namespace")
-	ErrUndefinedService = New("Undefined service")
+	ErrUndefinedNamespace = New("undefined namespace") 
+	ErrUndefinedService = New("undefined service")

The error messages should consistently use lowercase for the first word as done in the other error messages.

internal/sync/errgroup/group.go (13)

17-18: Good documentation update.
These package-level comments clearly describe the custom errgroup functionality, improving maintainability.


24-24: Atomic usage is appropriate.
Using sync/atomic for concurrency-limiting logic is a sound approach to manage limits safely without data races.


31-42: Interface documentation is clear.
The newly added comments nicely clarify how each method behaves, aiding both contributors and users of the Group interface.


44-44: Descriptive struct comment.
Provides a concise explanation for the group struct’s function and role.


51-53: Clarify negative or zero limit behavior.
Currently, limit <= 1 lumps negative, zero, and one all together, resulting in either serial execution (if exactly 1) or unbounded concurrency (if less than 1). The code works as intended, but it may be helpful to expand the docstring to state that negative or zero values imply no concurrency limits.

Do you plan on documenting this so that future maintainers clearly understand how negative or zero limits are handled?


117-120: Configuration caution.
The comment “This must not be modified while any tasks are active” is critical to prevent race conditions while adjusting concurrency limits. No further issues found.


166-190: “Go” method logic looks solid.
The mechanism that conditionally executes inline for limit=1 or spawns goroutines is consistent and well-structured.


192-210: “TryGo” method logic properly parallels “Go”.
The opportunistic semaphore acquisition and inline execution logic is well-implemented.


212-223: Error tracking is robust.
Storing errors in a map and list to avoid duplicates is a straightforward approach. Concurrency control with mu is correct.


225-231: Resource cleanup is correct.
Releasing semaphore tokens and decrementing the wait group in done() ensures concurrency-limiting resources are freed properly.


233-241: One-time cancellation logic is appropriate.
Using sync.Once prevents double cancellation and potentially conflicting error causes.


243-259: Autocancel after Wait might mask original error cause.
Cancelling with context.Canceled post-WG wait is typically acceptable, but it does overwrite the last context cancellation cause if it was set. Consider clarifying this design decision in comments if you foresee confusion.


261-267: Global Wait function is consistent.
Returning nil when the instance is uninitialized is safe, and the approach is consistent with the global instance pattern.

internal/iter/iter.go (2)

20-23: Potential circular import risk
Importing "iter" from within the iter package can cause confusion or a circular dependency if it refers to the same or related module. This matches a previous comment.


53-59: Return a safe no-op iterator for empty arrays.
This repeats the prior recommendation to avoid returning nil, as it could lead to downstream panics if the caller attempts to use methods on a nil cycle. A lightweight “no-op” cycle would ensure consistent behavior.

@@ -1931,6 +1962,7 @@ rust/bin/agent/src/handler.rs
rust/bin/agent/src/handler/common.rs
rust/bin/agent/src/handler/index.rs
rust/bin/agent/src/handler/insert.rs
rust/bin/agent/src/handler/object.rs
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify Rust Option handling in object handler

Based on past learnings, ensure that the modified Rust handler doesn't use unwrap() on Option types, which could lead to panics. Instead, handle None values explicitly by returning appropriate error statuses.


🏁 Script executed:

#!/bin/bash
# Check if the modified Rust handler properly handles Option types without unwrap()
grep -n "unwrap()" rust/bin/agent/src/handler/object.rs

Length of output: 109


Attention: Replace unwrap() usage in Rust Object Handler

The file rust/bin/agent/src/handler/object.rs still calls unwrap() on an Option at line 44:

let domain = hostname.to_str().unwrap();

This violates our best practices. Please refactor this code to explicitly handle the None case— for example, by using a match or if let expression to return an appropriate error status when to_str() fails.

Comment on lines +97 to +196
// func Test_noiseGenerator_Mod(t *testing.T) {
// type fields struct {
// noiseLevelFactor float32
// noiseTableDivisionFactor uint64
// minNoiseTableSize uint64
// noiseTable []float32
// }
// type want struct {
// want Func
// }
// type test struct {
// name string
// fields fields
// want want
// checkFunc func(want, Func) error
// beforeFunc func(*testing.T)
// afterFunc func(*testing.T)
// }
// defaultCheckFunc := func(w want, got Func) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// fields: fields {
// noiseLevelFactor:0,
// noiseTableDivisionFactor:0,
// minNoiseTableSize:0,
// noiseTable:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// fields: fields {
// noiseLevelFactor:0,
// noiseTableDivisionFactor:0,
// minNoiseTableSize:0,
// noiseTable:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T,) {
// t.Helper()
// },
// afterFunc: func(t *testing.T,) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
// ng := &noiseGenerator{
// noiseLevelFactor: test.fields.noiseLevelFactor,
// noiseTableDivisionFactor: test.fields.noiseTableDivisionFactor,
// minNoiseTableSize: test.fields.minNoiseTableSize,
// noiseTable: test.fields.noiseTable,
// }
//
// got := ng.Mod()
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
//
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fill in the Test_noiseGenerator_Mod placeholders.

The test for Mod is also commented out. Provide test cases to validate how noise is added to vectors, covering various edge cases, including empty vectors.

Comment on lines +187 to +256
func (r *runner) processExecution(t *testing.T, ctx context.Context, idx int, e *config.Execution) {
t.Helper()
if r == nil || e == nil {
return
}

t.Run(fmt.Sprintf("#%d: execution=%s type=%s mode=%s", idx, e.Name, e.Type, e.Mode), func(tt *testing.T) {
if err := executeWithTimings(tt, ctx, e, e.Name, "execution", func(ttt *testing.T, ctx context.Context) error {
switch e.Type {
case config.OpSearch,
config.OpSearchByID,
config.OpLinearSearch,
config.OpLinearSearchByID,
config.OpInsert,
config.OpUpdate,
config.OpUpsert,
config.OpRemove,
config.OpRemoveByTimestamp,
config.OpObject,
config.OpListObject,
config.OpTimestamp,
config.OpExists:
train, test, neighbors := getDatasetSlices(ttt, e)
if e.BaseConfig != nil {
log.Infof("started execution name: %s, type: %s, mode: %s, execution: %d, num: %d, offset: %d",
e.Name, e.Type, e.Mode, idx, e.Num, e.Offset)
defer log.Infof("finished execution name: %s type: %s, mode: %s, execution: %d, num: %d, offset: %d",
e.Name, e.Type, e.Mode, idx, e.Num, e.Offset)
}
switch e.Type {
case config.OpSearch,
config.OpSearchByID,
config.OpLinearSearch,
config.OpLinearSearchByID:
r.processSearch(ttt, ctx, train, test, neighbors, e)
case config.OpInsert,
config.OpUpdate,
config.OpUpsert,
config.OpRemove,
config.OpRemoveByTimestamp:
r.processModification(ttt, ctx, train, e)
case config.OpObject,
config.OpListObject,
config.OpTimestamp,
config.OpExists:
r.processObject(ttt, ctx, train, e)
}
case config.OpIndexInfo,
config.OpIndexDetail,
config.OpIndexStatistics,
config.OpIndexStatisticsDetail,
config.OpIndexProperty,
config.OpFlush:
log.Infof("type: %s, mode: %s, execution: %d", e.Type, e.Mode, idx)
r.processIndex(ttt, ctx, e)
case config.OpKubernetes:
// TODO implement kubernetes operation here, eg. delete pod, rollout restart, etc.
case config.OpClient:
// TODO implement gRPC client operation here, eg. start, stop, etc.
case config.OpWait:
// do nothing
default:
ttt.Errorf("unsupported operation type: %s detected during execution %d", e.Type, idx)
}
return nil
}); err != nil {
tt.Errorf("failed to process execution: %v", err)
}
})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Refactor large switch-case in processExecution.

The method includes multiple operation types and sub-cases (search, insert, remove, etc.). Consider extracting these blocks into dedicated functions to improve readability and maintainability of processExecution.

@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch from d68d37c to d6b336f Compare March 15, 2025 14:28
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🔭 Outside diff range comments (2)
internal/net/grpc/option_test.go (1)

532-3174: ⚠️ Potential issue

Address commented-out gRPC option tests.

While the extensive renaming and refactoring of test functions shows a thoughtful reorganization of the testing structure (shifting from generic dial options to specific parameter testing for backoff strategies and connection management), all these functions remain commented out and aren't actually executed.

The addition of new tests like TestWithAuthority, TestWithDisableRetry, etc. demonstrates an intention to improve coverage, but without implementation, they don't contribute to actual test validation.

For a PR focused on E2E testing improvements:

  1. Uncomment and implement at least the most critical test cases
  2. Create a clear timeline/tracking for implementing the remaining tests
  3. Document why these tests exist in commented form if they're intentionally being preserved this way

This issue was flagged in previous reviews but still needs to be addressed.

internal/sync/errgroup/group_test.go (1)

946-1057: 🛠️ Refactor suggestion

Implement the Test_group_exec function with actual test cases.

The test function for exec has a good structure but is commented out and lacks actual test cases. Since it appears that exec is replacing or supplementing TryGo, it's important to have proper test coverage.

Please uncomment and implement comprehensive test cases that:

  • Test successful execution scenarios
  • Test error handling
  • Test execution with various concurrency limits
  • Test context cancellation behavior
-// func Test_group_exec(t *testing.T) {
+func Test_group_exec(t *testing.T) {
♻️ Duplicate comments (20)
internal/params/option_test.go (1)

450-705: ⚠️ Potential issue

Commented-out test functions need implementation

The file contains three new test functions that are commented out: TestWithName, TestWithOverrideDefault, and TestWithArgumentFilters. These tests are needed to ensure the new functionality works as expected.

Consider either:

  1. Implementing and uncommenting these test functions
  2. Removing the commented code if it's not ready for inclusion

Note that these commented tests use tt.Parallel() and goleak.IgnoreCurrent() while existing tests don't, which may cause inconsistency in testing behavior.

-// NOT IMPLEMENTED BELOW
-//
-// func TestWithName(t *testing.T) {
+func TestWithName(t *testing.T) {

And similarly for the other test functions.

internal/servers/server/option_test.go (1)

3727-4066: ⚠️ Potential issue

Implement the commented test functions for comprehensive gRPC options testing

These four gRPC configuration option test functions are still commented out and need to be implemented for proper test coverage. These tests are essential for validating the gRPC configuration options that affect the E2E testing framework introduced in this PR.

For each test function (TestWithGRPCMaxConcurrentStreams, TestWithGRPCNumStreamWorkers, TestWithGRPCSharedWriteBuffer, and TestWithGRPCWaitForHandlers), you should:

  1. Uncomment the function
  2. Simplify the test structure (remove unnecessary fields)
  3. Implement at least two test cases per function:
    • A positive test (when parameters are valid)
    • A negative test (when parameters are invalid)

Example implementation for TestWithGRPCMaxConcurrentStreams:

-// func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
+func TestWithGRPCMaxConcurrentStreams(t *testing.T) {
     type args struct {
         size uint32
     }
-    type want struct {
-        want Option
-    }
     type test struct {
         name       string
         args       args
-        want       want
-        checkFunc  func(want, Option) error
-        beforeFunc func(*testing.T, args)
-        afterFunc  func(*testing.T, args)
+        checkFunc  func(opt Option) error
     }
-    defaultCheckFunc := func(w want, got Option) error {
-        if !reflect.DeepEqual(got, w.want) {
-            return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
-        }
-        return nil
-    }
     tests := []test{
-        // TODO test cases
-        /*
-           {
-               name: "test_case_1",
-               args: args {
-                   size:0,
-               },
-               want: want{},
-               checkFunc: defaultCheckFunc,
-               beforeFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-               afterFunc: func(t *testing.T, args args) {
-                   t.Helper()
-               },
-           },
-        */
+        {
+            name: "set success when size is more than 0",
+            args: args{
+                size: 100,
+            },
+            checkFunc: func(opt Option) error {
+                got := new(server)
+                opt(got)
+                if len(got.grpc.opts) != 1 {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
+        {
+            name: "not set when size is 0",
+            args: args{
+                size: 0,
+            },
+            checkFunc: func(opt Option) error {
+                gopts := []grpc.ServerOption{
+                    grpc.ConnectionTimeout(10 * time.Second),
+                }
+                got := new(server)
+                got.grpc.opts = gopts
+                opt(got)
+                if !reflect.DeepEqual(got.grpc.opts, gopts) {
+                    return errors.New("invalid param was set")
+                }
+                return nil
+            },
+        },
     }

     for _, tc := range tests {
         test := tc
         t.Run(test.name, func(tt *testing.T) {
-            tt.Parallel()
-            defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
-            if test.beforeFunc != nil {
-                test.beforeFunc(tt, test.args)
-            }
-            if test.afterFunc != nil {
-                defer test.afterFunc(tt, test.args)
-            }
-            checkFunc := test.checkFunc
-            if test.checkFunc == nil {
-                checkFunc = defaultCheckFunc
-            }
-
-            got := WithGRPCMaxConcurrentStreams(test.args.size)
-            if err := checkFunc(test.want, got); err != nil {
+            got := WithGRPCMaxConcurrentStreams(test.args.size)
+            if err := test.checkFunc(got); err != nil {
                 tt.Errorf("error = %v", err)
             }
         })
     }
-}
+}

Apply similar modifications to the other three test functions.

internal/test/data/vector/noise/option_test.go (3)

5-89: 🛠️ Refactor suggestion

Implement test coverage for TestWithLevelFactor.

All test logic is commented out, leaving zero coverage. Filling in realistic scenarios and validating various input factors will significantly improve confidence in this option’s correctness.


91-175: 🛠️ Refactor suggestion

Implement test coverage for TestWithTableDivisionFactor.

Similarly, this test is fully commented out. Provide robust test scenarios to verify the correct handling of large and small division factors, ensuring the code behaves as expected.


177-261: 🛠️ Refactor suggestion

Implement test coverage for TestWithMinTableSize.

All relevant test code is commented out. To ensure that the minimum table size logic is reliable, add test cases covering edge values and typical usage.

internal/test/data/vector/noise/noise_test.go (2)

5-95: 🛠️ Refactor suggestion

Complete the TestNew function.

The entire test is commented out, leaving no coverage for the constructor logic. Please provide scenarios involving valid data, empty data, and edge cases to confirm that New behaves correctly under all conditions.


97-196: 🛠️ Refactor suggestion

Fill in Test_noiseGenerator_Mod placeholders.

This test is also fully commented out, resulting in zero coverage of the Mod implementation. Introduce various edge and typical cases (including empty vectors) to confirm correct noise addition and the stability of the precomputed table usage.

internal/test/data/vector/noise/noise.go (2)

80-106: ⚠️ Potential issue

Guard against potential division by zero.

If all vectors in a non-empty dataset are empty, count remains 0, causing a possible float64(count) division by zero at line 105.

Proposed fix:

 if count == 0 {
-  return float32(totalStd/float64(count)) * ng.noiseLevelFactor
+  return 0.01
 }
 return float32(totalStd/float64(count)) * ng.noiseLevelFactor

117-117: ⚠️ Potential issue

Prevent division by zero for noiseTableDivisionFactor.

If ng.noiseTableDivisionFactor is zero, the expression required /= ng.noiseTableDivisionFactor at line 117 triggers a runtime error.

Consider rejecting zero values upfront or defaulting to 1:

 if ng.noiseTableDivisionFactor == 0 {
+  ng.noiseTableDivisionFactor = 1
 }
 required /= ng.noiseTableDivisionFactor
pkg/index/job/deletion/usecase/deletion_test.go (7)

1-2: ⚠️ Potential issue

Missing import statements in test file.

This test file is missing essential import statements for packages such as "testing", "context", "errors", "reflect", "golang.org/x/sync/errgroup", and "go.uber.org/goleak". Without these imports, the code won't compile when uncommented.

Add the necessary imports at the beginning of the file:

package usecase

+import (
+	"context"
+	"errors"
+	"reflect"
+	"testing"
+
+	"github.com/vdaas/vald/internal/config"
+	"github.com/vdaas/vald/internal/observability"
+	"github.com/vdaas/vald/internal/runner"
+	"github.com/vdaas/vald/internal/starter"
+	"github.com/vdaas/vald/pkg/index/job/deletion/service"
+	"golang.org/x/sync/errgroup"
+	"go.uber.org/goleak"
+)

3-93: ⚠️ Potential issue

Uncomment TestNew and implement actual test cases.

The TestNew function is entirely commented out. Based on past review comments, this appears to have been fixed in commit 57792a5, but the code still shows the function as commented. Uncomment the function and implement proper test cases to ensure the New function works correctly.

-// NOT IMPLEMENTED BELOW
-//
-// func TestNew(t *testing.T) {
+func TestNew(t *testing.T) {

Also, implement at least these test cases:

  1. Test with valid configuration
  2. Test with nil configuration
  3. Test with invalid configuration parameters

95-208: ⚠️ Potential issue

Uncomment Test_run_PreStart and implement test cases.

The Test_run_PreStart function is commented out. Uncomment this function and implement actual test cases to test the PreStart functionality. The function structure is well-designed, but without actual test cases, no testing is performed.

-// func Test_run_PreStart(t *testing.T) {
+func Test_run_PreStart(t *testing.T) {

Implement test cases that cover:

  1. Successful PreStart execution
  2. Behavior with a nil context
  3. Error scenarios when dependencies fail to initialize

210-327: ⚠️ Potential issue

Uncomment Test_run_Start and implement test cases.

The Test_run_Start function should be uncommented and properly implemented. This test is particularly important as it tests the start behavior, including channel handling for errors.

-// func Test_run_Start(t *testing.T) {
+func Test_run_Start(t *testing.T) {

Implement test cases that cover:

  1. Successful start with valid error channel
  2. Error cases where the server or indexer fails to start
  3. Proper channel behavior (which may require goroutine synchronization)

329-442: ⚠️ Potential issue

Uncomment Test_run_PreStop and implement test cases.

The PreStop function needs test coverage to ensure resources are properly prepared for shutdown. The test structure is in place but commented out.

-// func Test_run_PreStop(t *testing.T) {
+func Test_run_PreStop(t *testing.T) {

Implement test cases to validate:

  1. Proper notification of downstream components
  2. Graceful handling of the shutdown preparation
  3. Error handling during the pre-stop phase

444-557: ⚠️ Potential issue

Uncomment Test_run_Stop and implement test cases.

The Stop function is crucial for clean shutdown. This test should be uncommented and properly implemented to ensure that shutdown happens correctly.

-// func Test_run_Stop(t *testing.T) {
+func Test_run_Stop(t *testing.T) {

Implement test cases that cover:

  1. Graceful shutdown scenarios
  2. Error propagation when dependencies fail to stop properly
  3. Complete resource cleanup

559-672: ⚠️ Potential issue

Uncomment Test_run_PostStop and implement test cases.

The PostStop function requires test coverage to ensure proper cleanup after service shutdown. Uncomment and implement test cases.

-// func Test_run_PostStop(t *testing.T) {
+func Test_run_PostStop(t *testing.T) {

Implement test cases to validate:

  1. Complete resource cleanup
  2. No lingering connections remain
  3. Proper error handling during the cleanup phase
internal/timeutil/time_test.go (2)

185-263: 🛠️ Refactor suggestion

Implement test cases for TestDurationString_Duration.

The test function has been properly structured but remains commented out with only placeholder TODO comments. Since this is part of the V2 E2E testing framework, implementing these tests is important for ensuring time utilities work correctly.

Please implement test cases that:

  • Test valid duration strings with different time units (ns, μs, ms, s, m, h)
  • Test empty strings
  • Test invalid duration formats
  • Test edge cases (very large/small durations)
-//
-// func TestDurationString_Duration(t *testing.T) {
+func TestDurationString_Duration(t *testing.T) {

265-349: 🛠️ Refactor suggestion

Implement test cases for TestDurationString_DurationWithDefault.

Similar to the previous function, this test is structured but remains commented out with placeholder TODOs. The DurationWithDefault method is important for handling fallback values when parsing fails.

Please implement test cases that verify:

  • Valid duration strings correctly parse and ignore the default
  • Empty strings return the default value
  • Invalid formats return the default value
  • Various default values are properly returned when needed
-//
-// func TestDurationString_DurationWithDefault(t *testing.T) {
+func TestDurationString_DurationWithDefault(t *testing.T) {
internal/sync/errgroup/group_test.go (1)

1172-1288: 🛠️ Refactor suggestion

Resolve the commented-out Test_group_TryGo function.

This commented-out test function creates ambiguity about the status of the TryGo method. Based on previous code reviews, you need to decide on one of these approaches:

  1. If TryGo is still a supported method in the API:

    • Uncomment and implement this test
    • Document the differences between TryGo and exec
  2. If TryGo is being deprecated:

    • Remove this commented code
    • Add deprecation notices to the TryGo method implementation

Having both functions commented out without clear direction creates confusion about the intended API.

tests/v2/e2e/assets/unary_crud.yaml (1)

202-204: ⚠️ Potential issue

Remove duplicate “name” key.

YAML lint flags an error at line 204 due to duplicating the “name” key. You can remove or rename the duplicate key outside the executions section. For example:

      - name: Inset Operation
        executions:
          - name: Insert
            ...
          - name: IndexInfo
            ...
-        name: Insert -> IndexInfo
+        # name key removed or renamed to avoid duplication
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 204-204: duplication of key "name" in mapping

(key-duplicates)

🧹 Nitpick comments (32)
internal/net/net_test.go (1)

1262-1282: Add memory leak detection to test execution

The test framework includes goleak.VerifyNone(tt, goleak.IgnoreCurrent()), which is excellent for detecting goroutine leaks. However, there's no corresponding cleanup in the TestMain function.

For consistency with other tests in this file, consider moving the goroutine leak check to TestMain or removing it from individual test functions if it's handled globally.

internal/info/info_test.go (1)

428-429: Consider adding test cases with non-nil replacer values.

All current test cases initialize valdReplacer to nil. To ensure proper test coverage, consider adding test cases that use a non-nil valdReplacer to verify its functionality within the info struct.

// Add a test case similar to:
{
    name: "with_custom_replacer",
    fields: fields {
        baseURL: "https://example.com",
        detail: Detail{},
-       valdReplacer: nil,
+       valdReplacer: strings.NewReplacer("old", "new"),
        rtCaller: nil,
        rtFuncForPC: nil,
    },
    want: want{
        want: "expected output with replacements",
    },
    checkFunc: defaultCheckFunc,
}
pkg/index/job/deletion/usecase/deletion_test.go (3)

1-672: Consider implementing a common test helper function.

All test functions share similar boilerplate code for setup and validation. Consider extracting common patterns into helper functions to reduce duplication and improve maintainability.

For example, you could create a helper for initializing the run struct or for setting up common test fixtures that are used across multiple test functions.


330-331: Improve parameter naming in Test_run_PreStop.

The parameter name in0 is not descriptive. Use a more meaningful name like ctx to match other test functions and improve readability.

 type args struct {
-	in0 context.Context
+	ctx context.Context
 }

560-561: Improve parameter naming in Test_run_PostStop.

Similar to the PreStop function, the parameter name in0 should be replaced with a more descriptive name like ctx.

 type args struct {
-	in0 context.Context
+	ctx context.Context
 }
internal/sync/errgroup/group_test.go (1)

953-953: Update atomic.Int64 initialization in tests.

The test code has been updated to use atomic.Int64 instead of int for the limit field, but the test case initialization needs attention. When using atomic.Int64, you need to properly initialize it using the Store method.

In test case templates and initialization code, make sure to:

-limit:nil,
+// Initialize with a value
+var limit atomic.Int64
+limit.Store(10) // Or whatever value needed
+fields: fields{
+    limit: limit,
+},

This will ensure correct thread-safe initialization of atomic values.

Also applies to: 979-983, 1009-1009, 1045-1045, 1067-1067, 1095-1095, 1122-1122, 1179-1179, 1213-1213, 1240-1240, 1276-1276, 1297-1297, 1326-1326, 1353-1353, 1389-1389, 1407-1407, 1432-1432, 1456-1456, 1492-1492

internal/net/grpc/pool/pool_test.go (3)

2875-2876: Use descriptive field names in the want struct.

Renaming wantConn and wantOk to more explicit names like expectedConn and expectedOk can improve clarity in test results.


2887-2892: Check for nil in addition to DeepEqual.

When comparing complex objects like ClientConn, consider adding a nil check before the reflect.DeepEqual to avoid confusion in test failures.


3185-3186: Validate retry behavior.

When testing p.getHealthyConn(...), consider verifying that multiple retries are actually attempted when the pool is unhealthy. This ensures correct behavior of the retry logic.

tests/v2/e2e/kubernetes/client.go (3)

48-91: Ensure consistent error handling for all fallback attempts.

The NewClient function attempts several fallback strategies: environment variable, default home file, and in-cluster configuration. Consider ensuring all logs and errors clearly distinguish which fallback path is used, to simplify troubleshooting.


93-108: Validate QPS/Burst for performance tuning.

While setting cfg.QPS = 20.0 and cfg.Burst = 30 provides sensible defaults, for performance-heavy tests or larger clusters, these might need dynamic adjustments. Consider making them configurable via environment variables or function parameters.


110-116: Add fallback logging.

inClusterConfigClient() returns an error if running outside a cluster with no config. Consider adding more context in the error/log to clarify that the code is attempting an in-cluster fallback.

internal/errors/k8s.go (1)

20-46: Consolidate or standardize error messages and naming conventions.

You’ve introduced several new error variables. While they look consistent, consider verifying that they all follow a common naming pattern (e.g., ErrXxx...) and are used uniformly across the codebase. Also, ensure that capitalization in messages is consistent, such as “Undefined namespace” vs. “Undefined service.”

internal/iter/iter.go (3)

70-78: Consider handling out-of-range errors more gracefully.

The At method could guard against invalid indexes if i exceeds c.num. Currently, it only uses c.size, which might unintentionally allow out-of-bounds access on the conceptual iteration range.


80-94: Check naming consistency for Seq2.

“Seq2” is functional, but you might consider a more descriptive name, like IndexedSeq, to clearly convey its purpose.


145-147: Expose read-only data or copy?

Raw() returns the entire slice. If you need immutability, consider returning a copy to avoid accidental mutations. Otherwise, this is fine.

tests/v2/e2e/config/enums.go (1)

1-113: Consider adding doc comments and usage examples.

Although the string-based enums are clearly defined and appear consistent, adding brief doc comments (e.g., describing when each constant is used) and basic usage examples could make the code more self-explanatory for future maintainers or contributors.

tests/v2/e2e/config/config.go (1)

53-59: Consider validating concurrency values.

Although concurrency is defined, there's no explicit check to ensure a valid (non-zero, non-negative) value. Ensuring concurrency is a positive integer would help prevent possible runtime or logical errors.

You could add a validation step similar to the existing checks for missing fields. For example:

 if s == nil || s.Operations == nil || len(s.Operations) == 0 {
   return nil, errors.Wrap(errors.ErrInvalidConfig, "missing required fields on Strategy")
 }
+s.Concurrency = config.GetActualValueUint64(s.Concurrency)
+if s.Concurrency == 0 {
+  return nil, errors.New("strategy concurrency must be greater than 0")
+}
 s.Name = config.GetActualValue(s.Name)
 s.TimeConfig.Bind()
tests/v2/e2e/crud/index_test.go (1)

32-38: Refine error handling in indexCallBack.

The function always returns true, which may obscure error handling or retry logic in upstream code. Consider returning false or adding distinct return values to indicate error vs. success for clearer handling.

-func indexCallBack[R proto.Message](res R, err error) bool {
-  if err != nil {
-    return true
-  }
+func indexCallBack[R proto.Message](res R, err error) bool {
+  if err != nil {
+    return false
+  }
   log.Infof("response: %v", res)
   return true
 }
tests/v2/e2e/assets/unary_crud.yaml (3)

192-192: Fix typographical error “Inset” → “Insert”.

-      - name: Inset Operation
+      - name: Insert Operation

206-206: Fix minor spelling “Opeation” → “Operation”.

-    name: Parallel Search Opeation (Search, SearchByID, LinearSearch, LinearSearchByID) ...
+    name: Parallel Search Operation (Search, SearchByID, LinearSearch, LinearSearchByID) ...

345-345: Fix minor spelling “Opeation” → “Operation”.

-    name: GetObject/Exists/GetTimestamp Opeation
+    name: GetObject/Exists/GetTimestamp Operation
tests/v2/e2e/crud/crud_test.go (1)

58-63: Provide a fallback or sanity check for empty configuration.

If cfg unexpectedly has any nil or zero-value subfields, the subsequent logic might fail silently. Consider adding checks or default values for critical config fields to reduce risk.

tests/v2/e2e/crud/object_test.go (1)

65-88: Add a default case to handle unexpected plan types.

When plan.Type does not match the listed cases (OpObject, OpTimestamp, OpExists, OpListObject), the code silently does nothing. Consider adding a default case or an explicit error log to prevent overlooked plan types.

tests/v2/e2e/crud/grpc_test.go (1)

192-215: Clarify partial result policy in bidirectional streams.

When an error occurs, the callback returns false to stop receiving. This may discard the remaining vectors. If partial retrieval and logging of errors is acceptable, explicitly document it; otherwise, consider continuing to receive the rest of the stream or failing early.

tests/v2/e2e/crud/strategy_test.go (2)

159-161: Consider terminating on failure to avoid continued test execution.

Currently, tt.Errorf("failed to process operations: %v", err) logs the error without halting execution. If failing the test immediately is preferred when the operations fail, replace Errorf with Fatalf. Otherwise, clarify that continuing tests despite errors is intentional.


240-245: Address the TODO operations or confirm intended omission.

Lines 240 (OpKubernetes) and 245 (OpClient) have placeholder comments indicating future functionality. If these are planned for a subsequent PR, consider adding a clear reference (e.g., an issue link or a timeline). Otherwise, remove these TODOs to avoid confusion or implement them now.

tests/v2/e2e/kubernetes/portforward/portforward.go (2)

174-198: Ensure proper cleanup of multiple watchers to prevent potential resource leaks.

Because this goroutine reinitializes watcher each time the channel closes, the single defer watcher.Stop() statement only applies to the last assigned watcher. Manually stopping the old watchers can help avoid lingering resources if the watch channel repeatedly closes and reopens.


346-353: Consider removing or clarifying commented-out WaitForStatus code.

These lines are commented out, which might confuse future maintainers. If you plan to reintroduce the logic, add a clear comment or TODO. Otherwise, remove them to reduce clutter.

tests/v2/e2e/crud/modification_test.go (1)

133-134: Remove the redundant return after t.Fatal.

Calling t.Fatal() already stops execution of the current test. The explicit return on the following line is unnecessary. While it does not harm functionality, it can be removed for clarity.

func (r *runner) processModification(
  t *testing.T,
  ...
) {
  if plan == nil {
    t.Fatal("modification plan is nil")
-   return
  }
  ...
}
tests/v2/e2e/kubernetes/resources.go (2)

156-156: Fix typographical mismatch in variable naming.

endponts seems like a typo; rename it to endpoints for clarity and naming consistency.

- endponts    = baseClient[*corev1.Endpoints, *corev1.EndpointsList, *applyconfigurationscorev1.EndpointsApplyConfiguration]
+ endpoints   = baseClient[*corev1.Endpoints, *corev1.EndpointsList, *applyconfigurationscorev1.EndpointsApplyConfiguration]

545-560: Graceful handling when Pod template getters/setters are undefined.

Using b.getPodTemplate and b.setPodTemplate is a neat extension capability, but be cautious that returning ErrPodTemplateNotFound might need specialized handling if the resource is always expected to have a valid definition.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d68d37c and d6b336f.

📒 Files selected for processing (135)
  • .gitfiles (14 hunks)
  • .github/workflows/_docker-image.yaml (1 hunks)
  • .github/workflows/_release-pr.yaml (1 hunks)
  • .github/workflows/build-binaries.yaml (1 hunks)
  • .github/workflows/build-protobuf.yaml (1 hunks)
  • .github/workflows/chatops.yaml (5 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/coverage.yaml (1 hunks)
  • .github/workflows/e2e-chaos.yaml (4 hunks)
  • .github/workflows/e2e-code-bench-agent.yaml (2 hunks)
  • .github/workflows/e2e-max-dim.yaml (1 hunks)
  • .github/workflows/e2e-profiling.yaml (1 hunks)
  • .github/workflows/e2e.yaml (8 hunks)
  • .github/workflows/format.yaml (2 hunks)
  • .github/workflows/fossa.yaml (1 hunks)
  • .github/workflows/helm-lint.yaml (3 hunks)
  • .github/workflows/helm.yaml (2 hunks)
  • .github/workflows/reviewdog-k8s.yaml (3 hunks)
  • .github/workflows/reviewdog.yaml (2 hunks)
  • .github/workflows/test-hack.yaml (1 hunks)
  • .github/workflows/unit-test-rust.yaml (1 hunks)
  • .github/workflows/unit-test.yaml (3 hunks)
  • .github/workflows/update-deps.yaml (1 hunks)
  • Makefile (5 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • buf.gen.yaml (1 hunks)
  • cmd/index/job/deletion/main_test.go (1 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/example/client/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/deletion/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • internal/backoff/option.go (0 hunks)
  • internal/client/v1/client/discoverer/discover_test.go (5 hunks)
  • internal/config/benchmark_test.go (4 hunks)
  • internal/config/config.go (2 hunks)
  • internal/config/index_deleter_test.go (1 hunks)
  • internal/core/algorithm/usearch/usearch_test.go (16 hunks)
  • internal/errors/errors.go (1 hunks)
  • internal/errors/errors_test.go (1 hunks)
  • internal/errors/k8s.go (1 hunks)
  • internal/info/info_test.go (17 hunks)
  • internal/iter/iter.go (1 hunks)
  • internal/net/dialer_test.go (1 hunks)
  • internal/net/grpc/errdetails/errdetails.go (6 hunks)
  • internal/net/grpc/metadata_test.go (1 hunks)
  • internal/net/grpc/option_test.go (44 hunks)
  • internal/net/grpc/pool/pool.go (1 hunks)
  • internal/net/grpc/pool/pool_test.go (5 hunks)
  • internal/net/grpc/server_test.go (2 hunks)
  • internal/net/grpc/stream.go (2 hunks)
  • internal/net/grpc/stream_test.go (4 hunks)
  • internal/net/http/client/client.go (1 hunks)
  • internal/net/http/client/client_test.go (1 hunks)
  • internal/net/net.go (1 hunks)
  • internal/net/net_test.go (1 hunks)
  • internal/net/quic/conn_test.go (1 hunks)
  • internal/net/quic/listener_test.go (1 hunks)
  • internal/params/option.go (2 hunks)
  • internal/params/option_test.go (1 hunks)
  • internal/params/params.go (5 hunks)
  • internal/params/params_test.go (1 hunks)
  • internal/rand/rand.go (1 hunks)
  • internal/servers/server/option_test.go (1 hunks)
  • internal/sync/errgroup/group.go (7 hunks)
  • internal/sync/errgroup/group_test.go (16 hunks)
  • internal/test/data/vector/gen.go (0 hunks)
  • internal/test/data/vector/noise/noise.go (1 hunks)
  • internal/test/data/vector/noise/noise_test.go (1 hunks)
  • internal/test/data/vector/noise/option.go (1 hunks)
  • internal/test/data/vector/noise/option_test.go (1 hunks)
  • internal/timeutil/time.go (1 hunks)
  • internal/timeutil/time_test.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (9 hunks)
  • pkg/discoverer/k8s/service/discover_test.go (4 hunks)
  • pkg/gateway/lb/handler/grpc/aggregation_test.go (2 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (2 hunks)
  • pkg/index/job/deletion/config/config_test.go (1 hunks)
  • pkg/index/job/deletion/service/deleter_test.go (1 hunks)
  • pkg/index/job/deletion/service/options_test.go (1 hunks)
  • pkg/index/job/deletion/usecase/deletion_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/insert_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/job_test.go (12 hunks)
  • pkg/tools/benchmark/job/service/object_test.go (8 hunks)
  • pkg/tools/benchmark/job/service/option_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/remove_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/search_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/update_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/upsert_test.go (4 hunks)
  • pkg/tools/cli/loadtest/service/insert_test.go (11 hunks)
  • pkg/tools/cli/loadtest/service/loader.go (1 hunks)
  • pkg/tools/cli/loadtest/service/loader_test.go (13 hunks)
  • pkg/tools/cli/loadtest/service/search_test.go (9 hunks)
  • tests/v2/e2e/assets/rollout.yaml (1 hunks)
  • tests/v2/e2e/assets/unary_crud.yaml (1 hunks)
  • tests/v2/e2e/config/config.go (1 hunks)
  • tests/v2/e2e/config/enums.go (1 hunks)
  • tests/v2/e2e/crud/crud_test.go (1 hunks)
  • tests/v2/e2e/crud/dataset_test.go (1 hunks)
  • tests/v2/e2e/crud/grpc_test.go (1 hunks)
  • tests/v2/e2e/crud/index_test.go (1 hunks)
  • tests/v2/e2e/crud/modification_test.go (1 hunks)
  • tests/v2/e2e/crud/object_test.go (1 hunks)
  • tests/v2/e2e/crud/search_test.go (1 hunks)
  • tests/v2/e2e/crud/strategy_test.go (1 hunks)
  • tests/v2/e2e/hdf5/hdf5.go (1 hunks)
  • tests/v2/e2e/kubernetes/client.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/option.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/portforward.go (1 hunks)
  • tests/v2/e2e/kubernetes/resources.go (1 hunks)
  • tests/v2/e2e/kubernetes/rollout.go (1 hunks)
  • tests/v2/e2e/kubernetes/status.go (1 hunks)
💤 Files with no reviewable changes (2)
  • internal/backoff/option.go
  • internal/test/data/vector/gen.go
🚧 Files skipped from review as they are similar to previous changes (98)
  • dockers/discoverer/k8s/Dockerfile
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/binfmt/Dockerfile
  • .github/workflows/e2e-code-bench-agent.yaml
  • dockers/example/client/Dockerfile
  • .github/workflows/build-protobuf.yaml
  • .github/workflows/e2e-profiling.yaml
  • .github/workflows/fossa.yaml
  • buf.gen.yaml
  • .github/workflows/build-binaries.yaml
  • .github/workflows/unit-test-rust.yaml
  • .github/workflows/chatops.yaml
  • dockers/index/job/creation/Dockerfile
  • pkg/tools/benchmark/job/service/update_test.go
  • .github/workflows/helm.yaml
  • .github/workflows/codeql-analysis.yml
  • dockers/agent/core/agent/Dockerfile
  • internal/rand/rand.go
  • dockers/index/job/correction/Dockerfile
  • Makefile.d/e2e.mk
  • .github/workflows/e2e-chaos.yaml
  • .github/workflows/format.yaml
  • pkg/tools/benchmark/job/service/insert_test.go
  • dockers/agent/sidecar/Dockerfile
  • tests/v2/e2e/assets/rollout.yaml
  • .github/workflows/_release-pr.yaml
  • dockers/index/operator/Dockerfile
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/tools/cli/loadtest/Dockerfile
  • .github/workflows/e2e-max-dim.yaml
  • .github/workflows/test-hack.yaml
  • dockers/tools/benchmark/operator/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • dockers/operator/helm/Dockerfile
  • cmd/index/job/deletion/main_test.go
  • internal/errors/errors.go
  • dockers/tools/benchmark/job/Dockerfile
  • .github/workflows/reviewdog.yaml
  • pkg/tools/benchmark/job/service/upsert_test.go
  • dockers/ci/base/Dockerfile
  • .github/workflows/coverage.yaml
  • .github/workflows/update-deps.yaml
  • .github/workflows/unit-test.yaml
  • pkg/tools/cli/loadtest/service/loader.go
  • dockers/gateway/lb/Dockerfile
  • dockers/buildbase/Dockerfile
  • tests/v2/e2e/crud/dataset_test.go
  • pkg/tools/benchmark/job/service/search_test.go
  • dockers/index/job/deletion/Dockerfile
  • .github/workflows/helm-lint.yaml
  • .github/workflows/reviewdog-k8s.yaml
  • dockers/agent/core/faiss/Dockerfile
  • internal/net/grpc/errdetails/errdetails.go
  • internal/net/net.go
  • .github/workflows/_docker-image.yaml
  • Makefile.d/functions.mk
  • internal/net/grpc/pool/pool.go
  • pkg/tools/benchmark/job/service/remove_test.go
  • dockers/dev/Dockerfile
  • dockers/index/job/save/Dockerfile
  • pkg/index/job/deletion/config/config_test.go
  • dockers/buildkit/Dockerfile
  • internal/net/quic/conn_test.go
  • internal/timeutil/time.go
  • dockers/manager/index/Dockerfile
  • pkg/tools/benchmark/job/service/object_test.go
  • internal/config/index_deleter_test.go
  • internal/test/data/vector/noise/option.go
  • internal/errors/errors_test.go
  • pkg/tools/benchmark/job/service/job_test.go
  • .github/workflows/e2e.yaml
  • internal/net/grpc/stream.go
  • internal/net/http/client/client.go
  • internal/client/v1/client/discoverer/discover_test.go
  • internal/params/params_test.go
  • internal/net/grpc/stream_test.go
  • dockers/gateway/filter/Dockerfile
  • pkg/index/job/deletion/service/options_test.go
  • pkg/agent/core/ngt/service/ngt.go
  • internal/core/algorithm/usearch/usearch_test.go
  • pkg/agent/core/ngt/service/ngt_test.go
  • internal/net/dialer_test.go
  • internal/sync/errgroup/group.go
  • dockers/agent/core/ngt/Dockerfile
  • internal/net/grpc/server_test.go
  • internal/params/params.go
  • pkg/tools/cli/loadtest/service/search_test.go
  • pkg/gateway/lb/handler/grpc/handler_test.go
  • pkg/discoverer/k8s/service/discover_test.go
  • tests/v2/e2e/kubernetes/rollout.go
  • Makefile
  • pkg/gateway/lb/handler/grpc/aggregation_test.go
  • pkg/tools/cli/loadtest/service/loader_test.go
  • internal/config/benchmark_test.go
  • tests/v2/e2e/hdf5/hdf5.go
  • internal/config/config.go
  • tests/v2/e2e/kubernetes/portforward/option.go
  • pkg/index/job/deletion/service/deleter_test.go
🧰 Additional context used
🧠 Learnings (1)
.gitfiles (1)
Learnt from: datelier
PR: vdaas/vald#2807
File: rust/bin/agent/src/handler/object.rs:36-38
Timestamp: 2025-03-15T12:24:12.647Z
Learning: In Rust code for Vald handlers, avoid using unwrap() on Option types. Instead, handle None values explicitly by returning appropriate error statuses to maintain robustness.
🪛 YAMLlint (1.35.1)
tests/v2/e2e/assets/unary_crud.yaml

[error] 204-204: duplication of key "name" in mapping

(key-duplicates)

⏰ Context from checks skipped due to timeout of 90000ms (190)
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: Run tests for hack packages
  • GitHub Check: coverage
  • GitHub Check: CodeQL
  • GitHub Check: check-format-diff
  • GitHub Check: runner / go build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
🔇 Additional comments (43)
internal/net/quic/listener_test.go (1)

1-196: Test skeletons should be implemented or removed

The file contains well-structured test skeletons for QUIC listener functionality, but they're entirely commented out with an explicit "NOT IMPLEMENTED BELOW" note. While the structure follows good testing practices with proper setup for test cases, check functions, and leak detection, they lack actual implementation.

Consider either:

  1. Implementing at least basic test cases to provide real test coverage, or
  2. Removing these commented-out skeletons until they're ready to be implemented

Commented-out code in the codebase can lead to confusion and maintenance challenges over time.

internal/net/http/client/client_test.go (1)

215-305: Implement test cases for the NewWithTransport function.

The test structure is well-defined but currently commented out and lacks actual test cases. Since NewWithTransport appears to be part of the public API, proper test coverage is essential to ensure functionality and prevent regressions.

Consider implementing the following test cases:

  1. Basic test with default transport
  2. Test with custom transport implementation
  3. Test with custom transport and additional options
  4. Error handling test for invalid options

Additionally, note that:

  • Instead of using reflect.DeepEqual, consider utilizing the custom comparator functions defined in the file (like clientComparator)
  • The signature of beforeFunc and afterFunc includes *testing.T which differs from the TestNew implementation
pkg/tools/benchmark/job/service/option_test.go (1)

1633-1716: Consider implementing actual test cases to verify WithMetadata functionality

The newly added TestWithMetadata function has the appropriate structure, but it only contains TODOs and commented placeholder templates without any actual test cases to verify the functionality.

Based on the previous review comment that was marked as fixed in commit 06cc38f, please implement actual test cases to verify the WithMetadata functionality. Consider testing with:

  1. Nil map
  2. Empty map
  3. Populated map
  4. Map with special characters
 	tests := []test{
-		// TODO test cases
-		/*
-		   {
-		       name: "test_case_1",
-		       args: args {
-		           m:nil,
-		       },
-		       want: want{},
-		       checkFunc: defaultCheckFunc,
-		       beforeFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		       afterFunc: func(t *testing.T, args args) {
-		           t.Helper()
-		       },
-		   },
-		*/
+		{
+			name: "nil map",
+			args: args{
+				m: nil,
+			},
+			want: want{
+				want: WithMetadata(nil),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "empty map",
+			args: args{
+				m: map[string]string{},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
+		{
+			name: "populated map",
+			args: args{
+				m: map[string]string{"key1": "value1", "key2": "value2"},
+			},
+			want: want{
+				want: WithMetadata(map[string]string{"key1": "value1", "key2": "value2"}),
+			},
+			checkFunc: defaultCheckFunc,
+		},
internal/net/net_test.go (2)

1201-1284: Implement test cases for IsUDP function

The test function is well-structured but currently commented out and lacks actual test cases. Network type checking functions are critical for reliability and deserve thorough testing.

Consider adding test cases for:

  1. Standard network types (e.g., "udp")
  2. Variant types (e.g., "udp4", "udp6")
  3. Case sensitivity (e.g., "UDP", "Udp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings

1286-1369: Implement test cases for IsTCP function

Similar to the TestIsUDP function, this test is well-structured but currently commented out and lacks actual test cases.

Consider adding test cases for:

  1. Standard network types (e.g., "tcp")
  2. Variant types (e.g., "tcp4", "tcp6")
  3. Case sensitivity (e.g., "TCP", "Tcp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings
internal/params/option.go (5)

20-23: Added imports look good

The additions of os and filepath are necessary for the new WithName functionality that uses the executable name.


27-36: Good initialization of default options

Setting the default parser name to the executable's base name (filepath.Base(os.Args[0])) is a sensible default that improves user experience. Also adding WithOverrideDefault(false) as a default option maintains backward compatibility.


38-45: Proper implementation of WithName

The implementation correctly checks for empty name values and only assigns non-empty names, which is a good defensive programming practice.


89-94: Clean implementation of WithOverrideDefault

This function is implemented correctly, following the established pattern for option functions.


96-109: Well-implemented WithArgumentFilters with proper null checks

The implementation handles edge cases well:

  1. Returns early if no filters are provided
  2. Initializes the filters slice if it's nil
  3. Properly appends new filters to existing ones

This approach is robust and prevents null pointer exceptions.

internal/info/info_test.go (2)

341-343: Field change appropriately propagated to test structs.

The valdReplacer *strings.Replacer field has been consistently added to the fields struct, which aligns with changes in the core implementation. This field is properly initialized to nil in all test cases.


996-1094: Implement test cases for TestStackTrace_ShortString.

The new test function for ShortString is structured but lacks actual test cases. As this appears to be testing a new method, it's important to verify its functionality with various input scenarios.

Consider adding test cases that:

  1. Test with various URL, FuncName, File, and Line combinations
  2. Test edge cases like empty fields
  3. Verify the correct formatting of the short string output
pkg/tools/cli/loadtest/service/insert_test.go (6)

24-24: Consistent pointer type change for return values

The change from func() any to func() *any returns a pointer to the data instead of the value directly. This aligns with Go's common pattern for reducing data copying overhead and allows for nil returns to indicate absence.


32-32: Function signature update for consistency

The change in checkFunc and defaultCheckFunc parameter types from func() any to func() *any maintains signature consistency with the updated want.wantF field. This change ensures proper type compatibility when comparing expected and actual values.

Also applies to: 36-36


119-119: Consistent pointer type change for objectVectorProvider test

The change from value to pointer types in the objectVectorProvider test functions maintains consistency with the pattern established in the previous test function. This ensures a uniform approach to return value handling across all test cases.

Also applies to: 126-126, 130-130


209-209: Consistent pointer type change for objectVectorsProvider test

The same consistent pattern of changing from value to pointer types is applied to the objectVectorsProvider test, maintaining a uniform interface across all test functions in the file.

Also applies to: 216-216, 220-220


305-305: Improved naming clarity with sendDataProvider

The variable renaming from dataProvider to sendDataProvider better describes the purpose of this function - it provides data that will be sent to the service. This improves code readability and clarifies the variable's role in the test process.

Also applies to: 414-414, 437-437, 546-546


344-344: Consistent variable renaming in test examples

The variable renaming is consistently applied to the example test cases as well, ensuring code uniformity throughout the file. Even though these tests are currently commented out, maintaining consistency will help when they are implemented.

Also applies to: 373-373, 476-476, 505-505

internal/net/grpc/option_test.go (1)

2488-2488: Updated parameter in WithDialer function.

The change to include a network string parameter in the WithDialer function provides more flexibility for testing different network types.

internal/test/data/vector/noise/noise.go (1)

180-181: Verify Go version for slices.Clone.

slices.Clone is available in Go 1.21+ only. Ensure that the build environment and documentation specify Go 1.21 or newer to avoid compilation issues.

pkg/index/job/deletion/usecase/deletion_test.go (1)

74-74:

❓ Verification inconclusive

Verify correct usage of goleak.

The test uses goleak.VerifyNone(tt, goleak.IgnoreCurrent()) to ensure no goroutine leaks. Make sure the goleak package is properly imported and that this is the correct usage for your specific testing scenario.

You may need to add additional ignore options if certain background goroutines are expected. Consider running the following check to understand how to properly use goleak in your tests:

Also applies to: 182-182, 301-301, 416-416, 531-531, 646-646


🌐 Web query:

Best practices for using go.uber.org/goleak in Go tests

💡 Result:

To effectively detect goroutine leaks in Go tests using go.uber.org/goleak, follow these best practices:


Use VerifyTestMain for Package-Level Checks

  • Integrate with TestMain to check for leaks after all tests in a package complete. This is critical for parallel tests and avoids false positives from lingering background goroutines:
    func TestMain(m *testing.M) {
        goleak.VerifyTestMain(m)
    }
    This ensures leaks are detected once after all tests finish, even when using t.Parallel()[4][7].

Targeted Leak Checks with VerifyNone

  • For individual tests, use defer goleak.VerifyNone(t) to check for leaks specific to that test:
    func TestMyFunction(t *testing.T) {
        defer goleak.VerifyNone(t)
        // Test logic here
    }
    Avoid combining VerifyNone with t.Parallel(), as it may incorrectly flag goroutines from other parallel tests[4][7].

Exclude Known Leaks

  • Ignore unavoidable leaks from third-party dependencies using IgnoreTopFunction or IgnoreAnyFunction:
    func TestMain(m *testing.M) {
        opts := []goleak.Option{
            goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
        }
        goleak.VerifyTestMain(m, opts...)
    }
    This prevents false positives from libraries like OpenCensus or database pools[2][7].

Structure Code for Leak Prevention

  • Avoid global goroutines: Tie goroutines to struct instances with explicit Stop()/Close() methods to ensure cleanup[5].
  • Use synchronization primitives: Leverage channels or sync.WaitGroup to ensure goroutines exit predictably[1][5].

Debugging Leaks

  • Isolate failing tests using a script to run tests individually and identify which one leaks[4][7]:
    go test -c -o tests
    for test in $(go test -list . | grep -E "^(Test|Example)"); do
        ./tests -test.run "^$test\$" &>/dev/null || echo "$test failed"
    done

Key Pitfalls to Avoid

  • Missing m.Run() in TestMain: Ensure goleak.VerifyTestMain(m) calls m.Run() internally. Commenting it out can disable all tests[3][8].
  • Unmanaged goroutines: Never start goroutines without a clear exit strategy (e.g., in init() or package-level variables)[2][5].

By combining these strategies, you can systematically eliminate leaks while minimizing noise from external dependencies. For large codebases, gradually introduce goleak checks and maintain a centralized list of ignored functions to balance rigor with practicality[2][5][7].

Citations:


Action: Verify and Confirm Correct Usage of goleak

  • In pkg/index/job/deletion/usecase/deletion_test.go (lines 74, 182, 301, 416, 531, and 646), review the usage of defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()).
  • Verify that the package is imported correctly and that the testing object (tt) is the intended one (typically named t in test functions).
  • Based on best practices:
    • For individual tests that aren’t run in parallel, using defer goleak.VerifyNone(t) without additional options is preferred.
    • If the test intentionally ignores goroutines that were running prior to the test (or other non-leak background routines), then using an ignore option (like goleak.IgnoreCurrent()) can be acceptable—but ensure no true leaks are masked.
  • If certain background goroutines are expected (such as those initiated by third-party dependencies), consider adding further ignore options (for example, via goleak.IgnoreTopFunction) as needed.
  • Confirm that this approach aligns with the specific needs of your testing scenario and that no unintended goroutine leaks are being overlooked.
internal/net/grpc/pool/pool_test.go (1)

3009-3010: Confirm multiple call scenarios.

Consider adding a second call to p.Get(...) with different context values or a repeated invocation to confirm that the returned connection and bool remain valid across multiple retrievals.

tests/v2/e2e/kubernetes/client.go (1)

118-124: Interface usage is clear.

The getter methods GetClientSet() and GetRESRConfig() are straightforward and follow best practices.

internal/iter/iter.go (3)

53-59: Return a no-op iterator instead of nil.

Returning nil for an empty slice can lead to panics if the iterator methods are called. A past review suggested returning a non-nil, no-op cycle. If that remains relevant, you might want to implement it for safer code.


132-143: Confirm short-circuit on fn return.

ForEach correctly exits if fn returns false. Just ensure that any partial updates or side effects are rolled back or handled carefully in your usage.


149-152: Len() usage matches design.

Returning c.num for the iterator’s length is intuitive but ensure developers realize it might differ from the slice’s original length if they configure num to be larger.

.gitfiles (1)

126-126: Verify new Rust workflow configuration.

A new workflow file (.github/workflows/unit-test-rust.yaml) is added to handle Rust unit tests. Ensure it aligns with existing CI workflows (e.g., environment setup, caching, cargo commands) and is properly triggered to capture potential regressions in Rust code.

tests/v2/e2e/kubernetes/status.go (1)

320-326: Refine DaemonSet condition checks.

Using appsv1.DaemonSetConditionType("") as a placeholder misses real condition types like DaemonSetReplicaFailure. Enumerating known conditions or checking for ReplicaFailure can help detect issues earlier.

tests/v2/e2e/config/config.go (1)

188-196: Add validation for metadata inputs.

This comment is repeated from an earlier discussion. The metadata is split and inserted into the Metadata map without length checks, restricted characters checks, or whitespace trimming. Consider adding defensive checks or trimming to avoid potential misuse or unexpected values.

tests/v2/e2e/crud/index_test.go (1)

40-62: Looks good for indexing operations.

The switch statement logically handles each supported index operation, and the default case properly flags unsupported operations. This appears consistent with the rest of the codebase.

tests/v2/e2e/crud/crud_test.go (1)

38-56: Test skipping logic is valid.

Handling -short mode by immediately exiting is a neat solution to keep e2e tests from running in quick test scenarios. This helps avoid long-running tests when a developer only wants to run short ones.

tests/v2/e2e/crud/object_test.go (1)

102-114: Consider partial result handling when receiving stream errors.

Currently, you break from the loop on encountering an unexpected error, discarding subsequent vectors. If partial retrieval is acceptable, consider continuing the loop. Otherwise, explicitly indicate that partial data is invalid.

tests/v2/e2e/crud/grpc_test.go (1)

109-125: Surface errors from goroutines to ensure the test sees any failures.

In the unary function’s goroutines, errors from single() are only reported via t.Errorf. The test will continue even if there are critical issues. Consider returning errors to eg.Wait() so that any failure will cause the test to fail more explicitly. This approach helps catch partial failures.

tests/v2/e2e/crud/strategy_test.go (1)

153-155: Surface errors in processOperation to ensure fail-fast behavior [duplicate of a past suggestion].

This method unconditionally returns nil, so errors within processOperation cannot be propagated to the errgroup, causing tests to continue even if an operation fails. Consider returning errors to the errgroup to fail fast if that aligns with your test strategy.

tests/v2/e2e/crud/modification_test.go (1)

142-169: Double-check leftover batches in multiple-operation mode.

When using the "multiple" mode (lines referencing MultiInsert, MultiUpdate, MultiUpsert, MultiRemove), confirm that any final partial batch is handled and not silently discarded if it doesn’t align with the configured BulkSize.

tests/v2/e2e/crud/search_test.go (5)

39-56: Handle zero-length neighbors to avoid division by zero.

Currently, recall() divides by len(neighbors) without verifying if neighbors is empty. This can lead to a NaN or Inf result.


74-75: Validate slice boundaries in calculateRecall.

Using neighbors[:len(topKIDs)] risks an out-of-bounds slice when len(topKIDs) exceeds the length of neighbors. Kindly add boundary checks to prevent a potential panic.


175-215: Add explicit handling for unknown operation modes in processSearch.

The nested switch covers known modes (OperationUnary, OperationMultiple, OperationStream) but lacks a default case to handle unrecognized modes. Consider returning an error or logging a warning to prevent silent skips.


182-183: Address leftover request handling in multiSearch calls.

When the test’s plan.BulkSize does not evenly divide the dataset, there is a risk that remaining requests aren’t processed. Verify that any leftover vectors are handled after the main loop to avoid dropped requests.


119-125: Overall search logic structure looks solid.

The approach to building request objects and computing recall provides good separation of concerns. This setup should facilitate robust E2E coverage.

tests/v2/e2e/kubernetes/resources.go (3)

307-314: Avoid potential panic by checking b before locking.

Locking with b.mu.RLock() when b might be nil can lead to a runtime panic. Consider checking if b == nil before acquiring the lock to prevent crashes in all methods.


316-326: Check for a nil interface before acquiring b.mu.RLock().

Several methods (e.g., Create) call b.mu.RLock() first, then check whether b.Interface is nil. If b itself is nil, locking triggers a panic. Move the check for b == nil outside the lock.


62-65: Interfaces are well-structured for flexible resource management.

The separation of resource interfaces (ResourceInterface, ExtResourceInterface, ScaleInterface) fosters clear contracts and maintainability.

Comment on lines +18 to +101
// func TestNewMetadata(t *testing.T) {
// type args struct {
// m map[string]string
// }
// type want struct {
// want MD
// }
// type test struct {
// name string
// args args
// want want
// checkFunc func(want, MD) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, got MD) error {
// if !reflect.DeepEqual(got, w.want) {
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", got, w.want)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// m:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// m:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
//
// got := NewMetadata(test.args.m)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Implement or explain the commented test structure.

This test function TestNewMetadata follows the project's test pattern with proper argument definitions, check functions, and parallel execution setup, but it's entirely commented out and not contributing to test coverage. In a PR focused on enhancing the testing infrastructure, leaving commented-out tests undermines that objective.

Either:

  1. Uncomment and implement concrete test cases to validate the NewMetadata function, or
  2. Add a clear explanation comment about why this test template exists in a commented-out state

This issue was previously noted in a prior review but remains unaddressed.

Comment on lines +116 to +130
// Indexes returns an iterator sequence (iter.Seq) that yields the indexes.
func (c cycle[_, _]) Indexes(ctx context.Context) iter.Seq[uint64] {
return func(yield func(uint64) bool) {
for i := uint64(0); i < c.num; i++ {
select {
case <-ctx.Done():
return
default:
}
if !yield(i) {
return
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Ensure indices yield is limited.

Indexes iterates over c.num; a check to ensure c.num <= c.size may be needed if you only want up to the original slice length. Otherwise, you could yield indexes that repeatedly cycle for a large num.

Comment on lines +83 to +114
func WaitForStatus[T Object, L ObjectList, C NamedObject, I ResourceInterface[T, L, C]](
ctx context.Context, client I, name string, statuses ...ResourceStatus,
) (obj T, matched bool, err error) {
if !slices.ContainsFunc(PossibleStatuses(obj), func(st ResourceStatus) bool {
return slices.Contains(statuses, st)
}) {
return obj, false, errors.ErrStatusPatternNeverMatched
}

ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return obj, false, ctx.Err()
case <-ticker.C:
obj, err = client.Get(ctx, name, metav1.GetOptions{})
if err != nil {
return obj, false, err
}
status, info, err := CheckResourceState(obj)
if err != nil {
return obj, false, errors.Wrap(err, info)
}
for _, st := range statuses {
if st == status {
return obj, true, nil
}
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Prevent indefinite loop in WaitForStatus.

This loop runs indefinitely until context cancellation if the resource never enters one of the specified statuses. Consider adding a default timeout or exposing a configurable polling interval so tests don't hang indefinitely if the resource fails to converge.

Comment on lines +33 to +36
var (
cfg *config.Data
ds *hdf5.Dataset
)
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Avoid global shared state unless absolutely necessary.

Global variables cfg and ds may introduce side effects across multiple tests. If concurrent tests or parallel runs share these variables, tests might influence one another. Where possible, consider struct-based test setups or passing these objects explicitly for clearer test boundaries.

@kpango kpango force-pushed the refactor/test-e2e/add-v2-e2e-strategic-testing branch from d6b336f to 18682c3 Compare March 15, 2025 15:02
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🔭 Outside diff range comments (1)
internal/sync/errgroup/group_test.go (1)

946-1057: 🛠️ Refactor suggestion

Test refactored from TryGo to exec method.

The test structure has been updated to test the exec method instead of TryGo. This includes appropriate changes to the field types (using atomic.Int64 for limit) and simplifying the want type structure.

However, the test is still commented out with TODO placeholders instead of actual test cases, preventing proper test coverage of the exec method.

Uncomment this test and implement concrete test cases to validate the behavior of the exec method. This is especially important since it appears to be replacing or supplementing the TryGo functionality.

♻️ Duplicate comments (7)
internal/net/http/client/client_test.go (1)

214-305: 🛠️ Refactor suggestion

Implement test cases for the NewWithTransport function.

The test structure for TestNewWithTransport is well-defined, but it's currently commented out and lacks actual test cases. Since this function is part of the public API testing for the HTTP client, implementing proper test cases is important to ensure reliability of the E2E testing framework.

Consider implementing these test cases:

  1. Basic test with default transport
  2. Test with custom transport options
  3. Test with a non-*http.Transport implementation
  4. Error handling test for invalid options
{
    name: "success with default transport",
    args: args{
        rt: http.DefaultTransport,
        opts: nil,
    },
    want: want{
        want: &http.Client{
            Transport: http.DefaultTransport,
        },
        err: nil,
    },
},
{
    name: "success with custom options",
    args: args{
        rt: http.DefaultTransport,
        opts: []Option{
            WithTimeout(5 * time.Second),
        },
    },
    want: want{
        want: &http.Client{
            Transport: http.DefaultTransport,
            Timeout: 5 * time.Second,
        },
        err: nil,
    },
},
{
    name: "error with invalid option",
    args: args{
        rt: http.DefaultTransport,
        opts: []Option{
            func(*transport) error {
                return errors.NewErrCriticalOption("test", "invalid")
            },
        },
    },
    want: want{
        want: nil,
        err: errors.NewErrCriticalOption("test", "invalid"),
    },
}
pkg/tools/benchmark/job/service/option_test.go (1)

1633-1716: 🛠️ Refactor suggestion

Implement test cases for the WithMetadata function.

The test structure for TestWithMetadata is well-defined, but it's currently commented out and lacks actual test cases. This function is important for testing metadata handling in the benchmark job service.

While a previous review indicated this was fixed in commit 06cc38f, the test implementation is still commented out in this PR. Implement the suggested test cases:

  1. Test with nil map
  2. Test with empty map
  3. Test with populated map
  4. Test with map containing special characters
{
    name: "nil map",
    args: args{
        m: nil,
    },
    want: want{
        want: WithMetadata(nil),
    },
},
{
    name: "empty map",
    args: args{
        m: map[string]string{},
    },
    want: want{
        want: WithMetadata(map[string]string{}),
    },
},
{
    name: "populated map",
    args: args{
        m: map[string]string{"key1": "value1", "key2": "value2"},
    },
    want: want{
        want: WithMetadata(map[string]string{"key1": "value1", "key2": "value2"}),
    }
},
{
    name: "map with special characters",
    args: args{
        m: map[string]string{"special-key": "value@123", "key-with-spaces": "value with spaces"},
    },
    want: want{
        want: WithMetadata(map[string]string{"special-key": "value@123", "key-with-spaces": "value with spaces"}),
    }
}
internal/params/params_test.go (2)

453-570: 🛠️ Refactor suggestion

Implement test cases for the parser.Restore() method.

The test structure for Test_parser_Restore is well-defined, but it's currently commented out and lacks actual test cases. Testing state restoration is important for ensuring correct behavior of the parser.

Implement test cases that cover:

  1. Basic restoration with default state
  2. Restoration after various modifications
  3. Edge cases with nil or invalid fields

For example:

{
    name: "restore default state successfully",
    fields: fields{
        overrideDefault: true,
        name: "test-parser",
        filters: []func(string) bool{func(s string) bool { return s != "" }},
        // Initialize other fields appropriately
    },
    want: want{}, // Empty since we're just verifying the method runs without errors
},
{
    name: "restore after modifications",
    fields: fields{
        overrideDefault: false,
        name: "modified-parser",
        filters: []func(string) bool{},
        // Set modified values for other fields
    },
    want: want{},
    beforeFunc: func(t *testing.T) {
        t.Helper()
        // Setup any state needed before the test
    },
    afterFunc: func(t *testing.T) {
        t.Helper()
        // Verify parser state after restoration
    }
}

572-689: 🛠️ Refactor suggestion

Implement test cases for the parser.Override() method.

The test structure for Test_parser_Override is well-defined, but it's currently commented out and lacks actual test cases. Testing the override functionality is important for ensuring correct behavior of the parser.

Implement test cases that cover:

  1. Basic override with simple values
  2. Complex overrides with various field combinations
  3. Edge cases with nil or invalid fields

For example:

{
    name: "override with basic values",
    fields: fields{
        overrideDefault: false,
        name: "original-parser",
        // Initialize other fields appropriately
    },
    want: want{},
    beforeFunc: func(t *testing.T) {
        t.Helper()
        // Setup original state
    },
    afterFunc: func(t *testing.T) {
        t.Helper()
        // Verify fields were properly overridden
    }
},
{
    name: "override with complex field combinations",
    fields: fields{
        overrideDefault: true,
        name: "complex-parser",
        filters: []func(string) bool{func(s string) bool { return len(s) > 0 }},
        // Set complex values for other fields
    },
    want: want{},
    // Add appropriate before/after functions to verify state
}
internal/timeutil/time_test.go (2)

185-263: 🛠️ Refactor suggestion

Implement test cases for TestDurationString_Duration.

The test structure is well-defined, but it's currently commented out and lacks actual test cases. Proper time handling is critical for the reliability of the E2E testing framework.

Implement test cases covering:

  1. Valid duration strings with various time units (ns, ms, s, m, h)
  2. Empty strings
  3. Invalid formats
  4. Edge cases

For example:

{
    name: "valid duration - seconds",
    d: DurationString("5s"),
    want: want{
        want: 5 * time.Second,
        err: nil,
    },
},
{
    name: "valid duration - minutes",
    d: DurationString("2m"),
    want: want{
        want: 2 * time.Minute,
        err: nil,
    },
},
{
    name: "invalid duration format",
    d: DurationString("invalid"),
    want: want{
        want: 0,
        err: errors.New("time: invalid duration \"invalid\""),
    },
},
{
    name: "empty string",
    d: DurationString(""),
    want: want{
        want: 0,
        err: nil,
    },
}

265-349: 🛠️ Refactor suggestion

Implement test cases for TestDurationString_DurationWithDefault.

Similar to the Duration test, this function needs actual test cases to verify default value handling logic.

Implement test cases covering:

  1. When the duration string is valid and should override the default
  2. When the duration string is invalid and should fall back to the default
  3. Edge cases with various default values

For example:

{
    name: "valid duration overrides default",
    d: DurationString("10s"),
    args: args{
        def: 5 * time.Minute,
    },
    want: want{
        want: 10 * time.Second,
    },
},
{
    name: "invalid duration falls back to default",
    d: DurationString("invalid"),
    args: args{
        def: 30 * time.Second,
    },
    want: want{
        want: 30 * time.Second,
    },
},
{
    name: "empty string falls back to default",
    d: DurationString(""),
    args: args{
        def: time.Hour,
    },
    want: want{
        want: time.Hour,
    },
}
pkg/index/job/deletion/usecase/deletion_test.go (1)

1-2: ⚠️ Potential issue

Missing import statements will prevent compilation.

The test file has a package declaration but is missing necessary import statements for packages like "context", "testing", "reflect", "errors", "github.com/vdaas/vald/internal/errors", and other dependencies required by the test functions.

Add the appropriate import statements to make the test file compilable when the tests are uncommented:

package usecase

+import (
+	"context"
+	"reflect"
+	"testing"
+
+	"github.com/vdaas/vald/internal/errors"
+	"github.com/vdaas/vald/internal/test/goleak"
+	"golang.org/x/sync/errgroup"
+	// Add other necessary imports for config, observability, etc.
+)
🧹 Nitpick comments (21)
internal/params/params.go (1)

135-145: Document thread-safety considerations for Restore and Override methods

The new Restore() and Override() methods modify global state by changing flag.CommandLine, which could lead to race conditions if multiple parser instances are used concurrently.

Add documentation comments that explicitly warn about concurrent usage, similar to:

+// Restore resets the global flag.CommandLine to the original defaults.
+// Note: This modifies global state and should not be used concurrently with other parsers.
 func (p *parser) Restore() {
 	if p.defaults != nil {
 		flag.CommandLine = p.defaults
 	}
 }

+// Override replaces the global flag.CommandLine with this parser's FlagSet.
+// Note: This modifies global state and should not be used concurrently with other parsers.
 func (p *parser) Override() {
 	if p.f != nil {
 		flag.CommandLine = p.f
 	}
 }
internal/errors/k8s.go (1)

20-46: Ensure consistent error message style.

Some error messages start with uppercase while others use lowercase. Maintaining a uniform style (e.g., all lowercase) for error messages helps with readability and consistency.

internal/sync/errgroup/group.go (1)

141-153: Reevaluate the need for runtime.Gosched() on error.

Calling runtime.Gosched() upon encountering an error can help yield the processor, but it may be unnecessary overhead. Consider whether it’s strictly needed or to remove it for a simpler flow.

tests/v2/e2e/config/enums.go (4)

23-52: Consider adding documentation or comments for each operation type.

While the OperationType constants are self-explanatory, inline comments or docstrings would improve clarity when the codebase grows, helping others understand the context behind each operation's usage.


54-76: Verify usage of status codes or consider an enum pattern.

Defining status codes as strings in StatusCode is valid, but ensure they are consistently referenced throughout the codebase. Alternatively, consider using typed constants (e.g., iota) or enumerations that leverage compile-time checks, if that aligns better with your usage patterns.


78-85: Document the purpose of OperationMode.

The modes—unary, stream, multiple, and other—may benefit from a brief explanation, so future maintainers understand when each mode applies and if “other” is a placeholder for future expansion or if it requires additional handling.


87-112: Ensure Kubernetes enums are consistently used and tested.

New enumerations like KubernetesAction and KubernetesKind appear straightforward. If you parse them from user input or test configuration, confirm there is proper validation or fallback logic to avoid invalid values. Unit tests for these enums would help catch incorrect usage.

.gitfiles (1)

161-178: Check for documentation completeness.

A host of new documentation files (apis/docs/*) is added. Verify that these files are included in the build or documentation pipeline if applicable, and remove any placeholders that aren’t yet needed to avoid confusion.

tests/v2/e2e/kubernetes/status.go (3)

76-114: Consider adding a default timeout to prevent indefinite waits.

WaitForStatus loops until the desired status is reached or the context is canceled. Relying solely on context cancellation may lead to very long waits if users forget to apply a timeout. Providing a default maximum wait or requiring a context deadline can prevent potential hanging tests.


303-341: Clarify the DaemonSet condition check.

This implementation checks for a condition type set to an empty string (appsv1.DaemonSetConditionType("")). If this placeholder is intentional, consider enumerating official DaemonSet conditions like ReplicaFailure instead. Using a well-defined condition ensures more reliable checks and a clearer code path.


402-451: Extend readiness checks for Pods if needed.

Evaluating a pod’s overall readiness by just the PodReady condition is sufficient in many scenarios, but if additional readiness checks (e.g., all containers passing readiness probes) are critical, ensure you expand this logic. This can be especially relevant if pods contain multiple containers.

tests/v2/e2e/config/config.go (1)

265-271: Consider extending rate-limiter logic.

When BaseConfig.QPS is positive, a simple rate limiter is created. For large or dynamic QPS needs, you may need an adaptive or token-bucket mechanism.

internal/net/grpc/option_test.go (1)

531-615: Implement or clean up commented-out tests.

This file contains multiple test stubs commented out entirely. It’s important to either implement them for coverage or remove them. Leaving them commented can cause confusion and reduce maintainability.

Also applies to: 617-700, 702-3176

tests/v2/e2e/kubernetes/client.go (1)

38-38: Rename the method to avoid confusion.

Consider renaming GetRESRConfig to GetRESTConfig to align with the underlying *rest.Config struct and avoid minor confusion:

-func (c *client) GetRESRConfig() *rest.Config {
+func (c *client) GetRESTConfig() *rest.Config {
tests/v2/e2e/crud/grpc_test.go (1)

118-122: Propagate errors from goroutines to ensure test failures.

Currently, each goroutine always returns nil, meaning even if single() encounters critical errors, they won't be collected by errgroup.Wait(). Refactor the code to propagate errors so that the test fails when a goroutine fails:

eg.Go(func() error {
-   single(t, ctx, idx, plan, newReq(t, idx, strconv.FormatUint(idx, 10), vec, plan), call, callback...)
-   return nil
+   if err := callSingle(t, ctx, idx, plan, newReq(t, idx, strconv.FormatUint(idx, 10), vec, plan), call, callback...); err != nil {
+       return err
+   }
+   return nil
})

Where callSingle could be a new variant of single() that returns the encountered error instead of swallowing it.

tests/v2/e2e/kubernetes/portforward/option.go (2)

33-37: Allow customizable default options.

Currently, defaultOptions is hard-coded to specific defaults (WithHTTPClient, WithBackoff, WithNamespace). Consider exposing a mechanism to let advanced users override or remove these defaults if they need custom setups.

 var defaultOptions = []Option{
-	WithHTTPClient(http.DefaultClient),
-	WithBackoff(backoff.New()),
-	WithNamespace("default"),
+	// Possibly allow a user-defined default or a function call to set these at runtime.
 }

79-85: Validate address slice content.

While you check if addrs != nil, there is no validation to ensure that the passed-in addresses are non-empty or valid format. This can lead to unexpected connection failures. Consider checking each address for correctness or at least ensuring the slice is not empty.

tests/v2/e2e/crud/strategy_test.go (1)

139-164: Consider returning errors to fail fast within concurrency.

You launch each operation via errgroup, but the inner function always returns nil. If r.processOperation encounters a critical error, returning it here would help the test fail quickly instead of continuing further operations on faulty data.

eg.Go(func() error {
-    r.processOperation(ttt, egctx, i, op)
-    return nil
+    return r.processOperation(ttt, egctx, i, op)
})
tests/v2/e2e/kubernetes/portforward/portforward.go (1)

201-228: Revisit looping structure with backoff.

The loop in Start repeatedly calls pf.portForwardToService inside either pf.backoff.Do or a direct call. Consider a combined state machine or gracefully pausing between retries to avoid repeated errors flooding logs.

tests/v2/e2e/crud/modification_test.go (1)

125-176: Consider reducing switch-case verbosity.

The nested switch-case for plan.Type and plan.Mode introduces repetitive patterns. You could consider refactoring to a more DRY (Don't Repeat Yourself) approach, for example by using a lookup table or function map keyed by (plan.Type, plan.Mode) to simplify the logic and improve maintainability.

tests/v2/e2e/kubernetes/resources.go (1)

316-326: Minimize the lock hold time when calling external methods.

Currently, you hold the read lock while calling b.Interface.Create(). This can block other readers or writers if the external method is slow or blocks. As a good-to-have refactor, consider copying the interface into a local variable under the lock, then unlock and call the method:

 func (b *baseClient[T, L, C]) Create(
   ctx context.Context, resource T, opts metav1.CreateOptions,
 ) (t T, err error) {
-  b.mu.RLock()
-  defer b.mu.RUnlock()
-  if b == nil || b.Interface == nil {
+  b.mu.RLock()
+  iface := b.Interface
+  b.mu.RUnlock()
+  if b == nil || iface == nil {
     return t, errors.ErrKubernetesClientNotFound
   }
-  return b.Interface.Create(ctx, resource, opts)
+  return iface.Create(ctx, resource, opts)
 }

This approach removes the risk of holding the lock across a potentially time-consuming call.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6b336f and 18682c3.

📒 Files selected for processing (134)
  • .gitfiles (14 hunks)
  • .github/workflows/_docker-image.yaml (1 hunks)
  • .github/workflows/_release-pr.yaml (1 hunks)
  • .github/workflows/build-binaries.yaml (1 hunks)
  • .github/workflows/build-protobuf.yaml (1 hunks)
  • .github/workflows/chatops.yaml (5 hunks)
  • .github/workflows/codeql-analysis.yml (1 hunks)
  • .github/workflows/coverage.yaml (1 hunks)
  • .github/workflows/e2e-chaos.yaml (4 hunks)
  • .github/workflows/e2e-code-bench-agent.yaml (2 hunks)
  • .github/workflows/e2e-max-dim.yaml (1 hunks)
  • .github/workflows/e2e-profiling.yaml (1 hunks)
  • .github/workflows/e2e.yaml (8 hunks)
  • .github/workflows/format.yaml (2 hunks)
  • .github/workflows/fossa.yaml (1 hunks)
  • .github/workflows/helm-lint.yaml (3 hunks)
  • .github/workflows/helm.yaml (2 hunks)
  • .github/workflows/reviewdog-k8s.yaml (3 hunks)
  • .github/workflows/reviewdog.yaml (2 hunks)
  • .github/workflows/test-hack.yaml (1 hunks)
  • .github/workflows/unit-test-rust.yaml (1 hunks)
  • .github/workflows/unit-test.yaml (3 hunks)
  • .github/workflows/update-deps.yaml (1 hunks)
  • Makefile (5 hunks)
  • Makefile.d/e2e.mk (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • buf.gen.yaml (1 hunks)
  • cmd/index/job/deletion/main_test.go (1 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/example/client/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/deletion/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • internal/backoff/option.go (0 hunks)
  • internal/client/v1/client/discoverer/discover_test.go (5 hunks)
  • internal/config/benchmark_test.go (4 hunks)
  • internal/config/config.go (2 hunks)
  • internal/config/index_deleter_test.go (1 hunks)
  • internal/core/algorithm/usearch/usearch_test.go (16 hunks)
  • internal/errors/errors.go (1 hunks)
  • internal/errors/errors_test.go (1 hunks)
  • internal/errors/k8s.go (1 hunks)
  • internal/info/info_test.go (17 hunks)
  • internal/iter/iter.go (1 hunks)
  • internal/net/dialer_test.go (1 hunks)
  • internal/net/grpc/errdetails/errdetails.go (6 hunks)
  • internal/net/grpc/metadata_test.go (1 hunks)
  • internal/net/grpc/option_test.go (44 hunks)
  • internal/net/grpc/pool/pool_test.go (5 hunks)
  • internal/net/grpc/server_test.go (2 hunks)
  • internal/net/grpc/stream.go (2 hunks)
  • internal/net/grpc/stream_test.go (4 hunks)
  • internal/net/http/client/client.go (1 hunks)
  • internal/net/http/client/client_test.go (1 hunks)
  • internal/net/net.go (1 hunks)
  • internal/net/net_test.go (1 hunks)
  • internal/net/quic/conn_test.go (1 hunks)
  • internal/net/quic/listener_test.go (1 hunks)
  • internal/params/option.go (2 hunks)
  • internal/params/option_test.go (1 hunks)
  • internal/params/params.go (5 hunks)
  • internal/params/params_test.go (1 hunks)
  • internal/rand/rand.go (1 hunks)
  • internal/servers/server/option_test.go (1 hunks)
  • internal/sync/errgroup/group.go (7 hunks)
  • internal/sync/errgroup/group_test.go (16 hunks)
  • internal/test/data/vector/gen.go (0 hunks)
  • internal/test/data/vector/noise/noise.go (1 hunks)
  • internal/test/data/vector/noise/noise_test.go (1 hunks)
  • internal/test/data/vector/noise/option.go (1 hunks)
  • internal/test/data/vector/noise/option_test.go (1 hunks)
  • internal/timeutil/time.go (1 hunks)
  • internal/timeutil/time_test.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt.go (1 hunks)
  • pkg/agent/core/ngt/service/ngt_test.go (9 hunks)
  • pkg/discoverer/k8s/service/discover_test.go (4 hunks)
  • pkg/gateway/lb/handler/grpc/aggregation_test.go (2 hunks)
  • pkg/gateway/lb/handler/grpc/handler_test.go (2 hunks)
  • pkg/index/job/deletion/config/config_test.go (1 hunks)
  • pkg/index/job/deletion/service/deleter_test.go (1 hunks)
  • pkg/index/job/deletion/service/options_test.go (1 hunks)
  • pkg/index/job/deletion/usecase/deletion_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/insert_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/job_test.go (12 hunks)
  • pkg/tools/benchmark/job/service/object_test.go (8 hunks)
  • pkg/tools/benchmark/job/service/option_test.go (1 hunks)
  • pkg/tools/benchmark/job/service/remove_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/search_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/update_test.go (4 hunks)
  • pkg/tools/benchmark/job/service/upsert_test.go (4 hunks)
  • pkg/tools/cli/loadtest/service/insert_test.go (11 hunks)
  • pkg/tools/cli/loadtest/service/loader.go (1 hunks)
  • pkg/tools/cli/loadtest/service/loader_test.go (13 hunks)
  • pkg/tools/cli/loadtest/service/search_test.go (9 hunks)
  • tests/v2/e2e/assets/rollout.yaml (1 hunks)
  • tests/v2/e2e/assets/unary_crud.yaml (1 hunks)
  • tests/v2/e2e/config/config.go (1 hunks)
  • tests/v2/e2e/config/enums.go (1 hunks)
  • tests/v2/e2e/crud/crud_test.go (1 hunks)
  • tests/v2/e2e/crud/dataset_test.go (1 hunks)
  • tests/v2/e2e/crud/grpc_test.go (1 hunks)
  • tests/v2/e2e/crud/index_test.go (1 hunks)
  • tests/v2/e2e/crud/modification_test.go (1 hunks)
  • tests/v2/e2e/crud/object_test.go (1 hunks)
  • tests/v2/e2e/crud/search_test.go (1 hunks)
  • tests/v2/e2e/crud/strategy_test.go (1 hunks)
  • tests/v2/e2e/hdf5/hdf5.go (1 hunks)
  • tests/v2/e2e/kubernetes/client.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/option.go (1 hunks)
  • tests/v2/e2e/kubernetes/portforward/portforward.go (1 hunks)
  • tests/v2/e2e/kubernetes/resources.go (1 hunks)
  • tests/v2/e2e/kubernetes/rollout.go (1 hunks)
  • tests/v2/e2e/kubernetes/status.go (1 hunks)
💤 Files with no reviewable changes (2)
  • internal/test/data/vector/gen.go
  • internal/backoff/option.go
🚧 Files skipped from review as they are similar to previous changes (95)
  • dockers/buildbase/Dockerfile
  • dockers/ci/base/Dockerfile
  • dockers/agent/core/agent/Dockerfile
  • .github/workflows/build-binaries.yaml
  • dockers/discoverer/k8s/Dockerfile
  • dockers/tools/cli/loadtest/Dockerfile
  • pkg/tools/benchmark/job/service/update_test.go
  • .github/workflows/fossa.yaml
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/agent/sidecar/Dockerfile
  • .github/workflows/e2e-profiling.yaml
  • .github/workflows/e2e-code-bench-agent.yaml
  • dockers/gateway/lb/Dockerfile
  • dockers/index/job/deletion/Dockerfile
  • .github/workflows/format.yaml
  • .github/workflows/helm-lint.yaml
  • dockers/index/job/creation/Dockerfile
  • dockers/dev/Dockerfile
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • .github/workflows/test-hack.yaml
  • .github/workflows/unit-test.yaml
  • dockers/example/client/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • .github/workflows/e2e-max-dim.yaml
  • dockers/operator/helm/Dockerfile
  • .github/workflows/build-protobuf.yaml
  • dockers/gateway/filter/Dockerfile
  • .github/workflows/e2e-chaos.yaml
  • dockers/tools/benchmark/job/Dockerfile
  • .github/workflows/update-deps.yaml
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/manager/index/Dockerfile
  • internal/config/benchmark_test.go
  • tests/v2/e2e/assets/rollout.yaml
  • dockers/agent/core/faiss/Dockerfile
  • dockers/tools/benchmark/operator/Dockerfile
  • .github/workflows/reviewdog-k8s.yaml
  • buf.gen.yaml
  • pkg/tools/benchmark/job/service/object_test.go
  • .github/workflows/_release-pr.yaml
  • internal/rand/rand.go
  • internal/net/grpc/errdetails/errdetails.go
  • Makefile.d/e2e.mk
  • .github/workflows/helm.yaml
  • .github/workflows/reviewdog.yaml
  • pkg/tools/benchmark/job/service/search_test.go
  • pkg/tools/benchmark/job/service/remove_test.go
  • internal/errors/errors_test.go
  • internal/net/quic/conn_test.go
  • .github/workflows/_docker-image.yaml
  • tests/v2/e2e/crud/dataset_test.go
  • pkg/tools/cli/loadtest/service/loader.go
  • dockers/gateway/mirror/Dockerfile
  • internal/errors/errors.go
  • .github/workflows/coverage.yaml
  • internal/net/net.go
  • tests/v2/e2e/kubernetes/rollout.go
  • .github/workflows/e2e.yaml
  • dockers/index/job/correction/Dockerfile
  • internal/net/http/client/client.go
  • internal/timeutil/time.go
  • cmd/index/job/deletion/main_test.go
  • pkg/agent/core/ngt/service/ngt_test.go
  • Makefile.d/functions.mk
  • internal/config/index_deleter_test.go
  • pkg/tools/benchmark/job/service/insert_test.go
  • pkg/tools/benchmark/job/service/job_test.go
  • internal/net/grpc/stream_test.go
  • pkg/index/job/deletion/config/config_test.go
  • internal/core/algorithm/usearch/usearch_test.go
  • internal/net/grpc/stream.go
  • .github/workflows/codeql-analysis.yml
  • tests/v2/e2e/crud/crud_test.go
  • .github/workflows/unit-test-rust.yaml
  • internal/info/info_test.go
  • internal/test/data/vector/noise/option.go
  • dockers/index/job/save/Dockerfile
  • tests/v2/e2e/hdf5/hdf5.go
  • pkg/tools/cli/loadtest/service/loader_test.go
  • pkg/tools/cli/loadtest/service/insert_test.go
  • dockers/index/operator/Dockerfile
  • pkg/tools/benchmark/job/service/upsert_test.go
  • pkg/tools/cli/loadtest/service/search_test.go
  • pkg/discoverer/k8s/service/discover_test.go
  • .github/workflows/chatops.yaml
  • pkg/gateway/lb/handler/grpc/handler_test.go
  • pkg/gateway/lb/handler/grpc/aggregation_test.go
  • internal/client/v1/client/discoverer/discover_test.go
  • internal/config/config.go
  • Makefile
  • tests/v2/e2e/crud/search_test.go
  • pkg/agent/core/ngt/service/ngt.go
  • internal/net/grpc/server_test.go
  • internal/servers/server/option_test.go
🧰 Additional context used
🧠 Learnings (1)
.gitfiles (1)
Learnt from: datelier
PR: vdaas/vald#2807
File: rust/bin/agent/src/handler/object.rs:36-38
Timestamp: 2025-03-15T12:24:12.647Z
Learning: In Rust code for Vald handlers, avoid using unwrap() on Option types. Instead, handle None values explicitly by returning appropriate error statuses to maintain robustness.
🪛 YAMLlint (1.35.1)
tests/v2/e2e/assets/unary_crud.yaml

[error] 204-204: duplication of key "name" in mapping

(key-duplicates)

⏰ Context from checks skipped due to timeout of 90000ms (160)
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: Run tests for pkg packages
  • GitHub Check: Run tests for cmd packages
  • GitHub Check: grpc-stream
  • GitHub Check: grpc-sequential
  • GitHub Check: CodeQL
  • GitHub Check: runner / go build
  • GitHub Check: coverage
  • GitHub Check: check-format-diff
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
  • GitHub Check: build / build
🔇 Additional comments (54)
internal/net/net_test.go (1)

1200-1369: Implement test cases for IsUDP and IsTCP functions.

Both test functions are well-structured but currently commented out and lack actual test cases. Network type checking functions are critical for reliability and deserve thorough testing.

Consider adding test cases for:

  1. Standard network types (e.g., "udp", "tcp")
  2. Variant types (e.g., "udp4", "udp6", "tcp4", "tcp6")
  3. Case sensitivity (e.g., "UDP", "Udp")
  4. Invalid or empty network strings
  5. Mixed/malformed network strings
internal/net/quic/listener_test.go (1)

1-196: Test skeletons should be implemented or removed

The file contains well-structured test skeletons for QUIC listener functionality, but they're entirely commented out. While the structure follows good testing practices with proper setup for test cases, check functions, and leak detection, they lack actual implementation.

Consider either:

  1. Implementing at least basic test cases to provide real test coverage, or
  2. Removing these commented-out skeletons until they're ready to be implemented

Commented-out code in the codebase can lead to confusion and maintenance challenges over time.

internal/net/grpc/metadata_test.go (1)

18-101: Implement or explain the commented test structure.

This test function TestNewMetadata follows the project's test pattern with proper argument definitions, check functions, and parallel execution setup, but it's entirely commented out and not contributing to test coverage. In a PR focused on enhancing the testing infrastructure, leaving commented-out tests undermines that objective.

Either:

  1. Uncomment and implement concrete test cases to validate the NewMetadata function, or
  2. Add a clear explanation comment about why this test template exists in a commented-out state
internal/net/grpc/pool/pool_test.go (6)

2874-2876: Improved field naming in want struct

Renaming the fields from generic names (want and want1) to more descriptive names (wantConn and wantOk) enhances code readability and makes the intent clearer. This change makes the code more maintainable by explicitly indicating what each field represents.


2887-2893: Updated function signature with clearer parameter names

The defaultCheckFunc function signature has been updated to use the more descriptive parameter names (gotConn and gotOk) that align with the renamed struct fields. This improves consistency and readability of the test code.


3009-3011: Updated variable names in Get method test

The variables used to capture the return values from the Get method have been renamed to match the more descriptive naming convention. This makes the code more consistent and easier to understand.


3042-3046: Enhanced want struct for getHealthyConn method

The want struct for the getHealthyConn test has been expanded to include wantIdx, which aligns with changes to the method's return values. This modification supports the updated API that now returns an additional index parameter.


3052-3056: Updated checkFunc signature for getHealthyConn

The checkFunc signature has been expanded to accommodate the additional return value (index) from the getHealthyConn method. This ensures proper testing of all returned values.


3185-3187: Updated method call to match enhanced getHealthyConn API

The method call now captures three return values: index, connection, and status flag. This change accommodates the enhanced API of getHealthyConn that now provides additional connection index information, which can be valuable for debugging or implementing more advanced connection selection strategies.

internal/test/data/vector/noise/option_test.go (1)

3-261: All test functions are fully commented out.

These placeholders need real test scenarios for each function (TestWithLevelFactor, TestWithTableDivisionFactor, and TestWithMinTableSize). Without implementation, there's no coverage of these critical options. This mirrors previous feedback about filling in or removing placeholders.

internal/test/data/vector/noise/noise_test.go (1)

3-196: Fill in the commented-out test functions.

TestNew and Test_noiseGenerator_Mod remain placeholders. Please implement diverse scenarios (e.g., normal, edge cases, and error conditions) to thoroughly test the noise generation logic.

internal/test/data/vector/noise/noise.go (3)

79-106: Prevent potential division by zero when computing average standard deviation.

If all vectors in data are empty, count remains zero at line 105, causing a division by zero. Consider returning a safe default or adding a guard check:

 if count == 0 {
-  return float32(totalStd/float64(count)) * ng.noiseLevelFactor
+  return 0.01
 }

112-123: Avoid dividing by zero if noiseTableDivisionFactor is zero.

At line 117, required /= ng.noiseTableDivisionFactor can cause a runtime error unless you ensure noiseTableDivisionFactor is non-zero. Validate or enforce a minimum:

if ng.noiseTableDivisionFactor == 0 {
-  required /= ng.noiseTableDivisionFactor
+  log.Warn("noiseTableDivisionFactor is zero; using default=1")
+  ng.noiseTableDivisionFactor = 1
}

180-181: Confirm Go 1.21+ availability for slices.Clone.

Clone was introduced in Go 1.21. Update the build environment and documentation to require Go 1.21 or handle older environments via an alternative.

internal/params/option.go (5)

20-23: New imports enhance functionality for finding executable name.

The addition of os and filepath imports allows retrieving the executable's base name for use in the parser, which improves usability by providing meaningful default naming.


27-36: Good improvement to default configuration.

Setting the parser's name to the executable name (filepath.Base(os.Args[0])) and adding the override flag option as defaults are sensible enhancements that improve usability out of the box.


38-45: Well-designed name configuration option.

The WithName function follows the established pattern of the package, with proper null checking and documentation.


89-94: Clean implementation of the override default option.

This function adds the ability to control whether default flags should be overridden, following the existing pattern in the package.


96-109: Well-implemented argument filtering capability.

The WithArgumentFilters function:

  • Has clear documentation explaining its purpose
  • Handles the empty filter case efficiently with an early return
  • Uses appropriate nil checking and initialization of the filters slice
  • Properly appends filters with preallocation for performance

This is a good addition that increases the flexibility of the argument parser.

internal/sync/errgroup/group_test.go (1)

1172-1288: Decision needed on Test_group_TryGo.

This commented-out test for the TryGo method has been retained even though you appear to be transitioning to the new exec method. Based on previous review comments, a clear decision is needed on whether to keep both methods.

If both methods coexist in the codebase, uncomment and implement both test functions. If TryGo is being deprecated in favor of exec, remove this commented-out test entirely to avoid confusion.

internal/net/dialer_test.go (1)

1993-2079: Test skeleton for isQUICDial needs implementation.

This test function is properly structured but commented out with TODO placeholders instead of actual test cases. The structure follows the pattern of other tests in the file, but without implementation, it doesn't provide any test coverage.

Uncomment this test and implement concrete test cases to validate the functionality of the isQUICDial function. Include test cases for different network types and address formats to ensure comprehensive coverage.

pkg/index/job/deletion/usecase/deletion_test.go (3)

3-93: Implement TestNew instead of keeping as commented skeleton.

This test structure is well-designed but completely commented out with TODO placeholders. A test that isn't uncommented and implemented provides no test coverage or validation of the code.

Uncomment this test function and implement concrete test cases that validate the behavior of the New function. Include at least:

  1. A test case with valid configuration parameters
  2. A test case with nil configuration
  3. A test case that triggers error conditions

95-208: Implement Test_run_PreStart with meaningful test cases.

The PreStart lifecycle method needs test coverage to ensure proper initialization of components. The test structure is in place but commented out with TODO placeholders.

Uncomment and implement this test with meaningful cases that validate the PreStart functionality, especially focusing on:

  1. Successful initialization
  2. Error handling for component initialization failures
  3. Context handling

210-327: Implement Test_run_Start to validate startup behavior.

The Start method is particularly important as it returns an error channel. This test needs to validate both successful startup and proper channel behavior.

Uncomment and implement this test with cases that verify:

  1. Successful startup with a valid error channel
  2. Proper handling of initialization errors
  3. Channel behavior when components report errors
internal/params/option_test.go (1)

450-705: Implement the commented-out test functions

These three test functions (TestWithName, TestWithOverrideDefault, and TestWithArgumentFilters) remain commented out with "NOT IMPLEMENTED BELOW" marker, making them non-functional. This is part of the new V2 E2E strategic testing framework but doesn't contribute test coverage in its current state.

You should either:

  1. Implement and uncomment these test functions to properly test the option functionality
  2. Add a clearer comment explaining that these are part of the V2 E2E framework and when they'll be implemented

Also note that these tests use tt.Parallel() while existing tests don't, which should be made consistent when implementing.

pkg/index/job/deletion/service/options_test.go (1)

1-347: Implementation placeholder with commented-out test code

This entire file consists of commented-out test implementations that provide good structure but aren't actually functional. While the table-driven test approach is solid, none of these tests will run in their current state.

As part of the V2 E2E strategic testing framework, these tests need to be uncommented and properly implemented with actual test cases. The file is missing necessary imports such as reflect, errors, and goleak, which would be required once the tests are uncommented.

Consider implementing the test cases first for core functionality like WithDiscoverer and WithTargetIndexID to ensure the option pattern works correctly.

internal/params/params.go (5)

23-35: Good: Clear type aliases and constants for error handling

The addition of the ErrorHandling type alias and related constants improves code clarity by making the error handling options explicit instead of relying on flag package constants directly.

This approach enhances maintainability and readability by making the connection to the underlying flag package clear while providing a domain-specific interface.


53-70: Enhanced parser struct with improved fields and configuration

The parser struct has been enhanced with fields for name, filters, overrideDefault, and proper FlagSet management which provides better control over argument parsing behavior.

These additions support the V2 E2E strategic testing framework by allowing more flexible configuration of parser behavior through the option pattern.


105-115: Good: Improved argument filtering implementation

The addition of argument filtering logic using slices.DeleteFunc is a clean implementation that allows selective processing of command-line arguments based on custom filters.

This enhancement supports more flexible testing scenarios in the V2 E2E strategic testing framework by enabling test-specific argument handling.


119-123: Improved error handling with proper error comparison

Using errors.Is() instead of direct error comparison is a better practice for handling errors, particularly for checking sentinel errors like flag.ErrHelp.

This change ensures more reliable error handling when parsing arguments, which is important for the robustness of the E2E testing framework.


78-82:

❓ Verification inconclusive

Ensure global state is managed safely

Setting overrideDefault impacts global state via flag.CommandLine which could cause issues in concurrent scenarios.

While this approach works for most use cases, consider documenting this behavior clearly or implementing a more isolated approach if concurrent parsers might be used in the E2E testing framework.


🏁 Script executed:

#!/bin/bash
# Check if there are any concurrent usages of Parser in the codebase
rg -A 3 -B 3 "go func" --glob "*.go" | rg "New\(.*\)"

Length of output: 55


Global Flag Usage and Concurrency Consideration

It appears that the parser is using the global flag—flag.CommandLine—to initialize its defaults. This setup may be acceptable for sequential usage but could lead to subtle issues if concurrent invocations occur (for example, in an E2E testing context). Since the initial verification script didn’t yield any evidence of concurrent usage, it’s still recommended to:

  • Explicitly document this behavior: Clarify in the code or documentation that the parser relies on global state.
  • Consider a more isolated approach: If there’s any possibility of running multiple parsers concurrently, isolate the flag sets to prevent interference.

Please verify manually whether any concurrent execution paths might rely on this parser to ensure no concurrency issues arise.

pkg/index/job/deletion/service/deleter_test.go (1)

1-519: Commented-out test implementation needs to be activated

This entire file consists of well-structured but non-functional test code. The test templates follow good practices with table-driven tests and thorough setup/teardown handling, but they're all commented out.

For the V2 E2E strategic testing framework to be effective, these tests should be:

  1. Uncommented
  2. Implemented with actual test cases
  3. Updated with proper mock implementations for dependencies like discoverer.Client

Pay particular attention to implementing tests for critical functionality like index deletion and handling of concurrent operations, which are core to the deletion service.

internal/sync/errgroup/group.go (3)

120-134: Clarify handling of limit < 1.

When limit <= 1, the code sets sem = nil but only executes inline if limit == 1. Negative or zero limits currently yield effectively unlimited concurrency. Verify whether this behavior is intentional or needs special-casing.


167-190: Concurrent goroutine launch flow looks solid.

Acquiring the semaphore before launching a goroutine, then releasing it in done(), ensures concurrency limit enforcement. The logic is straightforward and properly handles context cancellation scenarios.


261-267: Global Wait approach appears acceptable.

Returning nil when the global instance is uninitialized avoids errors in cases where no tasks were scheduled. This is consistent with the package-level design.

internal/iter/iter.go (2)

22-22: Verify import alias “iter” with the same package name.

Previously flagged concern: importing "iter" inside package iter can cause naming confusion or a circular dependency. Confirm that this import references an external or distinct module.


53-59: Avoid returning nil iterator for empty slices.

As previously noted, returning nil when the slice is empty may cause downstream panics if methods are called on the returned interface. A no-op cycle can provide more consistent behavior.

.gitfiles (2)

126-126: Ensure the Rust unit test workflow is integrated properly.

A new workflow file .github/workflows/unit-test-rust.yaml is referenced here. Confirm that this workflow is triggered as intended (e.g., via pull request events) and that the rust toolchain version aligns with the project’s supported versions.


2034-2053: New e2e tests introduced.

References to new assets and test files in tests/v2/e2e/* appear. Ensure these are aligned with the existing test harness, test workflows, and coverage metrics. Double-check if any additional Helm chart updates or environment variables are required for their deployment.

tests/v2/e2e/config/config.go (4)

188-196: Duplicate comment: strengthen metadata validation.

Similar to a past review comment, there's no further validation on metadata entries. Potential issues include accepting invalid or malicious strings.


609-611: Clarify fallback for zero port.

If the user sets pf.TargetPort or pf.LocalPort to 0, the code overrides it with 8081. Verify if this is intentional or if an error is more appropriate.


752-769: Validate partial vs. full config loads.

Load(path string) returns an error only if Read fails or config binding fails. A partial or incomplete config might slip through if it doesn’t trigger an error. Ensure this behavior is acceptable.


573-578:

❓ Verification inconclusive

Warn vs. fail for missing kubeconfig file.

The code warns if k.KubeConfig doesn't exist but continues execution. Verify whether a missing file is truly optional. If not, consider failing early.

Would you like to confirm no references break when kubeconfig is absent? If you want to check usage across the repo:


🏁 Script executed:

#!/bin/bash
# Searching for references to 'Kubernetes.KubeConfig' usage that might assume existence.
rg 'KubeConfig' -A 5

Length of output: 1560


Verify Kubeconfig Handling – Confirm Required vs. Optional Behavior

After examining the usage of KubeConfig in the repository—particularly in tests/v2/e2e/crud/strategy_test.go, where the kubeconfig value is passed to k8s.NewClient and errors are handled—it appears that a missing kubeconfig file might eventually trigger a failure during client creation. However, in the configuration code (tests/v2/e2e/config/config.go, lines 573–578), the absence of a valid kubeconfig only results in warnings rather than an early error.

  • Review these locations:
    • tests/v2/e2e/config/config.go (lines 573–578): Logs warnings when k.KubeConfig is empty or the file is missing.
    • tests/v2/e2e/crud/strategy_test.go: Passes KubeConfig to k8s.NewClient and then checks for errors.

Recommendation:
If a valid kubeconfig is required for proper operation (as suggested by its usage in client creation), it might be preferable to fail early during configuration setup rather than deferring error handling. Conversely, if the missing kubeconfig is an acceptable state, ensure that documentation and tests clearly reflect its optional nature.

tests/v2/e2e/crud/index_test.go (3)

32-38: Check logic in callback return.

indexCallBack always returns true regardless of an error. Confirm if this is intentional; you may need to signal partial or complete failure by returning false or handling differently.


58-58: Ensure flush request is populated if needed.

For OpFlush, you’re passing an empty payload.Flush_Request. Confirm if any required fields should be populated (e.g., specifying an index name or flush configuration).


46-61: Confirm coverage of all index operation types.

Only certain operations (OpIndexInfo, OpIndexDetail, etc.) are handled. If additional index operations like OpIndexRebuild exist, they’ll be rejected by t.Fatalf. Validate that you aren’t missing an operation type.

tests/v2/e2e/assets/unary_crud.yaml (1)

204-204: Fix the duplicate key "name".

It appears that line 204 introduces a second "name" key at the same level, resulting in a YAML key-duplication error. To fix this, you can rename or remove the extra key, for example:

      - name: Inset Operation
        executions:
          - name: Insert
            ...
          - mode: unary
            name: IndexInfo
            type: index_info
-        name: Insert -> IndexInfo
+#        # Remove or rename the duplicated key to avoid conflict
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 204-204: duplication of key "name" in mapping

(key-duplicates)

tests/v2/e2e/kubernetes/portforward/option.go (1)

95-101: Validate ports mapping.
This recommendation is similar to the past review comment (lines 95-101). To avoid silently ignoring invalid port mappings, add input validation to ensure port numbers are in a valid range (e.g., 1-65535) and non-zero.

tests/v2/e2e/crud/strategy_test.go (1)

153-155: Return errors from processOperation.

As previously suggested, returning errors helps propagate failures fast and prevents masking underlying issues. This is the same comment as before.

tests/v2/e2e/kubernetes/portforward/portforward.go (3)

354-356: Approve fallback to http.DefaultClient.

If no HTTP client is provided, using http.DefaultClient is a sensible fallback, ensuring consistent SPDY transport. This is a good default approach.


379-381:

✅ Verification successful

Confirm Go version for slices.Compact and slices.Clip usage.

These methods require Go 1.21. Ensure your build environment supports them to avoid compile-time errors.


🌐 Web query:

What Go version introduced slices.Compact and slices.Clip in the standard library?

💡 Result:

The slices.Compact and slices.Clip functions were introduced to the Go standard library in version 1.21, released in August 2023. These functions were part of the new slices package, which transitioned from the experimental golang.org/x/exp/slices module to the standard library with this release[1][6].

Key details:

  • Clip: Removes unused capacity from a slice by setting its capacity equal to its length (s[:len(s):len(s)])[1][5].
  • Compact: Removes consecutive duplicate elements from a slice while preserving order and zeroing truncated elements[3][5].

The slices package was deliberately kept small initially, with additional functions like Concat being added in later releases (Go 1.22)[2]. Before 1.21, these utilities were only available through the experimental golang.org/x/exp/slices package[4][5].

Citations:


Ensure Build Environment Uses Go 1.21
Both slices.Compact and slices.Clip were introduced in Go 1.21. Please verify that your build system and CI pipeline are configured to use Go 1.21 or later to prevent compile-time issues.

  • Confirm your Go version in environment setups (Dockerfiles, CI configurations, etc.)
  • Update documentation or build scripts if necessary.

311-320:

❓ Verification inconclusive

Request verification on error propagation.

The portForwardToService method sets pf.healthy to true once forwarding is established, but it resets it to false upon return. Confirm if short interruptions cause repeated transitions or mislead external checks that rely on pf.healthy. A continuous error could flip this state often.

Would you like to analyze logs or usage references in other packages to confirm no race conditions or repeated false alarms?


🏁 Script executed:

#!/bin/bash
# Searching the codebase for references to pf.healthy usage
fd -t f | xargs rg "pf\.healthy"

Length of output: 749


Action: Verify intermittent error propagation and health status toggling

The search for references to pf.healthy shows its usage is confined to the port forward module in tests/v2/e2e/kubernetes/portforward/portforward.go. This suggests that external systems do not rely on this flag beyond this context. However, the potential issue remains that during short interruptions the rapid toggling (true on establishment, false on return) could lead to misleading health checks—especially if a continuous error causes frequent state flips.

  • Review in Context:

    • The flag is set to true upon establishing port forwarding and reliably reset to false via defer upon exit.
    • Usage is isolated to this file; no external consumers of pf.healthy were found.
  • Next Steps:

    • Manual Verification: Please verify within the overall test and logging framework that transient errors or quick session terminations do not trigger repeated transitions that might be interpreted as false alarms by external monitoring.
    • Behavior Check: Confirm that in scenarios of continuous error, the flipping state does not mislead any external health checks or monitoring tools.

Please double-check how the health flag is interpreted downstream to ensure that the current error propagation logic does not introduce race conditions or unintended false negatives.

tests/v2/e2e/crud/modification_test.go (1)

139-145: Confirm leftover request handling in multi calls.

Similar to previously flagged concerns, ensure that any leftover items (if plan.BulkSize doesn’t evenly divide the total number of vectors) are processed rather than discarded. This was noted in older comments related to multiModify.

Also applies to: 151-153, 160-162, 169-171

tests/v2/e2e/kubernetes/resources.go (1)

316-326: Check for nil b before b.mu.RLock() to avoid a potential panic.

This was mentioned in past reviews: if b is nil, calling b.mu.RLock() immediately will lead to a nil-pointer dereference. Consider performing the nil check before using b.mu.

Comment on lines +329 to +672
// type test struct {
// name string
// args args
// fields fields
// want want
// checkFunc func(want, error) error
// beforeFunc func(*testing.T, args)
// afterFunc func(*testing.T, args)
// }
// defaultCheckFunc := func(w want, err error) error {
// if !errors.Is(err, w.err) {
// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err)
// }
// return nil
// }
// tests := []test{
// // TODO test cases
// /*
// {
// name: "test_case_1",
// args: args {
// in0:nil,
// },
// fields: fields {
// eg:nil,
// cfg:nil,
// observability:nil,
// server:nil,
// indexer:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// },
// */
//
// // TODO test cases
// /*
// func() test {
// return test {
// name: "test_case_2",
// args: args {
// in0:nil,
// },
// fields: fields {
// eg:nil,
// cfg:nil,
// observability:nil,
// server:nil,
// indexer:nil,
// },
// want: want{},
// checkFunc: defaultCheckFunc,
// beforeFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// afterFunc: func(t *testing.T, args args) {
// t.Helper()
// },
// }
// }(),
// */
// }
//
// for _, tc := range tests {
// test := tc
// t.Run(test.name, func(tt *testing.T) {
// tt.Parallel()
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
// if test.beforeFunc != nil {
// test.beforeFunc(tt, test.args)
// }
// if test.afterFunc != nil {
// defer test.afterFunc(tt, test.args)
// }
// checkFunc := test.checkFunc
// if test.checkFunc == nil {
// checkFunc = defaultCheckFunc
// }
// r := &run{
// eg: test.fields.eg,
// cfg: test.fields.cfg,
// observability: test.fields.observability,
// server: test.fields.server,
// indexer: test.fields.indexer,
// }
//
// err := r.PostStop(test.args.in0)
// if err := checkFunc(test.want, err); err != nil {
// tt.Errorf("error = %v", err)
// }
//
// })
// }
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Implement remaining lifecycle tests for complete coverage.

The remaining test functions (PreStop, Stop, PostStop) are all commented out with TODO placeholders. These lifecycle methods are critical for ensuring proper service shutdown and resource cleanup.

To ensure comprehensive test coverage of the deletion job runner, uncomment and implement all of these lifecycle tests with meaningful test cases that validate:

  1. Proper notification of components before shutdown
  2. Clean shutdown of all components
  3. Complete resource cleanup after shutdown
  4. Error handling during shutdown scenarios

Comment on lines +104 to +114
if err != nil {
if err == io.EOF {
return
}
if plan.ExpectedStatusCodes != nil && plan.ExpectedStatusCodes.Equals(codes.ToString(res.GetStatus().GetCode())) {
t.Logf("expected error: %v", err)
} else {
t.Errorf("unexpected error: %v", err)
}

break
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Prevent potential nil pointer dereference.

When handling errors, res could be nil. Calling res.GetStatus() in that scenario will cause a panic. Check for a nil res before accessing its fields:

          if plan.ExpectedStatusCodes != nil && plan.ExpectedStatusCodes.Equals(codes.ToString(res.GetStatus().GetCode())) {
            t.Logf("expected error: %v", err)
          } else {
            t.Errorf("unexpected error: %v", err)
          }
+       } else if res == nil {
+         t.Errorf("received nil response while error was not EOF: %v", err)
+         break
        }
        break

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +195 to +248
switch e.Type {
case config.OpSearch,
config.OpSearchByID,
config.OpLinearSearch,
config.OpLinearSearchByID,
config.OpInsert,
config.OpUpdate,
config.OpUpsert,
config.OpRemove,
config.OpRemoveByTimestamp,
config.OpObject,
config.OpListObject,
config.OpTimestamp,
config.OpExists:
train, test, neighbors := getDatasetSlices(ttt, e)
if e.BaseConfig != nil {
log.Infof("started execution name: %s, type: %s, mode: %s, execution: %d, num: %d, offset: %d",
e.Name, e.Type, e.Mode, idx, e.Num, e.Offset)
defer log.Infof("finished execution name: %s type: %s, mode: %s, execution: %d, num: %d, offset: %d",
e.Name, e.Type, e.Mode, idx, e.Num, e.Offset)
}
switch e.Type {
case config.OpSearch,
config.OpSearchByID,
config.OpLinearSearch,
config.OpLinearSearchByID:
r.processSearch(ttt, ctx, train, test, neighbors, e)
case config.OpInsert,
config.OpUpdate,
config.OpUpsert,
config.OpRemove,
config.OpRemoveByTimestamp:
r.processModification(ttt, ctx, train, e)
case config.OpObject,
config.OpListObject,
config.OpTimestamp,
config.OpExists:
r.processObject(ttt, ctx, train, e)
}
case config.OpIndexInfo,
config.OpIndexDetail,
config.OpIndexStatistics,
config.OpIndexStatisticsDetail,
config.OpIndexProperty,
config.OpFlush:
log.Infof("type: %s, mode: %s, execution: %d", e.Type, e.Mode, idx)
r.processIndex(ttt, ctx, e)
case config.OpKubernetes:
// TODO implement kubernetes operation here, eg. delete pod, rollout restart, etc.
case config.OpClient:
// TODO implement gRPC client operation here, eg. start, stop, etc.
case config.OpWait:
// do nothing
default:
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Refactor the large switch-case in processExecution.

A switch block with many operations (search, insert, update, remove, etc.) leads to a long method. Extract each operation type into a dedicated function to improve readability and maintainability.

Comment on lines +149 to +200
// Start launches the port forwarding daemon.
// It starts two goroutines:
// 1. runEndpointWatcher: continuously monitors Endpoints and updates the target pod list.
// 2. runConnectionLoop: repeatedly establishes port forwarding using round-robin selection with exponential backoff.
func (pf *portForward) Start(ctx context.Context) (<-chan error, error) {
// Create a cancelable context for the entire daemon.
ctx, pf.cancel = context.WithCancel(ctx)

// Initialize the error channel (named "ech").
pf.ech = make(chan error, 2)

if pf.eg == nil {
pf.eg, ctx = errgroup.New(ctx)
}

// Perform an initial update of the target pod list.
pf.loadTargets(ctx)

// Start the endpoints watcher goroutine.
pf.eg.Go(safety.RecoverFunc(func() (err error) {
// Create a watch on the Endpoints resource using the short syntax.
watcher, err := pf.endpointsWatcher(ctx)
if err != nil {
return err
}
defer watcher.Stop()

// Process events from the watcher channel.
for {
select {
case <-ctx.Done():
return ctx.Err()
case _, ok := <-watcher.ResultChan():
if !ok {
watcher.Stop()
log.Error("endpoints watcher channel closed, restarting watcher")
watcher, err = pf.endpointsWatcher(ctx)
if err != nil {
select {
case <-ctx.Done():
return ctx.Err()
case pf.ech <- err:
}
return err
}
} else {
// On any event, update the target pod list.
pf.loadTargets(ctx)
}
}
}
}))
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Handle endpoint watcher restarts more gracefully.

When the watcher channel closes, you immediately create a new watch. Consider adding a short backoff or retry mechanism to avoid rapidly hammering the API if repeated closures occur (for example, under network issues).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants