Skip to content
Snippets Groups Projects
Commit d41835e7 authored by Samir Faci's avatar Samir Faci
Browse files

Adding CI/CD

parent c865935a
Branches
Tags
No related merge requests found
kind: pipeline
name: default
steps:
- name: build
image: python:3.9
environment:
POSTGRES_HOST: database
commands:
- apt update && apt-get install -y postgresql-client
- cat datafiles/schema.sql | PGPASSWORD="w1gWIn7NDGXjXMguiI2Qe05X" psql -U opennsa -h database -d opennsatest
- python3 -m pip install -r requirements.txt
- cp util/integration-config.json .opennsa-test.json
- cp config/opennsa.conf.template config/opennsa.conf
- PYTHONPATH=. trial test
services:
- name: database
image: postgres:12-alpine
environment:
POSTGRES_USER: opennsa
POSTGRES_PASSWORD: w1gWIn7NDGXjXMguiI2Qe05X
POSTGRES_DB: opennsatest
trigger:
event:
- push
- pull_request
......@@ -15,6 +15,6 @@ def setupDatabase(config_file=CONFIG_FILE):
tc = json.load( open(config_file) )
database.setupDatabase( tc['database'], tc['user'], tc['password'], host='127.0.0.1')
database.setupDatabase( tc['database'], tc['user'], tc['password'], host=tc['hostname'])
......@@ -123,7 +123,7 @@ class ConfigTest(unittest.TestCase):
self.database = tc['database']
self.db_user = tc['user']
self.db_password = tc['password']
self.db_host = '127.0.0.1'
self.db_host = tc['hostname']
def _generate_temp_file(self, buffer):
"""
......
......@@ -117,7 +117,7 @@ class MultipleInstancesTestMultipleInstancesTest(unittest.TestCase):
self.database = tc['database']
self.db_user = tc['user']
self.db_password = tc['password']
self.db_host = '127.0.0.1'
self.db_host = tc['hostname']
# make temporary files for nrm map files
......
......@@ -32,7 +32,7 @@ class NCSVPNBackendTest(unittest.TestCase):
self.backend.startService()
database.setupDatabase( tc['database'], tc['database-user'], tc['database-password'])
database.setupDatabase(tc['database'], tc['database-user'], tc['database-password'], host=tc['hostname'])
self.requester_nsa = nsa.NetworkServiceAgent('test-requester', 'http://example.org/nsa-test-requester')
self.provider_nsa = nsa.NetworkServiceAgent('test-provider', 'http://example.org/nsa-test-provider')
......
{
"container" : "opennsa-test-database",
"database" : "opennsatest",
"user" : "opennsa",
"hostname" : "database",
"password" : "w1gWIn7NDGXjXMguiI2Qe05X"
}
......@@ -21,7 +21,8 @@ echo "{
\"container\" : \"$container\",
\"database\" : \"$database\",
\"user\" : \"$user\",
\"password\" : \"$password\"
\"password\" : \"$password\",
\"hostname\" : \"127.0.0.1\"
}" > "$configfile"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment