-
Notifications
You must be signed in to change notification settings - Fork 693
Expand file tree
/
Copy pathutil.go
More file actions
133 lines (103 loc) · 3.16 KB
/
util.go
File metadata and controls
133 lines (103 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package integration
// Collection of utilities to share between our various load tests
import (
"os"
"path/filepath"
"strconv"
"time"
"github.com/cortexproject/cortex/integration/e2e"
cortex_e2e "github.com/cortexproject/cortex/integration/e2e"
"github.com/grafana/dskit/backoff"
"github.com/pkg/errors"
)
const (
image = "tempo:latest"
)
func NewTempoAllInOne() *cortex_e2e.HTTPService {
args := "-config.file=" + filepath.Join(cortex_e2e.ContainerSharedDir, "config.yaml")
s := cortex_e2e.NewHTTPService(
"tempo",
image,
cortex_e2e.NewCommandWithoutEntrypoint("/tempo", args),
cortex_e2e.NewHTTPReadinessProbe(3200, "/ready", 200, 299),
3200, // http all things
14250, // jaeger grpc ingest
9411, // zipkin ingest (used by load)
)
s.SetBackoff(TempoBackoff())
return s
}
func NewTempoDistributor() *cortex_e2e.HTTPService {
args := []string{"-config.file=" + filepath.Join(cortex_e2e.ContainerSharedDir, "config.yaml"), "-target=distributor"}
s := cortex_e2e.NewHTTPService(
"distributor",
image,
cortex_e2e.NewCommandWithoutEntrypoint("/tempo", args...),
cortex_e2e.NewHTTPReadinessProbe(3200, "/ready", 200, 299),
3200,
14250,
)
s.SetBackoff(TempoBackoff())
return s
}
func NewTempoIngester(replica int) *cortex_e2e.HTTPService {
args := []string{"-config.file=" + filepath.Join(cortex_e2e.ContainerSharedDir, "config.yaml"), "-target=ingester"}
s := cortex_e2e.NewHTTPService(
"ingester-"+strconv.Itoa(replica),
image,
cortex_e2e.NewCommandWithoutEntrypoint("/tempo", args...),
cortex_e2e.NewHTTPReadinessProbe(3200, "/ready", 200, 299),
3200,
)
s.SetBackoff(TempoBackoff())
return s
}
func NewTempoQueryFrontend() *cortex_e2e.HTTPService {
args := []string{"-config.file=" + filepath.Join(cortex_e2e.ContainerSharedDir, "config.yaml"), "-target=query-frontend"}
s := cortex_e2e.NewHTTPService(
"query-frontend",
image,
cortex_e2e.NewCommandWithoutEntrypoint("/tempo", args...),
cortex_e2e.NewHTTPReadinessProbe(3200, "/ready", 200, 299),
3200,
)
s.SetBackoff(TempoBackoff())
return s
}
func NewTempoQuerier() *cortex_e2e.HTTPService {
args := []string{"-config.file=" + filepath.Join(cortex_e2e.ContainerSharedDir, "config.yaml"), "-target=querier"}
s := cortex_e2e.NewHTTPService(
"querier",
image,
cortex_e2e.NewCommandWithoutEntrypoint("/tempo", args...),
cortex_e2e.NewHTTPReadinessProbe(3200, "/ready", 200, 299),
3200,
)
s.SetBackoff(TempoBackoff())
return s
}
func WriteFileToSharedDir(s *e2e.Scenario, dst string, content []byte) error {
dst = filepath.Join(s.SharedDir(), dst)
// Ensure the entire path of directories exist.
if err := os.MkdirAll(filepath.Dir(dst), os.ModePerm); err != nil {
return err
}
return os.WriteFile(
dst,
content,
os.ModePerm)
}
func CopyFileToSharedDir(s *e2e.Scenario, src, dst string) error {
content, err := os.ReadFile(src)
if err != nil {
return errors.Wrapf(err, "unable to read local file %s", src)
}
return WriteFileToSharedDir(s, dst, content)
}
func TempoBackoff() backoff.Config {
return backoff.Config{
MinBackoff: 500 * time.Millisecond,
MaxBackoff: time.Second,
MaxRetries: 300, // Sometimes the CI is slow ¯\_(ツ)_/¯
}
}