mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-03 11:03:25 +00:00
Enhance TestDropOldTimeSeries to test both v1 and v2 protocols (#16709)
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
- Wrapped existing test logic in a loop to run with both protocol versions - Ensures consistent behavior across protocol versions for dropping old time series Signed-off-by: AxcelXander <tyz666@bu.edu> Co-authored-by: AxcelXander <tyz666@bu.edu>
This commit is contained in:
parent
94d5e0f41c
commit
472f0de661
1 changed files with 21 additions and 17 deletions
|
@ -1931,20 +1931,22 @@ func BenchmarkBuildV2WriteRequest(b *testing.B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDropOldTimeSeries(t *testing.T) {
|
func TestDropOldTimeSeries(t *testing.T) {
|
||||||
|
// Test both v1 and v2 remote write protocols
|
||||||
|
for _, protoMsg := range []config.RemoteWriteProtoMsg{config.RemoteWriteProtoMsgV1, config.RemoteWriteProtoMsgV2} {
|
||||||
|
t.Run(fmt.Sprint(protoMsg), func(t *testing.T) {
|
||||||
size := 10
|
size := 10
|
||||||
nSeries := 6
|
nSeries := 6
|
||||||
nSamples := config.DefaultQueueConfig.Capacity * size
|
nSamples := config.DefaultQueueConfig.Capacity * size
|
||||||
samples, newSamples, series := createTimeseriesWithOldSamples(nSamples, nSeries)
|
samples, newSamples, series := createTimeseriesWithOldSamples(nSamples, nSeries)
|
||||||
|
|
||||||
// TODO(alexg): test with new version
|
c := NewTestWriteClient(protoMsg)
|
||||||
c := NewTestWriteClient(config.RemoteWriteProtoMsgV1)
|
|
||||||
c.expectSamples(newSamples, series)
|
c.expectSamples(newSamples, series)
|
||||||
|
|
||||||
cfg := config.DefaultQueueConfig
|
cfg := config.DefaultQueueConfig
|
||||||
mcfg := config.DefaultMetadataConfig
|
mcfg := config.DefaultMetadataConfig
|
||||||
cfg.MaxShards = 1
|
cfg.MaxShards = 1
|
||||||
cfg.SampleAgeLimit = model.Duration(60 * time.Second)
|
cfg.SampleAgeLimit = model.Duration(60 * time.Second)
|
||||||
m := newTestQueueManager(t, cfg, mcfg, defaultFlushDeadline, c, config.RemoteWriteProtoMsgV1)
|
m := newTestQueueManager(t, cfg, mcfg, defaultFlushDeadline, c, protoMsg)
|
||||||
m.StoreSeries(series, 0)
|
m.StoreSeries(series, 0)
|
||||||
|
|
||||||
m.Start()
|
m.Start()
|
||||||
|
@ -1952,6 +1954,8 @@ func TestDropOldTimeSeries(t *testing.T) {
|
||||||
|
|
||||||
m.Append(samples)
|
m.Append(samples)
|
||||||
c.waitForExpectedData(t, 30*time.Second)
|
c.waitForExpectedData(t, 30*time.Second)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsSampleOld(t *testing.T) {
|
func TestIsSampleOld(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue