Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion envoy
Submodule envoy updated 303 files
6 changes: 4 additions & 2 deletions envoy_build_config/extension_registry.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "extension_registry.h"

#include "source/common/network/default_client_connection_factory.h"
#include "source/common/network/socket_interface_impl.h"
#include "source/common/upstream/logical_dns_cluster.h"
#include "source/extensions/clusters/dynamic_forward_proxy/cluster.h"
Expand Down Expand Up @@ -64,8 +65,9 @@ void ExtensionRegistry::registerFactories() {
// https://github.com/envoyproxy/envoy/pull/11380/files#diff-8a5c90e5a39b2ea975170edc4434345bR138.
// For now force the compilation unit to run by creating an instance of the class declared in
// socket_interface_impl.h and immediately destroy.
auto ptr = std::make_unique<Network::SocketInterfaceImpl>();
ptr.reset(nullptr);
{ auto ptr = std::make_unique<Network::SocketInterfaceImpl>(); }

{ auto ptr = std::make_unique<Network::DefaultClientConnectionFactory>(); }
}

} // namespace Envoy
26 changes: 15 additions & 11 deletions library/common/network/synthetic_address_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,39 @@ class SyntheticAddressImpl : public Instance {
public:
SyntheticAddressImpl() {}

bool operator==(const Instance&) const {
bool operator==(const Instance&) const override {
// Every synthetic address is different from one another and other address types. In reality,
// whatever object owns a synthetic address can't rely on address equality for any logic as the
// address is just a stub.
return false;
}

const std::string& asString() const { return address_; }
const std::string& asString() const override { return address_; }

absl::string_view asStringView() const { return address_; }
absl::string_view asStringView() const override { return address_; }

const std::string& logicalName() const { return address_; }
const std::string& logicalName() const override { return address_; }

const Ip* ip() const { return nullptr; }
const Ip* ip() const override { return nullptr; }

const Pipe* pipe() const { return nullptr; }
const Pipe* pipe() const override { return nullptr; }

const EnvoyInternalAddress* envoyInternalAddress() const { return nullptr; }
const EnvoyInternalAddress* envoyInternalAddress() const override { return nullptr; }

const sockaddr* sockAddr() const { return nullptr; }
const sockaddr* sockAddr() const override { return nullptr; }

socklen_t sockAddrLen() const { return 0; }
socklen_t sockAddrLen() const override { return 0; }

Type type() const {
Type type() const override {
// TODO(junr03): consider adding another type of address.
return Type::Ip;
}

const SocketInterface& socketInterface() const { return SocketInterfaceSingleton::get(); }
absl::string_view addressType() const override { return "default"; }

const SocketInterface& socketInterface() const override {
return SocketInterfaceSingleton::get();
}

private:
const std::string address_{"synthetic"};
Expand Down
3 changes: 1 addition & 2 deletions test/kotlin/integration/StatFlushIntegrationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class StatFlushIntegrationTest {

engine!!.flushStats()

statsdServer.awaitNextStat()
assertThat(statsdServer.mostRecentlyReceivedStat()).contains("envoy.pulse.foo.bar:1|c")
statsdServer.awaitStatMatching { s -> s == "envoy.pulse.foo.bar:1|c" }
}
}
16 changes: 8 additions & 8 deletions test/kotlin/integration/TestStatsdServer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.util.concurrent.atomic.AtomicReference
class TestStatsdServer {
private val shutdownLatch: CountDownLatch = CountDownLatch(1)
private val awaitNextStat: AtomicReference<CountDownLatch> = AtomicReference(CountDownLatch(0))
private var latestStats: AtomicReference<String> = AtomicReference()
private val matchCriteria: AtomicReference<(String) -> Boolean> = AtomicReference()

private var thread: Thread? = null

Expand All @@ -37,21 +37,21 @@ class TestStatsdServer {
// TODO(snowp): Parse (or use a parser) so we can extract out individual metric names
// better.
val received = String(packet.getData(), packet.getOffset(), packet.getLength())
latestStats.set(received)
awaitNextStat.get().countDown()
val maybeMatch = matchCriteria.get()
if (maybeMatch != null && maybeMatch.invoke(received)) {
matchCriteria.set(null)
awaitNextStat.get().countDown()
}
}
}
)
thread!!.start()
}

fun mostRecentlyReceivedStat(): String {
return latestStats.get()
}

fun awaitNextStat() {
fun awaitStatMatching(predicate: (String) -> Boolean) {
val latch = CountDownLatch(1)
awaitNextStat.set(latch)
matchCriteria.set(predicate)
latch.await()
}

Expand Down