mirror of
https://github.com/prometheus/prometheus
synced 2024-12-26 00:23:18 +00:00
storage/remote: check errors from ApplyConfig in tests
So tests do not produce obscure errors when applying configuration fails. Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
This commit is contained in:
parent
4ef8c7c1d8
commit
116552cc58
@ -218,7 +218,7 @@ func TestWriteStorageLifecycle(t *testing.T) {
|
|||||||
&config.DefaultRemoteWriteConfig,
|
&config.DefaultRemoteWriteConfig,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
s.ApplyConfig(conf)
|
require.NoError(t, s.ApplyConfig(conf))
|
||||||
require.Equal(t, 1, len(s.queues))
|
require.Equal(t, 1, len(s.queues))
|
||||||
|
|
||||||
err = s.Close()
|
err = s.Close()
|
||||||
@ -243,14 +243,14 @@ func TestUpdateExternalLabels(t *testing.T) {
|
|||||||
}
|
}
|
||||||
hash, err := toHash(conf.RemoteWriteConfigs[0])
|
hash, err := toHash(conf.RemoteWriteConfigs[0])
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
s.ApplyConfig(conf)
|
require.NoError(t, s.ApplyConfig(conf))
|
||||||
require.Equal(t, 1, len(s.queues))
|
require.Equal(t, 1, len(s.queues))
|
||||||
require.Equal(t, labels.Labels(nil), s.queues[hash].externalLabels)
|
require.Equal(t, labels.Labels(nil), s.queues[hash].externalLabels)
|
||||||
|
|
||||||
conf.GlobalConfig.ExternalLabels = externalLabels
|
conf.GlobalConfig.ExternalLabels = externalLabels
|
||||||
hash, err = toHash(conf.RemoteWriteConfigs[0])
|
hash, err = toHash(conf.RemoteWriteConfigs[0])
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
s.ApplyConfig(conf)
|
require.NoError(t, s.ApplyConfig(conf))
|
||||||
require.Equal(t, 1, len(s.queues))
|
require.Equal(t, 1, len(s.queues))
|
||||||
require.Equal(t, externalLabels, s.queues[hash].externalLabels)
|
require.Equal(t, externalLabels, s.queues[hash].externalLabels)
|
||||||
|
|
||||||
@ -282,10 +282,10 @@ func TestWriteStorageApplyConfigsIdempotent(t *testing.T) {
|
|||||||
hash, err := toHash(conf.RemoteWriteConfigs[0])
|
hash, err := toHash(conf.RemoteWriteConfigs[0])
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
s.ApplyConfig(conf)
|
require.NoError(t, s.ApplyConfig(conf))
|
||||||
require.Equal(t, 1, len(s.queues))
|
require.Equal(t, 1, len(s.queues))
|
||||||
|
|
||||||
s.ApplyConfig(conf)
|
require.NoError(t, s.ApplyConfig(conf))
|
||||||
require.Equal(t, 1, len(s.queues))
|
require.Equal(t, 1, len(s.queues))
|
||||||
_, hashExists := s.queues[hash]
|
_, hashExists := s.queues[hash]
|
||||||
require.True(t, hashExists, "Queue pointer should have remained the same")
|
require.True(t, hashExists, "Queue pointer should have remained the same")
|
||||||
@ -391,7 +391,7 @@ func TestWriteStorageApplyConfigsPartialUpdate(t *testing.T) {
|
|||||||
GlobalConfig: config.GlobalConfig{},
|
GlobalConfig: config.GlobalConfig{},
|
||||||
RemoteWriteConfigs: []*config.RemoteWriteConfig{c1, c2},
|
RemoteWriteConfigs: []*config.RemoteWriteConfig{c1, c2},
|
||||||
}
|
}
|
||||||
s.ApplyConfig(conf)
|
require.NoError(t, s.ApplyConfig(conf))
|
||||||
require.Equal(t, 2, len(s.queues))
|
require.Equal(t, 2, len(s.queues))
|
||||||
|
|
||||||
_, hashExists = s.queues[hashes[0]]
|
_, hashExists = s.queues[hashes[0]]
|
||||||
|
Loading…
Reference in New Issue
Block a user