mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Testing database
This commit is contained in:
@@ -110,6 +110,7 @@ class Database
|
||||
return $this->query(sprintf('SHOW RETENTION POLICIES %s', $this->name))->getPoints();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Drop this database
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Leaseweb\InfluxDB\Test;
|
||||
|
||||
|
||||
use Leaseweb\InfluxDB\Client;
|
||||
use Leaseweb\InfluxDB\Database;
|
||||
|
||||
class DatabaseTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var Database $db */
|
||||
protected $db = null;
|
||||
|
||||
/** @var Client $client */
|
||||
protected $mockClient;
|
||||
|
||||
protected $dataToInsert;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->mockClient = $this->getMockBuilder('\Leaseweb\InfluxDB\Client')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockClient->expects($this->any())
|
||||
->method('getBaseURI')
|
||||
->will($this->returnValue($this->equalTo('http://localhost:8086')));
|
||||
|
||||
$this->db = new Database('influx_test_db', $this->mockClient);
|
||||
|
||||
$this->dataToInsert = file_get_contents(dirname(__FILE__) . '/input.example.json');
|
||||
|
||||
}
|
||||
|
||||
public function testWrite()
|
||||
{
|
||||
$this->assertTrue(
|
||||
'mockClient'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"database": "mydb",
|
||||
"retentionPolicy": "mypolicy",
|
||||
"points": [
|
||||
{
|
||||
"measurement": "cpu_load_short",
|
||||
"tags": {
|
||||
"host": "server01",
|
||||
"region": "us-west"
|
||||
},
|
||||
"time": "2009-11-10T23:00:00Z",
|
||||
"fields": {
|
||||
"value": 0.64
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user