mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
tsdb tests: avoid capture-by-reference in goroutines
Only one version of the variable is captured; this is a source of race conditions. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
54cf0d6879
commit
f4fbe47254
|
@ -1575,12 +1575,13 @@ func TestHeadCompactionWithHistograms(t *testing.T) {
|
|||
func TestSparseHistogramSpaceSavings(t *testing.T) {
|
||||
t.Skip()
|
||||
|
||||
cases := []struct {
|
||||
type testcase struct {
|
||||
numSeriesPerSchema int
|
||||
numBuckets int
|
||||
numSpans int
|
||||
gapBetweenSpans int
|
||||
}{
|
||||
}
|
||||
cases := []testcase{
|
||||
{1, 15, 1, 0},
|
||||
{1, 50, 1, 0},
|
||||
{1, 100, 1, 0},
|
||||
|
@ -1692,7 +1693,7 @@ func TestSparseHistogramSpaceSavings(t *testing.T) {
|
|||
}()
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
go func(c testcase) {
|
||||
defer wg.Done()
|
||||
|
||||
// Ingest histograms the old way.
|
||||
|
@ -1740,7 +1741,7 @@ func TestSparseHistogramSpaceSavings(t *testing.T) {
|
|||
oldULIDs, err = compactor.Write(oldHead.opts.ChunkDirRoot, oldHead, mint, maxt, nil)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, oldULIDs, 1)
|
||||
}()
|
||||
}(c)
|
||||
|
||||
wg.Wait()
|
||||
|
||||
|
|
|
@ -694,9 +694,9 @@ func (h *Head) loadWBL(r *wlog.Reader, syms *labels.SymbolTable, multiRef map[ch
|
|||
|
||||
go func() {
|
||||
defer close(decodedCh)
|
||||
var err error
|
||||
dec := record.NewDecoder(syms)
|
||||
for r.Next() {
|
||||
var err error
|
||||
rec := r.Record()
|
||||
switch dec.Type(rec) {
|
||||
case record.Samples:
|
||||
|
|
Loading…
Reference in a new issue