MCPcopy
hub / github.com/prometheus/pushgateway / TestNoPersistence

Function TestNoPersistence

storage/diskmetricstore_test.go:1015–1058  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1013}
1014
1015func TestNoPersistence(t *testing.T) {
1016 dms := NewDiskMetricStore("", 100*time.Millisecond, nil, logger)
1017
1018 ts1 := time.Now()
1019 grouping1 := map[string]string{
1020 "job": "job1",
1021 "instance": "instance1",
1022 }
1023 errCh := make(chan error, 1)
1024 dms.SubmitWriteRequest(WriteRequest{
1025 Labels: grouping1,
1026 Timestamp: ts1,
1027 MetricFamilies: testutil.MetricFamiliesMap(mf3),
1028 Done: errCh,
1029 })
1030 for err := range errCh {
1031 t.Fatal("Unexpected error:", err)
1032 }
1033 pushTimestamp := newPushTimestampGauge(grouping1, ts1)
1034 pushFailedTimestamp := newPushFailedTimestampGauge(grouping1, time.Time{})
1035 if err := checkMetricFamilies(
1036 dms, mf3,
1037 pushTimestamp, pushFailedTimestamp,
1038 ); err != nil {
1039 t.Error(err)
1040 }
1041
1042 if err := dms.Shutdown(); err != nil {
1043 t.Fatal(err)
1044 }
1045
1046 dms = NewDiskMetricStore("", 100*time.Millisecond, nil, logger)
1047 if err := checkMetricFamilies(dms); err != nil {
1048 t.Error(err)
1049 }
1050
1051 if err := dms.Ready(); err != nil {
1052 t.Error(err)
1053 }
1054
1055 if err := dms.Healthy(); err != nil {
1056 t.Error(err)
1057 }
1058}
1059
1060func TestRejectTimestamps(t *testing.T) {
1061 dms := NewDiskMetricStore("", 100*time.Millisecond, nil, logger)

Callers

nothing calls this directly

Calls 10

SubmitWriteRequestMethod · 0.95
ShutdownMethod · 0.95
ReadyMethod · 0.95
HealthyMethod · 0.95
MetricFamiliesMapFunction · 0.92
NewDiskMetricStoreFunction · 0.85
newPushTimestampGaugeFunction · 0.85
checkMetricFamiliesFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…