test: various test changes to support OS X builds#1375
test: various test changes to support OS X builds#1375mattklein123 merged 6 commits intoenvoyproxy:masterfrom
Conversation
test/common/network: make fewer assumptions about event timing and sequence test/common/http: use a more recent date for log tests to avoid an OS X bug test/common/runtime: handle difference between cp on Linux and OS X test/common/upstream: disable ring_hash_lb_test on OS X test/exe: OS X reports abort signals slightly differently than Linux test/test_common: by default OS X does not support multiple IPv4 loopback addresses
mattklein123
left a comment
There was a problem hiding this comment.
Thanks for all these fixes. Few comments.
| client_connection_->close(ConnectionCloseType::NoFlush); | ||
| dispatcher_->run(Event::Dispatcher::RunType::NonBlock); | ||
|
|
||
| EXPECT_CALL(server_callbacks_, onEvent(ConnectionEvent::RemoteClose)) |
There was a problem hiding this comment.
Can we use disconnect(false) here?
| StringUtil::strlcpy(sun.sun_path, "", sizeof sun.sun_path); | ||
| EXPECT_THROW(addressFromSockAddr(ss, sizeof(sa_family_t) + 1 + strlen(sun.sun_path)), | ||
| EnvoyException); | ||
| EXPECT_THROW(addressFromSockAddr(ss, offsetof(struct sockaddr_un, sun_path) + 1), EnvoyException); |
There was a problem hiding this comment.
To make this less magic can it be the same as rest of code which is offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sun.sun_path) still?
| ln -sf ${TEST_TMPDIR}/test/common/runtime/test_data/root/envoy/subdir ${TEST_TMPDIR}/test/common/runtime/test_data/root/envoy/badlink | ||
| case `uname` in | ||
| Darwin) | ||
| mkdir -p ${TEST_TMPDIR}/${TEST_DATA} |
There was a problem hiding this comment.
Does this work on linux also? If so do we need the darwin switch here?
|
|
||
| Address::InstanceConstSharedPtr getSomeLoopbackAddress(Address::IpVersion version) { | ||
| if (version == Address::IpVersion::v4) { | ||
| #ifdef __APPLE__ |
There was a problem hiding this comment.
@jamessynge @htuch @hennna is there any point in really doing the random address thing for tests? Could we just delete that part and use canonical to remove ifdef?
There was a problem hiding this comment.
One aspect of the rationale here was we would reduce the likelihood of port collision on the few tests that don't bind to port zero and hold the socket, but instead release immediately and expect the port not to be taken by someone else. It's not really helpful in IPv6 though and doesn't fix the underlying issue.
@jamessynge is probably the best person to comment on this.
There was a problem hiding this comment.
AFAIK everything is now binding to zero? I would vote to just remove this and treat that case as a test bug if/when it happens.
There was a problem hiding this comment.
Everything binds zero, but some test release temporarily after the bind (the bind zero is an allocation without hold). I agree with your suggestion.
|
|
||
| log->log(&request_headers_, &response_headers_, request_info_); | ||
| EXPECT_EQ("[1900-01-01T00:00:00.000Z] \"GET / HTTP/1.1\" 0 UF 1 2 3 - \"x.x.x.x\" " | ||
| EXPECT_EQ("[1999-01-01T00:00:00.000Z] \"GET / HTTP/1.1\" 0 UF 1 2 3 - \"x.x.x.x\" " |
There was a problem hiding this comment.
Can you including a reference to this bug's details in your commit message? Seems surprising OS X isn't able to work on dates in 1900. OTOH, there was no HTTP then :)
There was a problem hiding this comment.
Sure. Turns out this isn't strictly a bug: the range of time_t is implementation defined.
| ln -sf ${TEST_TMPDIR}/test/common/runtime/test_data/root ${TEST_TMPDIR}/test/common/runtime/test_data/current | ||
| ln -sf ${TEST_TMPDIR}/test/common/runtime/test_data/root/envoy/subdir ${TEST_TMPDIR}/test/common/runtime/test_data/root/envoy/badlink | ||
| mkdir -p ${TEST_TMPDIR}/${TEST_DATA} | ||
| cp -RfL ${TEST_DATA}/* ${TEST_TMPDIR}/${TEST_DATA} |
There was a problem hiding this comment.
While you're here, can you quote all variable dereferences for path WSP safety, e.g. `+mkdir -p "${TEST_TMPDIR}/${TEST_DATA}"?
|
|
||
| Address::InstanceConstSharedPtr getSomeLoopbackAddress(Address::IpVersion version) { | ||
| if (version == Address::IpVersion::v4) { | ||
| #ifdef __APPLE__ |
There was a problem hiding this comment.
One aspect of the rationale here was we would reduce the likelihood of port collision on the few tests that don't bind to port zero and hold the socket, but instead release immediately and expect the port not to be taken by someone else. It's not really helpful in IPv6 though and doesn't fix the underlying issue.
@jamessynge is probably the best person to comment on this.
| EXPECT_GE(expected_chunk_size, data.length()); | ||
| filter_seen += data.length(); | ||
| data.drain(data.length()); | ||
|
|
| } | ||
|
|
||
| void disconnect() { | ||
| void disconnect(bool async) { |
There was a problem hiding this comment.
This is really condition on whether we expect a remote close or not, rather than async?
|
@zuercher this LGTM beyond just removing the ifdef/special case in the IP address allocation test code. |
Description: Sets up the GH workflow to execute python tests in CI. Also adds a logger as a parameter to `run_engine`. Risk Level: Low Testing: This! Signed-off-by: Cerek Hillen <chillen@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
Description: Sets up the GH workflow to execute python tests in CI. Also adds a logger as a parameter to `run_engine`. Risk Level: Low Testing: This! Signed-off-by: Cerek Hillen <chillen@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
**Description** This commit adds indexing for referencegrants. The indexing key uses To Kind + namespace in referencegrant for indexing which would help fetch only related referencegrants given aiservicebackend and namespace. **Related Issues/PRs (if applicable)** Closes #1375 --------- Signed-off-by: siddharth1036 <siddharthshah1036@gmail.com>
test/common/network:
sun_pathrather than assuming the size and number of preceding sockaddr fieldstest/common/http: use a more recent date for log tests to avoid an OS X time_t limitation: struct tm before 1901-12-13 20:45:52 cannot be converted to time_t.
test/common/runtime: handle difference between cp on Linux and OS X
test/common/upstream: disable ring_hash_lb_test on OS X
test/exe: OS X reports abort signals slightly differently than Linux
test/test_common: remove getSomeLoopbackAddress (OS X does not, by default, support IPv4 loopback other than 127.0.0.1) since all tests bind port 0
(Split out from #1348, in support of #128.)