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

Remove data stream check for Fleet/Agent e2e tests #7522

Merged
merged 3 commits into from
Jan 31, 2024
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
14 changes: 2 additions & 12 deletions test/e2e/agent/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,7 @@ func TestFleetMode(t *testing.T) {
WithFleetServer().
WithElasticsearchRefs(agent.ToOutput(esBuilder.Ref(), "default")).
WithKibanaRef(kbBuilder.Ref()).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.metricbeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.metricbeat", "default"))
WithFleetAgentDataStreamsValidation()

kbBuilder = kbBuilder.WithConfig(fleetConfigForKibana(t, fleetServerBuilder.Agent.Spec.Version, esBuilder.Ref(), fleetServerBuilder.Ref(), true))

Expand All @@ -177,12 +172,7 @@ func TestFleetMode(t *testing.T) {
WithFleetServer().
WithElasticsearchRefs(agent.ToOutput(esBuilder.Ref(), "default")).
WithKibanaRef(kbBuilder.Ref()).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.metricbeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.metricbeat", "default"))
WithFleetAgentDataStreamsValidation()

kbBuilder = kbBuilder.WithConfig(fleetConfigForKibana(t, fleetServerBuilder.Agent.Spec.Version, esBuilder.Ref(), fleetServerBuilder.Ref(), true))

Expand Down
42 changes: 7 additions & 35 deletions test/e2e/agent/recipes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,8 @@ func TestFleetKubernetesIntegrationRecipe(t *testing.T) {
return builder
}

return builder.
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.metricbeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.metricbeat", "default")).
builder = builder.
WithFleetAgentDataStreamsValidation().
// TODO API server should generate event in time but on kind we see repeatedly no metrics being reported in time
// see https://github.com/elastic/cloud-on-k8s/issues/4092
// WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "kubernetes.apiserver", "k8s")).
Expand All @@ -124,6 +117,8 @@ func TestFleetKubernetesIntegrationRecipe(t *testing.T) {
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "system.process.summary", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "system.socket_summary", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "system.uptime", "default"))

return builder
}

runAgentRecipe(t, "fleet-kubernetes-integration.yaml", customize)
Expand All @@ -148,14 +143,7 @@ func TestFleetKubernetesNonRootIntegrationRecipe(t *testing.T) {
}

return builder.
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.metricbeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.metricbeat", "default")).
WithFleetAgentDataStreamsValidation().
// TODO API server should generate event in time but on kind we see repeatedly no metrics being reported in time
// see https://github.com/elastic/cloud-on-k8s/issues/4092
// WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "kubernetes.apiserver", "k8s")).
Expand Down Expand Up @@ -200,14 +188,8 @@ func TestFleetCustomLogsIntegrationRecipe(t *testing.T) {
}

return builder.
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "generic", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.metricbeat", "default")).
WithFleetAgentDataStreamsValidation().
WithDefaultESValidation(agent.HasEvent("/_search?q=message:" + loggingPod.Logged)).
WithDefaultESValidation(agent.NoEvent("/_search?q=message:" + notLoggingPod.Logged))
}
Expand All @@ -220,18 +202,8 @@ func TestFleetAPMIntegrationRecipe(t *testing.T) {
if !builder.Agent.Spec.FleetServerEnabled {
return builder
}

return builder.
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.apm_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.apm_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.metricbeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.filebeat", "default"))
return builder.WithFleetAgentDataStreamsValidation()
}

runAgentRecipe(t, "fleet-apm-integration.yaml", customize)
}

Expand Down
7 changes: 1 addition & 6 deletions test/e2e/agent/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ func TestFleetAgentWithoutTLS(t *testing.T) {
WithElasticsearchRefs(agent.ToOutput(esBuilder.Ref(), "default")).
WithKibanaRef(kbBuilder.Ref()).
WithTLSDisabled(true).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.metricbeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.metricbeat", "default"))
WithFleetAgentDataStreamsValidation()

kbBuilder = kbBuilder.WithConfig(fleetConfigForKibana(t, fleetServerBuilder.Agent.Spec.Version, esBuilder.Ref(), fleetServerBuilder.Ref(), false))

Expand Down
7 changes: 1 addition & 6 deletions test/e2e/agent/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ func TestAgentVersionUpgradeToLatest8x(t *testing.T) {
WithFleetServer().
WithElasticsearchRefs(agent.ToOutput(esBuilder.Ref(), "default")).
WithKibanaRef(kbBuilder.Ref()).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.LogsType, "elastic_agent.metricbeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.elastic_agent", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(agent.HasWorkingDataStream(agent.MetricsType, "elastic_agent.metricbeat", "default"))
WithFleetAgentDataStreamsValidation()

kbBuilder = kbBuilder.WithConfig(fleetConfigForKibana(t, fleetServerBuilder.Agent.Spec.Version, esBuilder.Ref(), fleetServerBuilder.Ref(), true))

Expand Down
17 changes: 17 additions & 0 deletions test/e2e/test/agent/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,23 @@ func (b Builder) WithESValidation(validation ValidationFunc, outputName string)
return b
}

func (b Builder) WithFleetAgentDataStreamsValidation() Builder {
v := version.MustParse(test.Ctx().ElasticStackVersion)
b = b.
WithDefaultESValidation(HasWorkingDataStream(LogsType, "elastic_agent", "default")).
WithDefaultESValidation(HasWorkingDataStream(LogsType, "elastic_agent.filebeat", "default")).
WithDefaultESValidation(HasWorkingDataStream(LogsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(HasWorkingDataStream(LogsType, "elastic_agent.metricbeat", "default")).
WithDefaultESValidation(HasWorkingDataStream(MetricsType, "elastic_agent.elastic_agent", "default")).
WithDefaultESValidation(HasWorkingDataStream(MetricsType, "elastic_agent.fleet_server", "default")).
WithDefaultESValidation(HasWorkingDataStream(MetricsType, "elastic_agent.metricbeat", "default"))
// https://github.com/elastic/cloud-on-k8s/issues/7389
if v.LT(version.MinFor(8, 12, 0)) || v.GE(version.MinFor(8, 14, 0)) {
b = b.WithDefaultESValidation(HasWorkingDataStream(MetricsType, "elastic_agent.filebeat", "default"))
}
return b
}

func (b Builder) WithElasticsearchRefs(refs ...agentv1alpha1.Output) Builder {
b.Agent.Spec.ElasticsearchRefs = refs
return b
Expand Down