You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/12/15 10:50:50 UTC
[camel-k] branch main updated (4eda7fc -> 22ed86f)
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git.
from 4eda7fc Update docs with another example to runtime properties. Reported on chat room by end user.
new 38fd816 fix(e2e): Avoid nested Gomega fields matcher
new 22ed86f fix(e2e): More robust first readiness metric assertion
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
e2e/common/operator_metrics_test.go | 90 +++++++++++++++++++------------------
1 file changed, 47 insertions(+), 43 deletions(-)
[camel-k] 01/02: fix(e2e): Avoid nested Gomega fields matcher
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 38fd81649b988607b7055a5f3cda148811bd0689
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Dec 14 19:43:33 2021 +0100
fix(e2e): Avoid nested Gomega fields matcher
---
e2e/common/operator_metrics_test.go | 75 +++++++++++++++++--------------------
1 file changed, 34 insertions(+), 41 deletions(-)
diff --git a/e2e/common/operator_metrics_test.go b/e2e/common/operator_metrics_test.go
index 8c2b8d9..855b280 100644
--- a/e2e/common/operator_metrics_test.go
+++ b/e2e/common/operator_metrics_test.go
@@ -49,7 +49,8 @@ func TestMetrics(t *testing.T) {
Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Expect(Kamel("run", "-n", ns, "files/Java.java",
"-t", "prometheus.enabled=true",
- "-t", "prometheus.pod-monitor=false").Execute()).To(Succeed())
+ "-t", "prometheus.pod-monitor=false",
+ ).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
@@ -253,26 +254,22 @@ func TestMetrics(t *testing.T) {
Expect(integrationReconciliations).To(BeNumerically(">", 0))
// Check it matches the observation in the corresponding metric
- Expect(metrics["camel_k_reconciliation_duration_seconds"]).To(PointTo(MatchFields(IgnoreExtras,
- Fields{
- "Name": EqualP("camel_k_reconciliation_duration_seconds"),
- "Help": EqualP("Camel K reconciliation loop duration"),
- "Type": EqualP(prometheus.MetricType_HISTOGRAM),
- "Metric": ContainElement(MatchFieldsP(IgnoreExtras, Fields{
- "Label": ConsistOf(
- label("group", v1.SchemeGroupVersion.Group),
- label("version", v1.SchemeGroupVersion.Version),
- label("kind", "Integration"),
- label("namespace", it.Namespace),
- label("result", "Reconciled"),
- label("tag", ""),
- ),
- "Histogram": MatchFieldsP(IgnoreExtras, Fields{
- "SampleCount": EqualP(uint64(integrationReconciliations)),
- }),
- })),
- },
- )))
+ integrationReconciled := getMetric(metrics["camel_k_reconciliation_duration_seconds"],
+ MatchFieldsP(IgnoreExtras, Fields{
+ "Label": ConsistOf(
+ label("group", v1.SchemeGroupVersion.Group),
+ label("version", v1.SchemeGroupVersion.Version),
+ label("kind", "Integration"),
+ label("namespace", it.Namespace),
+ label("result", "Reconciled"),
+ label("tag", ""),
+ ),
+ }))
+ Expect(integrationReconciled).NotTo(BeNil())
+ integrationReconciledCount := *integrationReconciled.Histogram.SampleCount
+ Expect(integrationReconciledCount).To(BeNumerically(">", 0))
+
+ Expect(integrationReconciliations).To(BeNumerically("==", integrationReconciledCount))
// Count the number of IntegrationKit reconciliations
integrationKitReconciliations, err := counter.Count(MatchFields(IgnoreExtras, Fields{
@@ -285,26 +282,22 @@ func TestMetrics(t *testing.T) {
Expect(integrationKitReconciliations).To(BeNumerically(">", 0))
// Check it matches the observation in the corresponding metric
- Expect(metrics["camel_k_reconciliation_duration_seconds"]).To(PointTo(MatchFields(IgnoreExtras,
- Fields{
- "Name": EqualP("camel_k_reconciliation_duration_seconds"),
- "Help": EqualP("Camel K reconciliation loop duration"),
- "Type": EqualP(prometheus.MetricType_HISTOGRAM),
- "Metric": ContainElement(MatchFieldsP(IgnoreExtras, Fields{
- "Label": ConsistOf(
- label("group", v1.SchemeGroupVersion.Group),
- label("version", v1.SchemeGroupVersion.Version),
- label("kind", "IntegrationKit"),
- label("namespace", it.Status.IntegrationKit.Namespace),
- label("result", "Reconciled"),
- label("tag", ""),
- ),
- "Histogram": MatchFieldsP(IgnoreExtras, Fields{
- "SampleCount": EqualP(uint64(integrationKitReconciliations)),
- }),
- })),
- },
- )))
+ integrationKitReconciled := getMetric(metrics["camel_k_reconciliation_duration_seconds"],
+ MatchFieldsP(IgnoreExtras, Fields{
+ "Label": ConsistOf(
+ label("group", v1.SchemeGroupVersion.Group),
+ label("version", v1.SchemeGroupVersion.Version),
+ label("kind", "IntegrationKit"),
+ label("namespace", it.Status.IntegrationKit.Namespace),
+ label("result", "Reconciled"),
+ label("tag", ""),
+ ),
+ }))
+ Expect(integrationKitReconciled).NotTo(BeNil())
+ integrationKitReconciledCount := *integrationKitReconciled.Histogram.SampleCount
+ Expect(integrationKitReconciledCount).To(BeNumerically(">", 0))
+
+ Expect(integrationKitReconciliations).To(BeNumerically("==", integrationKitReconciledCount))
// Count the number of Build reconciliations
buildReconciliations, err := counter.Count(MatchFields(IgnoreExtras, Fields{
[camel-k] 02/02: fix(e2e): More robust first readiness metric assertion
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 22ed86f11f5722b06c61e5beecaa403010ed8678
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed Dec 15 08:38:19 2021 +0100
fix(e2e): More robust first readiness metric assertion
---
e2e/common/operator_metrics_test.go | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/e2e/common/operator_metrics_test.go b/e2e/common/operator_metrics_test.go
index 855b280..62b181b 100644
--- a/e2e/common/operator_metrics_test.go
+++ b/e2e/common/operator_metrics_test.go
@@ -435,7 +435,18 @@ func TestMetrics(t *testing.T) {
durationFromLogs := ts2.Sub(ts1)
// Check both durations match
- Expect(math.Abs((durationFromLogs - duration).Seconds())).To(BeNumerically("<", 1))
+ Expect(math.Abs((durationFromLogs - duration).Seconds())).To(BeNumerically("<=", 1))
+
+ // Retrieve the first readiness duration from the metric
+ Expect(metrics).To(HaveKey("camel_k_integration_first_readiness_seconds"))
+ metric := metrics["camel_k_integration_first_readiness_seconds"].Metric
+ Expect(metric).To(HaveLen(1))
+ histogram := metric[0].Histogram
+ Expect(histogram).NotTo(BeNil())
+
+ // Check both durations match
+ d := duration.Seconds()
+ Expect(math.Abs(*histogram.SampleSum - d)).To(BeNumerically("<=", 1))
// Check the duration is correctly observed in the corresponding metric
Expect(metrics).To(HaveKey("camel_k_integration_first_readiness_seconds"))
@@ -448,7 +459,7 @@ func TestMetrics(t *testing.T) {
{
Histogram: &prometheus.Histogram{
SampleCount: uint64P(1),
- SampleSum: float64P(duration.Seconds()),
+ SampleSum: histogram.SampleSum,
Bucket: buckets(duration.Seconds(), []float64{5, 10, 30, 60, 120, math.Inf(1)}),
},
},