diff --git a/tests/integration/Adapter/UdpAdapterTest.php b/tests/integration/Adapter/UdpAdapterTest.php new file mode 100644 index 000000000..f04c629ad --- /dev/null +++ b/tests/integration/Adapter/UdpAdapterTest.php @@ -0,0 +1,53 @@ +setPort(4444); + $adapter = new UdpAdapter($options); + + $this->getClient()->createDatabase("udp.test"); + + $adapter->write("cpu value=12.33 " . (int)(microtime(true)*1e9)); + + sleep(2); + + $this->assertSerieExists("udp.test", "cpu"); + $this->assertSerieCount("udp.test", "cpu", 1); + $this->assertValueExistsInSerie("udp.test", "cpu", "value", 12.33); + } + + public function testWriteSimplePointsUsingSendMethod() + { + $options = (new Options()) + ->setPort(4444); + $adapter = new UdpAdapter($options); + + $this->getClient()->createDatabase("udp.test"); + + $adapter->send([ + "retentionPolicy" => "default", + "points" => [ + [ + "measurement" => "mem", + "fields" => [ + "value" => 1233, + ], + ], + ], + ]); + + sleep(2); + + $this->assertSerieExists("udp.test", "mem"); + $this->assertSerieCount("udp.test", "mem", 1); + $this->assertValueExistsInSerie("udp.test", "mem", "value", 1233); + } +}