Skip to content

integration tests - 2nd round #32

Open
SaadiaELF wants to merge 25 commits into
mainfrom
selfekak-max-requests-test
Open

integration tests - 2nd round #32
SaadiaELF wants to merge 25 commits into
mainfrom
selfekak-max-requests-test

Conversation

@SaadiaELF
Copy link
Copy Markdown
Collaborator

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@SaadiaELF SaadiaELF changed the title max requests test integration tests - 2nd round Apr 14, 2025
Copy link
Copy Markdown
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.

I haven't properly reviewed the other two tests, but left some comments in the first test that hopefully help you. <3

Comment thread test/extensions/clusters/aggregate/cluster_integration_test.cc Outdated
};
}

void aggregateClusterConfigModifier(const circuitBreakerThresholds& circuit_breaker_thresholds,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This function needs a better name, that describes what it does. <3

Comment thread test/extensions/clusters/aggregate/cluster_integration_test.cc Outdated
}

TEST_P(AggregateIntegrationTest, CircuitBreakerTestMaxConnections) {
circuitBreakerThresholds circuitBreakerThresholds{.max_connections = 1};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I usually recommend against having a variable have the same name as a type, because it tends to become confusing as more code is added/changed/removed over time. (Something I learned the hard way.) :)

const int FirstUpstreamIndex = 2;
const int SecondUpstreamIndex = 3;

struct thresholds {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Think the envoy coding standard is to put capitals on all types.

Suggested change
struct thresholds {
struct Thresholds {

Comment on lines +466 to +467
// after sending the response
// aggregate_cluster
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would mention that we expect the circuit breaker to be unchanged, because the one from aggregate cluster is unused.

test_server_->waitForGaugeEq("cluster.cluster_1.circuit_breakers.default.cx_open", 0);
test_server_->waitForGaugeGe("cluster.cluster_1.circuit_breakers.default.remaining_cx", 1);

codec_client_ = makeHttpConnection(lookupPort("http"));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Doesn't the codec_client_ come with a connection object already installed?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so , as deleting it make test fail with : Caught Segmentation fault, suspect faulting address 0x88 which indicates trying to access a null pointer . I think codec_client_ is not initialised.

waitForNextUpstreamRequest(FirstUpstreamIndex);

// after creating a connection and sending a request to cluster_1 via aggregate cluster
// aggregate_cluster
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's a good idea to mention why you expect this to be the case.

Suggested change
// aggregate_cluster
// aggregate_cluster: we expect the circuit breakers to not have changed, because they're not used

test_server_->waitForGaugeEq("cluster.aggregate_cluster.circuit_breakers.default.cx_open", 0);
test_server_->waitForGaugeGe("cluster.aggregate_cluster.circuit_breakers.default.remaining_cx",
1);
// cluster_1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's a good idea to mention why you expect this to be the case.

Suggested change
// cluster_1
// cluster_1: we expect the circuit breakers to respond to the first connection

test_server_->waitForCounterGe("cluster.aggregate_cluster.upstream_cx_overflow", 0);
test_server_->waitForCounterGe("cluster.cluster_1.upstream_cx_overflow", 1);

// send a 3rd request directly to cluster_1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would explain why:

Suggested change
// send a 3rd request directly to cluster_1
// send a 3rd request directly to cluster_1, to show that the circuit breakers on cluster_1 are used by both the cluster_1 and aggregate_cluster.

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