mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Add new test client
Signed-off-by: Callum Styan <callumstyan@gmail.com>
This commit is contained in:
parent
8673d355d9
commit
16924eeee6
|
@ -19,6 +19,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -330,3 +331,26 @@ func (c *Client) Read(ctx context.Context, query *prompb.Query) (*prompb.QueryRe
|
||||||
|
|
||||||
return resp.Results[0], nil
|
return resp.Results[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TestClient struct {
|
||||||
|
name string
|
||||||
|
url string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTestClient(name, url string) WriteClient {
|
||||||
|
return &TestClient{name: name, url: url}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *TestClient) Store(_ context.Context, req []byte) error {
|
||||||
|
r := rand.Intn(200-100) + 100
|
||||||
|
time.Sleep(time.Duration(r) * time.Millisecond)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *TestClient) Name() string {
|
||||||
|
return c.name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *TestClient) Endpoint() string {
|
||||||
|
return c.url
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue