Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos
Commits
4cf4dfe6
Commit
4cf4dfe6
authored
Apr 08, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recipe/postgres: add missing test
parent
3443b2f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
slapos/test/recipe/test_postgres.py
slapos/test/recipe/test_postgres.py
+44
-0
No files found.
slapos/test/recipe/test_postgres.py
0 → 100644
View file @
4cf4dfe6
import
unittest
import
tempfile
import
shutil
import
os.path
import
zc.buildout.testing
class
PostgresTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
buildout
=
buildout
=
zc
.
buildout
.
testing
.
Buildout
()
self
.
pgdata_directory
=
tempfile
.
mkdtemp
()
self
.
addCleanup
(
shutil
.
rmtree
,
self
.
pgdata_directory
)
self
.
services_directory
=
tempfile
.
mkdtemp
()
self
.
addCleanup
(
shutil
.
rmtree
,
self
.
services_directory
)
buildout
[
'postgres'
]
=
{
'bin'
:
'software/parts/postgres/bin/'
,
'dbname'
:
'dbname'
,
'ipv4'
:
'127.0.0.1'
,
'ipv6'
:
'::1'
,
'port'
:
'5443'
,
'pgdata-directory'
:
self
.
pgdata_directory
,
'services'
:
self
.
services_directory
,
'superuser'
:
'superuser'
,
'password'
:
'secret'
,
}
from
slapos.recipe
import
postgres
self
.
recipe
=
postgres
.
Recipe
(
buildout
,
'postgres'
,
buildout
[
'postgres'
])
def
test_options
(
self
):
self
.
assertEqual
(
'postgresql://superuser:secret@[::1]:5443/dbname'
,
self
.
buildout
[
'postgres'
][
'url'
])
def
test_install
(
self
):
installed
=
self
.
recipe
.
install
()
self
.
assertEqual
(
installed
,
[])
self
.
assertIn
(
'postgresql.conf'
,
os
.
listdir
(
self
.
pgdata_directory
))
self
.
assertIn
(
'pg_hba.conf'
,
os
.
listdir
(
self
.
pgdata_directory
))
self
.
assertIn
(
'postgres-start'
,
os
.
listdir
(
self
.
services_directory
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment