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

NO-JIRA: address MetricsCollectionProfiles failures on metal platform #29297

Merged
merged 1 commit into from
Nov 18, 2024
Merged
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
fix: address MetricsCollectionProfiles failures on metal platform
Issues with this test suite failing on bare-metal were caused due to a
missing `config.yaml` key in CMO's configuration.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
  • Loading branch information
rexagod committed Nov 14, 2024
commit df2e11139df4bf0fe7a416f351f129d3c620841a
13 changes: 11 additions & 2 deletions test/extended/prometheus/collection_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var _ = g.Describe("[sig-instrumentation][OCPFeatureGate:MetricsCollectionProfil
operatorConfiguration, err = r.kclient.CoreV1().ConfigMaps(operatorNamespaceName).Get(tctx, operatorConfigurationName, metav1.GetOptions{})
if err != nil {
if errors.IsNotFound(err) {
g.By("initially, creating a configuration for the operator as it did not exist")
err = r.makeCollectionProfileConfigurationFor(tctx, collectionProfileDefault)
}
if err != nil {
Expand All @@ -100,27 +101,34 @@ var _ = g.Describe("[sig-instrumentation][OCPFeatureGate:MetricsCollectionProfil
o.Expect(err).To(o.BeNil())
if r.originalOperatorConfiguration != nil {
currentConfiguration.Data = r.originalOperatorConfiguration.Data
g.By("restoring the original configuration for the operator")
_, err = r.kclient.CoreV1().ConfigMaps(operatorNamespaceName).Update(tctx, currentConfiguration, metav1.UpdateOptions{})
} else {
g.By("cleaning up the configuration for the operator as it did not exist pre-job")
err = r.kclient.CoreV1().ConfigMaps(operatorNamespaceName).Delete(tctx, operatorConfigurationName, metav1.DeleteOptions{})
}
o.Expect(err).To(o.BeNil())
})

g.Context("initially, in a homogeneous default environment,", func() {
profile := collectionProfileDefault

g.BeforeAll(func() {
err := r.makeCollectionProfileConfigurationFor(tctx, profile)
o.Expect(err).To(o.BeNil())
o.Eventually(func() error {
enabled, err := r.isProfileEnabled(collectionProfileDefault)
enabled, err := r.isProfileEnabled(profile)
if err != nil {
return err
}
if !enabled {
return fmt.Errorf("collection profile %q is not enabled", collectionProfileDefault)
return fmt.Errorf("collection profile %q is not enabled", profile)
}

return nil
}).Should(o.BeNil())
})

g.It("should expose default metrics", func() {
o.Eventually(func() error {
defaultOnlyMetric := "prometheus_engine_query_log_enabled"
Expand Down Expand Up @@ -344,6 +352,7 @@ func (r runner) makeCollectionProfileConfigurationFor(ctx context.Context, colle
} else {
gotDataConfigYAML, ok := configuration.Data["config.yaml"]
if !ok {
configuration.Data = make(map[string]string)
configuration.Data["config.yaml"] = dataConfigYAML
} else {
var gotDataConfigYAMLMap map[string]interface{}
Expand Down