Skip to content

test: add testing for missing coverage#792

Merged
junr03 merged 6 commits intomasterfrom
increase-testing
Apr 8, 2020
Merged

test: add testing for missing coverage#792
junr03 merged 6 commits intomasterfrom
increase-testing

Conversation

@junr03
Copy link
Member

@junr03 junr03 commented Apr 7, 2020

Description: this PR adds tests based on local coverage runs to raise coverage. This PR adds all non-silly coverage, but still hits misses on some accessors and because NOT_IMPLEMENTED_GCOVR_EXCL_LINE is being included (known problem in Envoy upstream since we stopped using gcovr).
Risk Level: lowest! we are increasing our code coverage :)
Testing: local coverage runs to see missing spots, and then CI

Signed-off-by: Jose Nino jnino@lyft.com

Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03 junr03 force-pushed the increase-testing branch from 7166501 to d5a2154 Compare April 7, 2020 19:35
Jose Nino added 2 commits April 7, 2020 12:43
fmt
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
ASSERT_EQ(cc.on_complete_calls, 1);
}

TEST_F(DispatcherTest, BasicStreamWithTrailers) {

Choose a reason for hiding this comment

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

This test feels quite large and it's kind of difficult to understand what suite of behaviors we're trying to exercise here. Do you know if we can isolate the specific behaviors and have smaller individual tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

Some of these tests can be condensed a little bit by taking the repeated parts into utility functions in the test class. I was thinking about this as I was adding more tests. Will do in a subsequent PR #794

Choose a reason for hiding this comment

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

I think that's great to do also (I am slightly opinionated about test utils but we can talk about that separately)

The confusion I have is more on the behavior exercised by this test (since it seems to be asserting on all the different handlers). Does this test primarily exercise a general end to end behavior of a basic stream?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, it is an http stream with trailers. There are individual tests for a headers only request, one with a body, and now this one with trailers.

http_dispatcher_.synchronizer().signal("dispatch_encode_final_data");
}

// TODO(junr03): test with envoy local reply with local stream not close, which causes a reset fired
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// TODO(junr03): test with envoy local reply with local stream not close, which causes a reset fired
// TODO(junr03): test with envoy local reply with local stream not closed, which causes a reset fired

Copy link
Member Author

Choose a reason for hiding this comment

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

if you are ok with it, I will fix this in #791 to avoid re-running CI


// Ensure that the callbacks on the bridge_callbacks were called.
ASSERT_EQ(cc.on_complete_calls, 0);
ASSERT_EQ(cc.on_error_calls, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @buildbreaker's comment above regarding encapsulating testable pieces so we don't have large test functions. Another idea might be to break up this file with those smaller individual tests (it's ~1500LOC)

Copy link
Member Author

Choose a reason for hiding this comment

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

Jose Nino added 3 commits April 8, 2020 10:28
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
fmt
Signed-off-by: Jose Nino <jnino@lyft.com>
Copy link

@buildbreaker buildbreaker left a comment

Choose a reason for hiding this comment

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

@junr03 I like the separation within the tests! It's a lot clearer to me what things we are exercising at each test.

I feel like we could break them down even more but it might be my own personal preferences. Happy to chat more!

@junr03 junr03 merged commit 7ea53ab into master Apr 8, 2020
@junr03 junr03 deleted the increase-testing branch April 8, 2020 20:45
@junr03
Copy link
Member Author

junr03 commented Apr 8, 2020

Yeah open to more suggestions @buildbreaker. I opened #794 yesterday to track. We can chat, or you can drop an example in the issue

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