Skip to content

Commit

Permalink
draft: updated E2E tests
Browse files Browse the repository at this point in the history
Signed-off-by: Aditi Ahuja <ahuja.aditi@gmail.com>
  • Loading branch information
metonymic-smokey committed Oct 1, 2022
1 parent 3d04e76 commit bf311ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
22 changes: 14 additions & 8 deletions test/e2e/e2ethanos/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,13 @@ func NewPrometheusWithSidecarCustomImage(e e2e.Environment, name, promConfig, we
if minTime != "" {
args["--min-time"] = minTime
}
sidecarRunnable := e.Runnable(fmt.Sprintf("sidecar-%s", name)).WithPorts(map[string]int{"http": 8080, "grpc": 9091}).Init(wrapWithDefaults(e2e.StartOptions{
Image: sidecarImage,
Command: e2e.NewCommand("sidecar", e2e.BuildArgs(args)...),
Readiness: e2e.NewHTTPReadinessProbe("http", "/-/ready", 200, 200),
}))
sidecarRunnable := e.Runnable(fmt.Sprintf("sidecar-%s", name)).
WithPorts(map[string]int{"http": 8080, "grpc": 9091}).
Init(wrapWithDefaults(e2e.StartOptions{
Image: sidecarImage,
Command: e2e.NewCommand("sidecar", e2e.BuildArgs(args)...),
Readiness: e2e.NewHTTPReadinessProbe("http", "/-/ready", 200, 200),
}))
sidecar := e2emon.AsInstrumented(sidecarRunnable, "http")
return prom, sidecar
}
Expand Down Expand Up @@ -206,7 +208,8 @@ func NewAvalanche(e e2e.Environment, name string, o AvalancheOptions) *e2emon.In
}

func NewPrometheusWithJaegerTracingSidecarCustomImage(e e2e.Environment, name, promConfig, webConfig,
promImage, minTime, sidecarImage, jaegerConfig string, enableFeatures ...string) (e2e.InstrumentedRunnable, e2e.InstrumentedRunnable) {
promImage, minTime, sidecarImage, jaegerConfig string, enableFeatures ...string) (
*e2emon.InstrumentedRunnable, *e2emon.InstrumentedRunnable) {
prom := NewPrometheus(e, name, promConfig, webConfig, promImage, enableFeatures...)

args := map[string]string{
Expand All @@ -225,13 +228,16 @@ func NewPrometheusWithJaegerTracingSidecarCustomImage(e e2e.Environment, name, p
if minTime != "" {
args["--min-time"] = minTime
}
sidecar := e2e.NewInstrumentedRunnable(e, fmt.Sprintf("sidecar-%s", name)).
WithPorts(map[string]int{"http": 8080, "grpc": 9091}, "http").

sidecarRunnable := e.Runnable(fmt.Sprintf("sidecar-%s", name)).
WithPorts(map[string]int{"http": 8080, "grpc": 9091}).
Init(wrapWithDefaults(e2e.StartOptions{
Image: sidecarImage,
Command: e2e.NewCommand("sidecar", e2e.BuildArgs(args)...),
Readiness: e2e.NewHTTPReadinessProbe("http", "/-/ready", 200, 200),
}))
sidecar := e2emon.AsInstrumented(sidecarRunnable, "http")

return prom, sidecar
}

Expand Down
8 changes: 5 additions & 3 deletions test/e2e/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/thanos-io/thanos/test/e2e/e2ethanos"

"github.com/efficientgo/e2e"
e2emon "github.com/efficientgo/e2e/monitoring"
"github.com/efficientgo/tools/core/pkg/testutil"
"gopkg.in/yaml.v2"
)
Expand All @@ -31,18 +32,19 @@ func TestJaegerTracing(t *testing.T) {
testutil.Ok(t, err)
t.Cleanup(env.Close)
name := "testing"
newJaeger := e2e.NewInstrumentedRunnable(env, fmt.Sprintf("jaeger-%s", name)).
newJaegerRunnable := env.Runnable(fmt.Sprintf("jaeger-%s", name)).
WithPorts(
map[string]int{
"http": 16686,
"http.admin": 14269,
"jaeger.thrift-model.proto": 14250,
"jaeger.thrift": 14268,
}, "http.admin").
}).
Init(e2e.StartOptions{
Image: "jaegertracing/all-in-one:1.33",
Readiness: e2e.NewHTTPReadinessProbe("http.admin", "/", 200, 200),
Readiness: e2e.NewHTTPReadinessProbe("http", "/", 200, 200),
})
newJaeger := e2emon.AsInstrumented(newJaegerRunnable, "http")
testutil.Ok(t, e2e.StartAndWaitReady(newJaeger))

jaegerConfig, err := yaml.Marshal(client.TracingConfig{
Expand Down

0 comments on commit bf311ad

Please sign in to comment.