This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 7742ef8b6a8dd8f057da55f7b8542fccc6ffc8cf Author: Antonin Stefanutti <anto...@stefanutti.fr> AuthorDate: Fri May 29 17:43:14 2020 +0200 fix(prometheus): Assume service exposition is enabled when a service already exists --- pkg/trait/prometheus.go | 2 ++ pkg/trait/prometheus_test.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/trait/prometheus.go b/pkg/trait/prometheus.go index e4b0e34..94bb988 100644 --- a/pkg/trait/prometheus.go +++ b/pkg/trait/prometheus.go @@ -139,6 +139,8 @@ func (t *prometheusTrait) Apply(e *Environment) (err error) { service = getServiceFor(e) e.Resources.Add(service) } + } else { + serviceEnabled = true } // Add the service port and service monitor resource diff --git a/pkg/trait/prometheus_test.go b/pkg/trait/prometheus_test.go index 579b159..53a8179 100644 --- a/pkg/trait/prometheus_test.go +++ b/pkg/trait/prometheus_test.go @@ -103,7 +103,7 @@ func TestApplyPrometheusTraitWithoutContainerDoesNotSucceed(t *testing.T) { assert.Equal(t, corev1.ConditionFalse, condition.Status) } -func TestApplyPrometheusTraitWithServiceDoesNotSucceed(t *testing.T) { +func TestApplyPrometheusTraitWithServiceDoesSucceed(t *testing.T) { trait, environment := createNominalPrometheusTest() environment.Resources = kubernetes.NewCollection( &appsv1.Deployment{ @@ -146,8 +146,8 @@ func TestApplyPrometheusTraitWithServiceDoesNotSucceed(t *testing.T) { assert.Len(t, environment.Integration.Status.Conditions, 1) condition := environment.Integration.Status.Conditions[0] - assert.Equal(t, v1.IntegrationConditionServiceNotAvailableReason, condition.Reason) - assert.Equal(t, corev1.ConditionFalse, condition.Status) + assert.Equal(t, v1.IntegrationConditionPrometheusAvailableReason, condition.Reason) + assert.Equal(t, corev1.ConditionTrue, condition.Status) } func TestPrometheusTraitGetServiceMonitor(t *testing.T) {