From b371b94eeb29d3bda18dbad3c285a7d7165d9cf1 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Sat, 17 Oct 2026 02:11:27 +0200 Subject: [PATCH] test(recfilter): pin the duplicate-guard budget ceil boundary Adds an 8 Redis vs two 5-node Valkey recs case (exact 4-node spend each, expects 0 purchases) and a single-node-per-rec case. The mutant `spent = covered` now fails the first; the floor-division mutant fails both new cases (and the existing rounds-up cases). Refs #238 Co-Authored-By: Claude Opus 5.5 --- pkg/recfilter/dedupe_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/recfilter/dedupe_test.go b/pkg/recfilter/dedupe_test.go index f354b71e..69bbcc8d 100644 --- a/pkg/recfilter/dedupe_test.go +++ b/pkg/recfilter/dedupe_test.go @@ -80,6 +80,10 @@ func TestElastiCacheEngineBudgets(t *testing.T) { {"one redis covers one of two valkey", []string{"redis"}, []int{1}, []string{"valkey"}, []int{2}, []int{1}, []string{"valkey"}}, {"fractional redis leftover is not credited", []string{"redis"}, []int{2}, []string{"valkey"}, []int{3}, []int{1}, []string{"valkey"}}, {"redis spent rounds up across recs", []string{"redis"}, []int{4}, []string{"valkey", "valkey"}, []int{2, 3}, []int{1}, []string{"valkey"}}, + // 8 Redis nodes are 10 Valkey nodes: each 5-node rec spends exactly 4, so spending the covered count (5) would leave 3 and buy 2. + {"redis budget covers two exact valkey recs", []string{"redis"}, []int{8}, []string{"valkey", "valkey"}, []int{5, 5}, nil, nil}, + // Each single Valkey node spends ceil(0.8)=1 Redis node; rounding down would spend nothing and cover all five. + {"redis spent rounds up per single valkey rec", []string{"redis"}, []int{4}, []string{"valkey", "valkey", "valkey", "valkey", "valkey"}, []int{1, 1, 1, 1, 1}, []int{1}, []string{"valkey"}}, {"redis for redis stays one to one", []string{"redis"}, []int{4}, []string{"redis"}, []int{5}, []int{1}, []string{"redis"}}, } { t.Run(tt.name, func(t *testing.T) {