Working on getting PostgreSQL to work on Travis.
This commit is contained in:
parent
affb44c153
commit
8ade958dd1
2 changed files with 20 additions and 12 deletions
|
@ -43,6 +43,8 @@ after_failure:
|
||||||
- sudo cat /var/log/mysql.log
|
- sudo cat /var/log/mysql.log
|
||||||
- sudo cat /var/log/mysql/error.log
|
- sudo cat /var/log/mysql/error.log
|
||||||
- sudo cat /var/log/mysql/slow.log
|
- sudo cat /var/log/mysql/slow.log
|
||||||
|
- sudo ls /var/log/postgresql
|
||||||
|
- sudo cat /var/log/postgresql/postgresql*
|
||||||
|
|
||||||
# configure notifications (email, IRC, campfire etc)
|
# configure notifications (email, IRC, campfire etc)
|
||||||
#notifications:
|
#notifications:
|
||||||
|
|
|
@ -15,22 +15,37 @@ require_once('lib/simpletest/reporter.php');
|
||||||
// Enable all errors.
|
// Enable all errors.
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
// Get the command line option telling us what database to use.
|
// Get the command line option telling us what database and host to use.
|
||||||
$options = getopt("d:h:");
|
$options = getopt("d:h:");
|
||||||
$db = $options["d"];
|
$db = $options["d"];
|
||||||
$host = rtrim(trim(trim($options["h"], '"')), "/");
|
$host = rtrim(trim(trim($options["h"], '"')), "/");
|
||||||
|
|
||||||
|
// Check if they are empty.
|
||||||
if (empty($db)){ die("Error: need to specifiy a database for the test environment."); }
|
if (empty($db)){ die("Error: need to specifiy a database for the test environment."); }
|
||||||
if (empty($host)){ $host = "http://127.0.0.1"; }
|
if (empty($host)){ $host = "http://127.0.0.1"; }
|
||||||
|
|
||||||
define("_TRAVIS_DATABASE", $db);
|
define("_TRAVIS_DATABASE", $db);
|
||||||
define("_TRAVIS_WEBHOST", $host);
|
define("_TRAVIS_WEBHOST", $host);
|
||||||
|
|
||||||
|
// Currently the tests only support MySQL and PostgreSQL.
|
||||||
|
if ($db == "mysql") {
|
||||||
|
define("_TRAVIS_DATABASE_USERNAME", "root");
|
||||||
|
define("_TRAVIS_DATABASE_PASSWORD", "");
|
||||||
|
} elseif ($db == "pgsql") {
|
||||||
|
define("_TRAVIS_DATABASE_USERNAME", "postgres");
|
||||||
|
define("_TRAVIS_DATABASE_PASSWORD", "");
|
||||||
|
} else {
|
||||||
|
die("Unsupported Database Option");
|
||||||
|
}
|
||||||
|
|
||||||
class ShimmieInstallerTest extends WebTestCase {
|
class ShimmieInstallerTest extends WebTestCase {
|
||||||
function testInstallShimmie()
|
function testInstallShimmie()
|
||||||
{
|
{
|
||||||
|
// Get the settings from the global constants.
|
||||||
$db = constant("_TRAVIS_DATABASE");
|
$db = constant("_TRAVIS_DATABASE");
|
||||||
$host = constant("_TRAVIS_WEBHOST");
|
$host = constant("_TRAVIS_WEBHOST");
|
||||||
|
$username = constant("_TRAVIS_DATABASE_USERNAME");
|
||||||
|
$password = constant("_TRAVIS_DATABASE_PASSWORD");
|
||||||
|
|
||||||
// Make sure that we know where the host is.
|
// Make sure that we know where the host is.
|
||||||
$this->assertFalse(empty($host));
|
$this->assertFalse(empty($host));
|
||||||
|
@ -44,17 +59,8 @@ class ShimmieInstallerTest extends WebTestCase {
|
||||||
|
|
||||||
$this->setField("database_type", $db);
|
$this->setField("database_type", $db);
|
||||||
$this->assertField("database_host", "localhost");
|
$this->assertField("database_host", "localhost");
|
||||||
|
$this->setField("database_user", $username);
|
||||||
if ($db === "mysql") {
|
$this->setField("database_password", $password);
|
||||||
$this->setField("database_user", "root");
|
|
||||||
$this->setField("database_password", "");
|
|
||||||
} elseif ($db === "pgsql") {
|
|
||||||
$this->setField("database_user", "postgres");
|
|
||||||
$this->setField("database_password", "");
|
|
||||||
} else {
|
|
||||||
die("Unsupported Database Option");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assertField("database_name", "shimmie");
|
$this->assertField("database_name", "shimmie");
|
||||||
$this->clickSubmit("Go!");
|
$this->clickSubmit("Go!");
|
||||||
|
|
||||||
|
|
Reference in a new issue