Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e integrations test for GCS #883

Merged
merged 1 commit into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 53 additions & 2 deletions integration/e2e/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ import (
"github.com/grafana/tempo/tempodb/backend/azure"
)

const (
azuriteImage = "mcr.microsoft.com/azure-storage/azurite"
gcsImage = "fsouza/fake-gcs-server"
)

func parsePort(endpoint string) (int, error) {
substrings := strings.Split(endpoint, ":")
port, err := strconv.Atoi(substrings[len(substrings)-1])
portStrings := strings.Split(substrings[len(substrings)-1], "/")
port, err := strconv.Atoi(portStrings[0])
if err != nil {
return 0, err
}
Expand Down Expand Up @@ -43,7 +49,7 @@ func New(scenario *e2e.Scenario, cfg app.Config) (*e2e.HTTPService, error) {
if err != nil {
return nil, err
}
backendService = util.NewAzurite(port)
backendService = NewAzurite(port)
err = scenario.StartAndWaitReady(backendService)
if err != nil {
return nil, err
Expand All @@ -53,7 +59,52 @@ func New(scenario *e2e.Scenario, cfg app.Config) (*e2e.HTTPService, error) {
if err != nil {
return nil, err
}
case "gcs":
port, err := parsePort(cfg.StorageConfig.Trace.GCS.Endpoint)
if err != nil {
return nil, err
}
backendService = NewGCS(port)
if backendService == nil {
return nil, fmt.Errorf("error creating gcs backend")
}
err = scenario.StartAndWaitReady(backendService)
if err != nil {
return nil, err
}
}

return backendService, nil
}

func NewAzurite(port int) *e2e.HTTPService {
s := e2e.NewHTTPService(
"azurite",
azuriteImage, // Create the the azurite container
e2e.NewCommandWithoutEntrypoint("sh", "-c", "azurite -l /data --blobHost 0.0.0.0"),
e2e.NewHTTPReadinessProbe(port, "/devstoreaccount1?comp=list", 403, 403), //If we get 403 the Azurite is ready
port, // blob storage port
)

s.SetBackoff(util.TempoBackoff())

return s
}

func NewGCS(port int) *e2e.HTTPService {
commands := []string{
"mkdir -p /data/tempo",
"/bin/fake-gcs-server -data /data -public-host=tempo_e2e-gcs -port=4443",
}
s := e2e.NewHTTPService(
"gcs",
gcsImage, // Create the the gcs container
e2e.NewCommandWithoutEntrypoint("sh", "-c", strings.Join(commands, " && ")),
e2e.NewHTTPReadinessProbe(port, "/", 400, 400), // for lack of a better way, readiness probe does not support https at the moment
port,
)

s.SetBackoff(util.TempoBackoff())

return s
}
36 changes: 36 additions & 0 deletions integration/e2e/config-all-in-one-gcs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
target: all

server:
http_listen_port: 3200

distributor:
receivers:
jaeger:
protocols:
grpc:

ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
trace_idle_period: 100ms
max_block_bytes: 1
max_block_duration: 2s
complete_block_timeout: 1s
flush_check_period: 1s

storage:
trace:
blocklist_poll: 2s
backend: gcs
gcs:
bucket_name: tempo
endpoint: https://tempo_e2e-gcs:4443/storage/v1/
insecure: true
pool:
max_workers: 10
queue_depth: 1000
5 changes: 5 additions & 0 deletions integration/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (

configAllInOneS3 = "config-all-in-one-s3.yaml"
configAllInOneAzurite = "config-all-in-one-azurite.yaml"
configAllInOneGCS = "config-all-in-one-gcs.yaml"
)

func TestAllInOne(t *testing.T) {
Expand All @@ -46,6 +47,10 @@ func TestAllInOne(t *testing.T) {
name: "azure",
configFile: configAllInOneAzurite,
},
{
name: "gcs",
configFile: configAllInOneGCS,
},
}

for _, tc := range testBackends {
Expand Down
29 changes: 7 additions & 22 deletions integration/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (
)

const (
image = "tempo:latest"
azuriteImage = "mcr.microsoft.com/azure-storage/azurite"
image = "tempo:latest"
)

func NewTempoAllInOne() *cortex_e2e.HTTPService {
Expand All @@ -33,21 +32,7 @@ func NewTempoAllInOne() *cortex_e2e.HTTPService {
9411, // zipkin ingest (used by load)
)

s.SetBackoff(tempoBackoff())

return s
}

func NewAzurite(port int) *cortex_e2e.HTTPService {
s := cortex_e2e.NewHTTPService(
"azurite",
azuriteImage, // Create the the azurite container
e2e.NewCommandWithoutEntrypoint("sh", "-c", "azurite -l /data --blobHost 0.0.0.0"),
e2e.NewHTTPReadinessProbe(port, "/devstoreaccount1?comp=list", 403, 403), //If we get 403 the Azurite is ready
port, // blob storage port
)

s.SetBackoff(tempoBackoff())
s.SetBackoff(TempoBackoff())

return s
}
Expand All @@ -64,7 +49,7 @@ func NewTempoDistributor() *cortex_e2e.HTTPService {
14250,
)

s.SetBackoff(tempoBackoff())
s.SetBackoff(TempoBackoff())

return s
}
Expand All @@ -80,7 +65,7 @@ func NewTempoIngester(replica int) *cortex_e2e.HTTPService {
3200,
)

s.SetBackoff(tempoBackoff())
s.SetBackoff(TempoBackoff())

return s
}
Expand All @@ -96,7 +81,7 @@ func NewTempoQueryFrontend() *cortex_e2e.HTTPService {
3200,
)

s.SetBackoff(tempoBackoff())
s.SetBackoff(TempoBackoff())

return s
}
Expand All @@ -112,7 +97,7 @@ func NewTempoQuerier() *cortex_e2e.HTTPService {
3200,
)

s.SetBackoff(tempoBackoff())
s.SetBackoff(TempoBackoff())

return s
}
Expand Down Expand Up @@ -140,7 +125,7 @@ func CopyFileToSharedDir(s *e2e.Scenario, src, dst string) error {
return WriteFileToSharedDir(s, dst, content)
}

func tempoBackoff() util.BackoffConfig {
func TempoBackoff() util.BackoffConfig {
annanay25 marked this conversation as resolved.
Show resolved Hide resolved
return util.BackoffConfig{
MinBackoff: 500 * time.Millisecond,
MaxBackoff: time.Second,
Expand Down