-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from yuki777/embed-dbdb-v1.2.12
Embed dbdb v1.2.12
- Loading branch information
Showing
9 changed files
with
194 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v1.2.11 | ||
v1.2.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
set -aeuvx | ||
|
||
. ../lib/functions.sh | ||
|
||
type=postgresql | ||
version=12.4 | ||
|
||
cd ../$type | ||
rm -fr $type-*.tar.gz | ||
cd .. | ||
|
||
date=$(date +%Y%m%d%H%M%S) | ||
md5="md5" | ||
[ "$(getOS)" = "linux" ] && md5="md5sum" | ||
hash=$(echo "dbdb-$date" | $md5 | cut -d ' ' -f 1) | ||
|
||
echo "Test create" | ||
./$type/create.sh dbdb-test-$hash $version random | ||
echo "Test port" | ||
./$type/port.sh dbdb-test-$hash | ||
echo "Test start" | ||
./$type/start.sh dbdb-test-$hash | ||
echo "Test status" | ||
./$type/status.sh dbdb-test-$hash | ||
echo "Test restart" | ||
./$type/restart.sh dbdb-test-$hash | ||
echo "Test stop" | ||
./$type/stop.sh dbdb-test-$hash | ||
echo "Test delete" | ||
./$type/delete.sh dbdb-test-$hash | ||
|
||
echo "Test create" | ||
./$type/create.sh -f json dbdb-test-$hash $version random | jq | ||
echo "Test port" | ||
./$type/port.sh -f json dbdb-test-$hash | jq | ||
echo "Test start" | ||
./$type/start.sh -f json dbdb-test-$hash | jq | ||
echo "Test status" | ||
./$type/status.sh -f json dbdb-test-$hash | jq | ||
echo "Test restart" | ||
./$type/restart.sh -f json dbdb-test-$hash | jq | ||
echo "Test stop" | ||
./$type/stop.sh -f json dbdb-test-$hash | jq | ||
echo "Test delete" | ||
./$type/delete.sh -f json dbdb-test-$hash | jq | ||
|
||
./dbdb.sh | ||
./$type/create-start.sh -f json dbdb-test-$hash $version random | jq | ||
./dbdb.sh -f json | jq | ||
./$type/delete.sh dbdb-test-$hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
set -aeuvx | ||
|
||
. ../lib/functions.sh | ||
|
||
type=postgresql | ||
version=13.2 | ||
|
||
cd ../$type | ||
rm -fr $type-*.tar.gz | ||
cd .. | ||
|
||
date=$(date +%Y%m%d%H%M%S) | ||
md5="md5" | ||
[ "$(getOS)" = "linux" ] && md5="md5sum" | ||
hash=$(echo "dbdb-$date" | $md5 | cut -d ' ' -f 1) | ||
|
||
echo "Test create" | ||
./$type/create.sh dbdb-test-$hash $version random | ||
echo "Test port" | ||
./$type/port.sh dbdb-test-$hash | ||
echo "Test start" | ||
./$type/start.sh dbdb-test-$hash | ||
echo "Test status" | ||
./$type/status.sh dbdb-test-$hash | ||
echo "Test restart" | ||
./$type/restart.sh dbdb-test-$hash | ||
echo "Test stop" | ||
./$type/stop.sh dbdb-test-$hash | ||
echo "Test delete" | ||
./$type/delete.sh dbdb-test-$hash | ||
|
||
echo "Test create" | ||
./$type/create.sh -f json dbdb-test-$hash $version random | jq | ||
echo "Test port" | ||
./$type/port.sh -f json dbdb-test-$hash | jq | ||
echo "Test start" | ||
./$type/start.sh -f json dbdb-test-$hash | jq | ||
echo "Test status" | ||
./$type/status.sh -f json dbdb-test-$hash | jq | ||
echo "Test restart" | ||
./$type/restart.sh -f json dbdb-test-$hash | jq | ||
echo "Test stop" | ||
./$type/stop.sh -f json dbdb-test-$hash | jq | ||
echo "Test delete" | ||
./$type/delete.sh -f json dbdb-test-$hash | jq | ||
|
||
./dbdb.sh | ||
./$type/create-start.sh -f json dbdb-test-$hash $version random | jq | ||
./dbdb.sh -f json | jq | ||
./$type/delete.sh dbdb-test-$hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace DbDbPhp\Composer; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Composer\Console\Application; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use DbDbPhp\Composer\Commands\Postgresql; | ||
use DbDbPhp\Composer\Commands\DbDbList; | ||
use DbDbPhp\Composer\Commands\DbDbVersion; | ||
|
||
class Postgresql13Test extends TestCase | ||
{ | ||
public function testBasic() | ||
{ | ||
$type = 'postgresql'; | ||
$version = '13.2'; | ||
|
||
$application = new Application(); | ||
$application->add(new Postgresql()); | ||
$application->add(new DbDbList()); | ||
$application->add(new DbDbVersion()); | ||
$application->setAutoExit(false); | ||
|
||
$listTester = new CommandTester($application->find("dbdb:list")); | ||
$versionTester = new CommandTester($application->find("dbdb:version")); | ||
$dbTester = new CommandTester($application->find("dbdb:$type")); | ||
|
||
// Generate random name | ||
$dbName = "dbdb-php-test-$type-" . md5(microtime(true)); | ||
|
||
// Version | ||
fwrite(STDERR, "Show version of dbdb" . PHP_EOL); | ||
$this->assertEquals(0, $versionTester->execute([])); | ||
$this->assertStringContainsString('"dbdb-php"', $versionTester->getDisplay()); | ||
$this->assertStringContainsString('"dbdb"', $versionTester->getDisplay()); | ||
|
||
// List | ||
fwrite(STDERR, "Show databases" . PHP_EOL); | ||
$this->assertEquals(0, $listTester->execute([])); | ||
$this->assertStringContainsString('[]', $listTester->getDisplay()); | ||
|
||
// Create | ||
fwrite(STDERR, "Create database $dbName" . PHP_EOL); | ||
$this->assertEquals(0, $dbTester->execute(["action" => "create", "--db-name" => $dbName, "--db-version" => $version, "--db-port" => "random"])); | ||
|
||
// Start | ||
fwrite(STDERR, "Start database $dbName" . PHP_EOL); | ||
$this->assertEquals(0, $dbTester->execute(["action" => "start", "--db-name" => $dbName])); | ||
|
||
// Restart | ||
fwrite(STDERR, "Restart database $dbName" . PHP_EOL); | ||
$this->assertEquals(0, $dbTester->execute(["action" => "restart", "--db-name" => $dbName])); | ||
|
||
// Port | ||
fwrite(STDERR, "Show port of database $dbName" . PHP_EOL); | ||
$this->assertEquals(0, $dbTester->execute(["action" => "port", "--db-name" => $dbName])); | ||
|
||
// Stop | ||
fwrite(STDERR, "Stop database $dbName" . PHP_EOL); | ||
$this->assertEquals(0, $dbTester->execute(["action" => "stop", "--db-name" => $dbName])); | ||
|
||
// Delete | ||
fwrite(STDERR, "Delete database $dbName" . PHP_EOL); | ||
$this->assertEquals(0, $dbTester->execute(["action" => "delete", "--db-name" => $dbName])); | ||
|
||
// Create and start | ||
fwrite(STDERR, "Create and start database $dbName" . PHP_EOL); | ||
$this->assertEquals(0, $dbTester->execute(["action" => "create-start", "--db-name" => $dbName, "--db-version" => $version, "--db-port" => "random"])); | ||
|
||
// Delete | ||
fwrite(STDERR, "Delete database $dbName" . PHP_EOL); | ||
$this->assertEquals(0, $dbTester->execute(["action" => "delete", "--db-name" => $dbName])); | ||
} | ||
} |