Skip to content

aggregate cluster circuit breaker integration tests#35

Open
bazmurphy wants to merge 4 commits intomainfrom
aggregate-cluster-integration-test-circuit-breakers
Open

aggregate cluster circuit breaker integration tests#35
bazmurphy wants to merge 4 commits intomainfrom
aggregate-cluster-integration-test-circuit-breakers

Conversation

@bazmurphy
Copy link
Owner

@bazmurphy bazmurphy commented Apr 16, 2025

The version before we add it to the upstream PR

bazmurphy and others added 3 commits April 16, 2025 00:06
Co-authored-by: Saadia El fekak <74792703+SaadiaELF@users.noreply.github.com>
Signed-off-by: Baz Murphy <61154071+bazmurphy@users.noreply.github.com>
Signed-off-by: Saadia El fekak <74792703+SaadiaELF@users.noreply.github.com>
Co-authored-by: Saadia El fekak <74792703+SaadiaELF@users.noreply.github.com>
Signed-off-by: Baz Murphy <61154071+bazmurphy@users.noreply.github.com>
Signed-off-by: Saadia El fekak <74792703+SaadiaELF@users.noreply.github.com>
Co-authored-by: Saadia El fekak <74792703+SaadiaELF@users.noreply.github.com>
Signed-off-by: Baz Murphy <61154071+bazmurphy@users.noreply.github.com>
Signed-off-by: Saadia El fekak <74792703+SaadiaELF@users.noreply.github.com>
Copy link
Collaborator

@nahratzah nahratzah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments for some small nits I have.
Feel free to accept them or reject them, they're really small things. <3

This is REALLY GOOD and READABLE! Love it. :)


reduceAggregateClustersListToOneCluster(*aggregate_cluster);
setCircuitBreakerLimits(*aggregate_cluster, CircuitBreakerLimits{.max_connections = 1});
setMaxConcurrentStreams(*aggregate_cluster, 1U);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine, but I don't think you need the U in 1U, because the compiler should be able to figure that out on its own in this context. :)

(But you can keep it if you like it, or find out I'm wrong.) <3

initialize();

setCircuitBreakerLimits(cluster1_, CircuitBreakerLimits{.max_connections = 1});
setMaxConcurrentStreams(cluster1_, 1U);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, the compiler should be able to figure out the U bit on its own, so it's not required.

(But you can keep it if you like it, or find out I'm wrong.) <3

Comment on lines +372 to +374
reduceAggregateClustersListToOneCluster(*aggregate_cluster);
setCircuitBreakerLimits(*aggregate_cluster, CircuitBreakerLimits{.max_connections = 1});
setMaxConcurrentStreams(*aggregate_cluster, 1U);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to mention I love how easy it is to understand what these functions do! ❤️

test_server_->waitForCounterEq("cluster.cluster_1.upstream_cx_overflow", 1);

// the requests to the aggregate cluster route affect the cluster1 circuit breaker state
// send a 3rd request directly to cluster1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit, feel free to ignore if you don't like it. <3

Suggested change
// send a 3rd request directly to cluster1
// send a 3rd request directly to cluster1 to confirm this

Comment on lines +475 to +477
test_server_->waitForCounterGe("cluster.cluster_1.upstream_cx_overflow", 2);
// the overflow may be greater than 2 because after completing the first request
// the queued pending requests will attempt to reuse the connection
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's custom to put the why-comment before the statement, not after. :)

Suggested change
test_server_->waitForCounterGe("cluster.cluster_1.upstream_cx_overflow", 2);
// the overflow may be greater than 2 because after completing the first request
// the queued pending requests will attempt to reuse the connection
// the overflow may be greater than 2 because after completing the first request
// the queued pending requests will attempt to reuse the connection
test_server_->waitForCounterGe("cluster.cluster_1.upstream_cx_overflow", 2);

but if you dislike that, I'm fine with you keeping this. <3

third_request_retry.encodeHeaders(default_response_headers_, true);
ASSERT_TRUE(cluster1_response1->waitForEndStream());
EXPECT_EQ("200", cluster1_response1->headers().getStatusValue());
// respond to the fourth request to cluster1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a response I think? It's just the request failing, so it's more like "handle the response" instead of responding. <3

first_request_retry.encodeHeaders(default_response_headers_, true);
ASSERT_TRUE(aggregate_cluster_response1->waitForEndStream());
EXPECT_EQ("200", aggregate_cluster_response1->headers().getStatusValue());
// respond to the second request to the aggregate cluster
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a response I think? It's just the request failing, so it's more like "handle the response" instead of responding. <3

Co-authored-by: Saadia El fekak <74792703+SaadiaELF@users.noreply.github.com>
Signed-off-by: Baz Murphy <61154071+bazmurphy@users.noreply.github.com>
Signed-off-by: Saadia El fekak <74792703+SaadiaELF@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants