Skip to content

test-utillity: Remove test-utility wrapper for Buffer::toString().#3736

Merged
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
jmarantz:kill-util-buffer-to-string
Jun 27, 2018
Merged

test-utillity: Remove test-utility wrapper for Buffer::toString().#3736
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
jmarantz:kill-util-buffer-to-string

Conversation

@jmarantz
Copy link
Contributor

@jmarantz jmarantz commented Jun 26, 2018

Signed-off-by: Joshua Marantz jmarantz@google.com

Description: Follow-up to #3629 to eliminate intermediate test-util API bufferToString() and change all the call-sites to call buffer->toString() directly.

Due to Buffer::OwnedImpl's implicit constructor from Buffer:Instance,
it worked for TestUtility::bufferToString to take a const Buffer::OwnedImpl&
argument, even though many of its call-sites only
had the interface, Buffer::Instance&. In the context of the call to a static method
with a known argument type, the implict ctor is applied by the compiler to do the
type conversion.

However that doesn't work when simplify dereferencing a Buffer::Instance and
calling toString() on it. The simplest approach to resolution is to add
Buffer::Instance::toString(). IMO this is defensible: it's nice to have a simple
read-only observer for this abstract type.

Risk Level: Low
Testing: //test/...
Docs Changes: N/A
Release Notes: N/A

For reasons I don't understand, the removed TestUtility::bufferToString
took a const Buffer::OwnedImpl& argument, but many of its call-sites only
had the interface, Buffer::Instance&, and that call seemed to work.

Now when I just replace those with buffer->toString(), I got the expected
compile-time failure, until I added Buffer::toString() as a new interface.
IMO this is defensible: it's nice to have a simple read-only observer for
this abstract type.

Signed-off-by: Joshua Marantz <jmarantz@google.com>
htuch
htuch previously approved these changes Jun 26, 2018
@htuch
Copy link
Member

htuch commented Jun 26, 2018

@jmarantz the ASAN/TSAN failures look like legitimate build issues, can you take a look?

@jmarantz
Copy link
Contributor Author

jmarantz commented Jun 26, 2018 via email

@jmarantz
Copy link
Contributor Author

issue should be resolved in envoyproxy/envoy-filter-example#51

Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
@mattklein123 mattklein123 merged commit 0f631e1 into envoyproxy:master Jun 27, 2018
@jmarantz jmarantz deleted the kill-util-buffer-to-string branch June 27, 2018 14:41
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