From 4517e5c31c65219eb14df50f5b713704f79cc401 Mon Sep 17 00:00:00 2001 From: Walter Dal Mut Date: Sat, 27 Jun 2015 14:20:46 +0200 Subject: [PATCH] Cover merge global tags also when are missing --- tests/unit/Adapter/UdpAdapterTest.php | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/unit/Adapter/UdpAdapterTest.php b/tests/unit/Adapter/UdpAdapterTest.php index e9e3ce4f6..68271bac4 100644 --- a/tests/unit/Adapter/UdpAdapterTest.php +++ b/tests/unit/Adapter/UdpAdapterTest.php @@ -187,6 +187,35 @@ EOF ]); } + /** + * @group udp + */ + public function testFillWithGlobalTags() + { + $options = (new Options()) + ->setDatabase("test") + ->setTags(["dc" => "eu-west"]); + $adapter = $this->getMockBuilder("InfluxDB\\Adapter\\UdpAdapter") + ->setConstructorArgs([$options]) + ->setMethods(["write"]) + ->getMock(); + + $adapter->expects($this->once()) + ->method("write") + ->with($this->matchesRegularExpression("/mem,dc=eu-west free=712423 \d+/i")); + + $adapter->send([ + "points" => [ + [ + "measurement" => "mem", + "fields" => [ + "free" => 712423, + ], + ], + ] + ]); + } + /** * @group udp */