Skip to content

test/network: echo integration test ipv6#953

Merged
htuch merged 2 commits into
envoyproxy:masterfrom
hennna:echo-test-redo
May 15, 2017
Merged

test/network: echo integration test ipv6#953
htuch merged 2 commits into
envoyproxy:masterfrom
hennna:echo-test-redo

Conversation

@hennna
Copy link
Copy Markdown
Contributor

@hennna hennna commented May 12, 2017

This PR parameterizes an echo server integration test and is a redo of #883 . The differences between this PR and #883 are as follows:

  • Dual bind turn off was split off into a separate PR

  • Add admin ipv6 support

  • Add fake upstream ipv6 support

@hennna hennna changed the title Echo integration test ipv6 test test/network: echo integration test ipv6 test May 12, 2017
@hennna hennna changed the title test/network: echo integration test ipv6 test test/network: echo integration test ipv6 May 12, 2017
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

LGTM modulo some minor comments. Ship it before it gets any larger!

Comment thread source/common/network/utility.cc Outdated
return address.ip()->ipv4()->address() == htonl(INADDR_LOOPBACK);
} else if (address.ip()->version() == Address::IpVersion::v6) {
std::array<uint8_t, 16> addr = address.ip()->ipv6()->address();
return 0 == memcmp(&addr, &in6addr_loopback, sizeof(struct in6_addr));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sizeof(addr) or sizeof(in6addr_loopback).

freeifaddrs(ifaddr);
}

// If the local address is not found above, then return the loopback addresss by default.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a reference to #939?

Comment thread source/common/network/utility.cc Outdated
std::array<uint8_t, 16> addr = address.ip()->ipv6()->address();
return 0 == memcmp(&addr, &in6addr_loopback, sizeof(struct in6_addr));
}
return false;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NOT_IMPLEMENTED;


#include "test/integration/integration_test.h"
#include "test/integration/utility.h"
#include "test/test_common/environment.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this needed (no other changes to this file)?

Comment thread test/integration/integration_test.cc Outdated
#include "common/http/header_map_impl.h"

#include "test/integration/utility.h"
#include "test/test_common/environment.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ditto.

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

looks good, few small comments

Comment thread source/common/network/utility.cc Outdated
Address::InstanceConstSharedPtr Utility::getLocalAddress() {
// TODO(hennna): Currently getLocalAddress does not support choosing between
// multiple interfaces and addresses not returned by getifaddrs. In additon,
// the default is to return a loopback address of type version. This fucntion may
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo fucntion

// multiple interfaces and addresses not returned by getifaddrs. In additon,
// the default is to return a loopback address of type version. This fucntion may
// need to be updated in the future.
Address::InstanceConstSharedPtr Utility::getLocalAddress(const Address::IpVersion version) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC server.cc (or somewhere) has error checking that this function returns a null address, which can't happen anymore. Can you fix the callers to remove error checking that can't happen?

Comment thread source/exe/main.cc Outdated
Server::ProdComponentFactory component_factory;
LocalInfo::LocalInfoImpl local_info(Network::Utility::getLocalAddress(), options.serviceZone(),
options.serviceClusterName(), options.serviceNodeName());
// TODO(henna): Parameterize local address IP version.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: less parameterize, more probably add CLI option.

@@ -0,0 +1,23 @@
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since you are moving this test into a standalone config, is there any reason to leave the echo listener in the other config? Seems like that should be removed?

]
}],

"admin": { "access_log_path": "/dev/null", "profile_path": "{{ test_tmpdir }}/envoy.prof", "address": "tcp://{{ ip_loopback_address }}:0" },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: can we break this at 100 cols

Comment thread test/integration/utility.h Outdated
bool complete() { return complete_; }
const Http::HeaderMap& headers() { return *headers_; }
const Http::HeaderMap& headers() {
ASSERT(headers_ != nullptr);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: per style guide generally shy away from this type of ASSERT check because it should crash in an obvious way very soon.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

STR_EQ comparisons in the integration tests like this one : https://github.com/lyft/envoy/blob/master/test/integration/server.cc#L60 cause a segfault if response->complete() is false. Would it make more sense to ASSERT_TRUE(response->complete()) and remove this change? The only problem is that this particular example is in the destructor of IntegrationTestServer.

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 May 13, 2017

Choose a reason for hiding this comment

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

IMO a segfaulting test is not the end of the world as it failed. :) I would probably just do nothing, but if you want to do something more clear I would use a gtest assert rather than the prod assert. So ASSERT_NE or something.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Arguably, since we're returning a reference here, if it was nullptr the failure would be harder to understand the further away from this return we get, so best to check here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Better would probably be to just make this return a pointer instead of a reference, but that's a larger change. I don't feel very strongly about this either way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok. I'll just leave as is for now (no change) and leave the change for another PR.

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM pending any final @htuch comments.

@htuch htuch merged commit c9992ae into envoyproxy:master May 15, 2017
@hennna hennna deleted the echo-test-redo branch May 23, 2017 20:45
htuch pushed a commit that referenced this pull request Jun 5, 2017
…1036)

This PR parameterizes two integration tests: integration_test.cc and integration_admin_test.cc. The majority of the line changes are plumbing through the parameter version to allow code that originally hard coded an IPv4 address to now be parameterized.

This is the second step in parameterizing IPv4 and IPv6 testing in the integration tests. The first step was parameterizing the echo_integration_test in #953 . In this PR, we update many of the functions in integration.cc that are called in integration_test.cc to take the parameter version. Because other integration tests currently also rely on these functions, we set the default value to be Network::Address::IpVersion::v4. In a subsequent PR, we will also parameterize the other integration tests and the default value will be removed.

The constructor for RawConnectionDriver and function makeSingleRequest in test/integration/utility.h were also updated to set the default version value to v4. This required reordering the function parameters.

createTestServer and temporaryFileSubstitute were also updated in a similar fashion.

asan and tsan tests passing requires https://github.com/lyft/envoy-filter-example/pull/4/files due to dependence on changes made in this PR.

Supports ongoing work in #351
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
Automatic merge from submit-queue.

[DO NOT MERGE] Auto PR to update dependencies of proxy

This PR will be merged automatically once checks are successful.
```release-note
none
```
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Signed-off-by: Mike Schore <mike.schore@gmail.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Signed-off-by: Mike Schore <mike.schore@gmail.com>
Signed-off-by: JP Simard <jp@jpsim.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.

3 participants