MCPcopy
hub / github.com/keploy/keploy / FilterPerTestAndLaxPromotedTierAware

Function FilterPerTestAndLaxPromotedTierAware

pkg/util.go:2933–2944  ·  view source on GitHub ↗

FilterPerTestAndLaxPromotedTierAware is the tier-aware variant of FilterPerTestAndLaxPromoted. It accepts firstWindowStart (the earliest test window start observed by the agent's MockManager, or zero before any real test has fired) so the strict gate can preserve per-test startup-init mocks (req < f

(ctx context.Context, logger *zap.Logger, m []*models.Mock, afterTime time.Time, beforeTime time.Time, strict bool, firstWindowStart time.Time)

Source from the content-addressed store, hash-verified

2931// test). Legacy callers that don't know firstWindowStart can keep
2932// calling FilterPerTestAndLaxPromoted unchanged.
2933func FilterPerTestAndLaxPromotedTierAware(ctx context.Context, logger *zap.Logger, m []*models.Mock, afterTime time.Time, beforeTime time.Time, strict bool, firstWindowStart time.Time) ([]*models.Mock, []*models.Mock) {
2934 perTestInWindow, promotedToSession := filterByTimeStampTierAware(ctx, logger, m, afterTime, beforeTime, strict, firstWindowStart)
2935
2936 sort.SliceStable(perTestInWindow, func(i, j int) bool {
2937 return perTestInWindow[i].Spec.ReqTimestampMock.Before(perTestInWindow[j].Spec.ReqTimestampMock)
2938 })
2939 sort.SliceStable(promotedToSession, func(i, j int) bool {
2940 return promotedToSession[i].Spec.ReqTimestampMock.Before(promotedToSession[j].Spec.ReqTimestampMock)
2941 })
2942
2943 return perTestInWindow, promotedToSession
2944}
2945
2946// FilterConfigMocks applies the per-test time-window filter to the config
2947// mock pool. Pass strict=true for Option-1 containment (out-of-window

Callers 2

UpdateMockParamsMethod · 0.92

Calls 1

Tested by

no test coverage detected