mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-05 21:57:09 +02:00
Fix flakiness in TestOTLPWriteHandler (#16608)
This commit is contained in:
parent
84a3acaf1b
commit
5a98246f50
@ -381,8 +381,8 @@ func TestWriteStorageApplyConfig_PartialUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOTLPWriteHandler(t *testing.T) {
|
||||
exportRequest := generateOTLPWriteRequest()
|
||||
timestamp := time.Now()
|
||||
exportRequest := generateOTLPWriteRequest(timestamp)
|
||||
for _, testCase := range []struct {
|
||||
name string
|
||||
otlpCfg config.OTLPConfig
|
||||
@ -516,15 +516,13 @@ func handleOTLP(t *testing.T, exportRequest pmetricotlp.ExportRequest, otlpCfg c
|
||||
return appendable
|
||||
}
|
||||
|
||||
func generateOTLPWriteRequest() pmetricotlp.ExportRequest {
|
||||
func generateOTLPWriteRequest(timestamp time.Time) pmetricotlp.ExportRequest {
|
||||
d := pmetric.NewMetrics()
|
||||
|
||||
// Generate One Counter, One Gauge, One Histogram, One Exponential-Histogram
|
||||
// with resource attributes: service.name="test-service", service.instance.id="test-instance", host.name="test-host"
|
||||
// with metric attribute: foo.bar="baz"
|
||||
|
||||
timestamp := time.Now()
|
||||
|
||||
resourceMetric := d.ResourceMetrics().AppendEmpty()
|
||||
resourceMetric.Resource().Attributes().PutStr("service.name", "test-service")
|
||||
resourceMetric.Resource().Attributes().PutStr("service.instance.id", "test-instance")
|
||||
|
Loading…
Reference in New Issue
Block a user