Skip to content

Conversation

karina-ranadive
Copy link

Reason for Change:

Issue Fixed:

Requirements:

Notes:

@karina-ranadive karina-ranadive requested a review from a team as a code owner October 17, 2025 20:32
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds negative Local Redirect Policy (LRP) test scenarios and parameterizes Prometheus endpoint usage in existing LRP tests.

  • Extends testLRPCase to accept a Prometheus address for flexible metric validation.
  • Introduces comprehensive negative and resilience LRP tests (resource recreation, pod restarts, cilium validation).
  • Adds helper functions for validating Cilium LRP state and recreating test resources.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/integration/lrp/lrp_test.go Adds negative LRP test flow, Prometheus address parameter, and Cilium/LRP validation helpers.
test/integration/lrp/lrp_fqdn_test.go Updates calls to testLRPCase to include the new Prometheus address parameter.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

require.Greater(t, afterValue, beforeValue, "dns metric count did not increase after command - before: %.0f, after: %.0f", beforeValue, afterValue)
} else {
require.Equal(t, afterMetric.GetCounter().GetValue(), beforeMetric.GetCounter().GetValue(), "dns metric count increased after command")
require.Equal(t, afterValue, beforeValue, "dns metric count increased after command - before: %.0f, after: %.0f", beforeValue, afterValue)
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

The testify assertions use formatted messages with placeholders but require.Greater and require.Equal do not perform format substitution; use require.Greaterf / require.Equalf or pre-format the message with fmt.Sprintf to ensure values appear in failure output.

Suggested change
require.Equal(t, afterValue, beforeValue, "dns metric count increased after command - before: %.0f, after: %.0f", beforeValue, afterValue)
require.Equalf(t, afterValue, beforeValue, "dns metric count increased after command - before: %.0f, after: %.0f", beforeValue, afterValue)

Copilot uses AI. Check for mistakes.

Comment on lines +475 to +476
// Wait for deletion to complete
time.Sleep(10 * time.Second)
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

Fixed sleep introduces unnecessary delay and potential flakiness; replace with a poll-based wait (e.g., repeatedly checking for resource absence/recreation with a timeout) to reduce test duration and improve reliability.

Suggested change
// Wait for deletion to complete
time.Sleep(10 * time.Second)
// Wait for deletion to complete (poll for absence of client DaemonSet and LRP)
retry.DoWithTimeout(ctx, "wait for client DaemonSet deletion", 30*time.Second, func(ctx context.Context) (bool, error) {
_, err := dsClient.Get(ctx, clientDS.Name, metav1.GetOptions{})
if err != nil {
// DaemonSet not found
return true, nil
}
// Still exists
return false, nil
})
retry.DoWithTimeout(ctx, "wait for LRP deletion", 30*time.Second, func(ctx context.Context) (bool, error) {
_, err := lrpClient.Get(ctx, lrp.Name, metav1.GetOptions{})
if err != nil {
// LRP not found
return true, nil
}
// Still exists
return false, nil
})

Copilot uses AI. Check for mistakes.

@karina-ranadive karina-ranadive force-pushed the karanadive/lrp-negative-test branch from 321a3ea to ba2b602 Compare October 17, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant