diff --git a/.travis.yml b/.travis.yml index 7c33ebc..71bb864 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,5 @@ before_script: - curl -s http://getcomposer.org/installer | php - wget http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb - sudo dpkg -i influxdb_latest_amd64.deb + - travis_retry sudo service influxdb restart - php composer.phar install diff --git a/lib/InfluxPHP/Client.php b/lib/InfluxPHP/Client.php index 61b043f..98ec21e 100644 --- a/lib/InfluxPHP/Client.php +++ b/lib/InfluxPHP/Client.php @@ -68,7 +68,7 @@ class Client extends BaseHTTP $self = $this; return array_map(function($obj) use($self) { return new DB($self, $obj['name']); - }, $this->get('dbs')); + }, $this->get('db')); } public function getDatabase($name) diff --git a/lib/InfluxPHP/DB.php b/lib/InfluxPHP/DB.php index 630b019..15d6fd6 100644 --- a/lib/InfluxPHP/DB.php +++ b/lib/InfluxPHP/DB.php @@ -85,8 +85,8 @@ class DB extends BaseHTTP return new Cursor($this->get('series', ['q' => $sql, 'time_precision' => $this->timePrecision])); } - public function createUser($username, $password) + public function createUser($name, $password) { - return $this->post('users', compact('username', 'password')); + return $this->post('users', compact('name', 'password')); } } diff --git a/tests/DBTest.php b/tests/DBTest.php index 621a032..de67e6a 100644 --- a/tests/DBTest.php +++ b/tests/DBTest.php @@ -2,7 +2,7 @@ use crodas\InfluxPHP\Client; use crodas\InfluxPHP\DB; -class DBTest extends \phpunit_framework_testcase +class DBTest extends \PHPUnit_Framework_TestCase { public function testCreate() { @@ -103,17 +103,17 @@ class DBTest extends \phpunit_framework_testcase $db = $client->test_xxx; $client->setTimePrecision('u'); - foreach ($db->query("SELECT mean(karma) FROM foobar GROUP BY type") as $row) { + foreach ($db->query("SELECT mean(karma) FROM foobar GROUP BY type, time(1h)") as $row) { $this->assertTrue($row->time > time()*1000); } $client->setTimePrecision('m'); - foreach ($db->query("SELECT mean(karma) FROM foobar GROUP BY type") as $row) { + foreach ($db->query("SELECT mean(karma) FROM foobar GROUP BY type, time(1h)") as $row) { $this->assertTrue($row->time < time()*10000); } $client->setTimePrecision('s'); - foreach ($db->query("SELECT mean(karma) FROM foobar GROUP BY type") as $row) { + foreach ($db->query("SELECT mean(karma) FROM foobar GROUP BY type, time(1h)") as $row) { $this->assertTrue($row->time < time()+20); }