public function testWorksWithProxies() { $this->getClient()->createDatabase("proxy.test"); $options = new Options(); $options->setPort(9000); $options->setDatabase("proxy.test"); $options->setPrefix("/influxdb"); $http = new GuzzleHttpClient(); $adapter = new GuzzleAdapter($http, $options); $adapter->send(["points" => [["measurement" => "vm-serie", "fields" => ["cpu" => 18.12, "free" => 712423]]]]); $this->assertSerieExists("proxy.test", "vm-serie"); $this->assertSerieCount("proxy.test", "vm-serie", 1); $this->assertValueExistsInSerie("proxy.test", "vm-serie", "cpu", 18.12); $this->assertValueExistsInSerie("proxy.test", "vm-serie", "free", 712423); }
public function testTagsFieldIsMergedWithGlobalTags() { $options = new Options(); $options->setDatabase("db"); $options->setTags(["dc" => "us-west"]); $httpClient = $this->prophesize("GuzzleHttp\\Client"); $httpClient->post(Argument::Any(), ["auth" => ["root", "root"], "query" => ["db" => "db", "retentionPolicy" => "default"], "body" => 'tcp.test,dc=us-west,region=us mark="element" 1257894000000000000'])->shouldBeCalledTimes(1); $adapter = new InfluxHttpAdapter($httpClient->reveal(), $options); $adapter->send(["time" => "2009-11-10T23:00:00Z", "tags" => ["region" => "us"], "points" => [["measurement" => "tcp.test", "fields" => ["mark" => "element"]]]]); }