Skip to content

Commit

Permalink
functionaltests: restart Integrations Server after ingestion (#15356)
Browse files Browse the repository at this point in the history
* expose deployment id

* add ecclient package

* restart apm-server after ingest

* refactor RunBlockingWait to restart APM Server

This removes the previous implementation with document
count checks and the logic that was trying to ensure
ingestion was completed.
The method now relies only on restarting the APM Server.
  • Loading branch information
endorama authored Jan 24, 2025
1 parent 7995693 commit c230240
Show file tree
Hide file tree
Showing 8 changed files with 532 additions and 58 deletions.
12 changes: 10 additions & 2 deletions functionaltests/8_15_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zaptest"

"github.com/elastic/apm-server/functionaltests/internal/ecclient"
"github.com/elastic/apm-server/functionaltests/internal/esclient"
"github.com/elastic/apm-server/functionaltests/internal/gen"
"github.com/elastic/apm-server/functionaltests/internal/terraform"
Expand Down Expand Up @@ -59,6 +60,8 @@ func TestUpgrade_8_15_4_to_8_16_0(t *testing.T) {
}
})

var deploymentID string
require.NoError(t, tf.Output("deployment_id", &deploymentID))
var escfg esclient.Config
tf.Output("apm_url", &escfg.APMServerURL)
tf.Output("es_url", &escfg.ElasticsearchURL)
Expand All @@ -68,6 +71,9 @@ func TestUpgrade_8_15_4_to_8_16_0(t *testing.T) {

t.Logf("created deployment %s", escfg.KibanaURL)

c, err := ecclient.New(endpointFrom(*target))
require.NoError(t, err)

ecc, err := esclient.New(escfg)
require.NoError(t, err)

Expand All @@ -81,7 +87,8 @@ func TestUpgrade_8_15_4_to_8_16_0(t *testing.T) {
previous, err := getDocsCountPerDS(t, ctx, ecc)
require.NoError(t, err)

g.RunBlockingWait(ctx, ecc, expectedIngestForASingleRun(), previous, 1*time.Minute)
require.NoError(t, g.RunBlockingWait(ctx, c, deploymentID))
t.Logf("time elapsed: %s", time.Now().Sub(start))

beforeUpgradeCount, err := getDocsCountPerDS(t, ctx, ecc)
require.NoError(t, err)
Expand Down Expand Up @@ -124,7 +131,8 @@ func TestUpgrade_8_15_4_to_8_16_0(t *testing.T) {
IndicesManagedBy: []string{"Data stream lifecycle"},
}, dss)

g.RunBlockingWait(ctx, ecc, expectedIngestForASingleRun(), previous, 1*time.Minute)
require.NoError(t, g.RunBlockingWait(ctx, c, deploymentID))
t.Logf("time elapsed: %s", time.Now().Sub(start))

t.Log("check number of documents")
afterUpgradeIngestionCount, err := getDocsCountPerDS(t, ctx, ecc)
Expand Down
4 changes: 4 additions & 0 deletions functionaltests/TestUpgrade_8_15_4_to_8_16_0/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ output "password" {
output "kb_url" {
value = module.ec_deployment.kibana_url
}

output "deployment_id" {
value = module.ec_deployment.deployment_id
}
22 changes: 22 additions & 0 deletions functionaltests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.23.2

require (
github.com/elastic/apm-perf v0.0.0-20241230130730-2ad47482b731
github.com/elastic/cloud-sdk-go v1.23.0
github.com/elastic/go-elasticsearch/v8 v8.16.0
github.com/hashicorp/terraform-exec v0.21.0
github.com/stretchr/testify v1.10.0
Expand All @@ -13,13 +14,32 @@ require (
require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/elastic/elastic-transport-go/v8 v8.6.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.21.2 // indirect
github.com/go-openapi/errors v0.20.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/loads v0.21.1 // indirect
github.com/go-openapi/runtime v0.23.0 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/strfmt v0.21.2 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
github.com/go-openapi/validate v0.20.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/terraform-json v0.22.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
Expand All @@ -29,6 +49,7 @@ require (
github.com/zclconf/go-cty v1.14.4 // indirect
go.elastic.co/apm/v2 v2.6.2 // indirect
go.elastic.co/fastjson v1.4.0 // indirect
go.mongodb.org/mongo-driver v1.10.0 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect
Expand All @@ -38,5 +59,6 @@ require (
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.8.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit c230240

Please sign in to comment.