Commit 625a17d5 authored by Xavier Thompson's avatar Xavier Thompson

software/*: Adapt tests to slapproxy upgrade

parent cc5a223b
......@@ -158,20 +158,12 @@ class TestJupyterPassword(InstanceTestCase):
)
class SelectMixin(object):
def sqlite3_connect(self):
sqlitedb_file = os.path.join(
os.path.abspath(
os.path.join(
self.slap.instance_directory, os.pardir
)
), 'var', 'proxy.db'
)
return sqlite3.connect(sqlitedb_file)
def select(self, fields, table, where={}):
connection = self.sqlite3_connect()
class Database(object):
def __init__(self, db_path):
self.db = db_path
def execute(self, query, *args):
connection = sqlite3.connect(self.db)
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
......@@ -179,20 +171,11 @@ class SelectMixin(object):
return d
connection.row_factory = dict_factory
cursor = connection.cursor()
condition = " AND ".join("%s='%s'" % (k, v) for k, v in where.items())
cursor.execute(
"SELECT %s FROM %s%s"
% (
", ".join(fields),
table,
" WHERE %s" % condition if where else "",
)
)
cursor.execute(query, args)
return cursor.fetchall()
class TestJupyterCustomFrontend(SelectMixin, InstanceTestCase):
class TestJupyterCustomFrontend(InstanceTestCase):
instance_parameter_dict = {}
frontend_software_url = 'hello://frontend.url'
frontend_software_type = 'hello-type'
......@@ -226,7 +209,9 @@ class TestJupyterCustomFrontend(SelectMixin, InstanceTestCase):
except Exception:
pass
selection = self.select(fields=["*"], table = "slave14", where = {"hosted_by": r._partition_id})
runner_directory = os.path.abspath(os.path.join(self.slap.instance_directory, os.pardir))
db = Database(os.path.join(runner_directory, 'var', 'proxy.db'))
selection = db.execute('SELECT * FROM slave15 WHERE hosted_by=?', r._partition_id)
self.assertEqual(len(selection), 1)
......@@ -234,7 +219,7 @@ class TestJupyterCustomFrontend(SelectMixin, InstanceTestCase):
r.destroyed()
class TestJupyterCustomAdditional(SelectMixin, InstanceTestCase):
class TestJupyterCustomAdditional(InstanceTestCase):
instance_parameter_dict = {}
frontend_additional_software_url = 'hello://frontend.url'
frontend_additional_software_type = 'hello-type'
......@@ -268,7 +253,9 @@ class TestJupyterCustomAdditional(SelectMixin, InstanceTestCase):
except Exception:
pass
selection = self.select(fields=["*"], table = "slave14", where = {"hosted_by": r._partition_id})
runner_directory = os.path.abspath(os.path.join(self.slap.instance_directory, os.pardir))
db = Database(os.path.join(runner_directory, 'var', 'proxy.db'))
selection = db.execute('SELECT * FROM slave15 WHERE hosted_by=?', r._partition_id)
self.assertEqual(len(selection), 1)
......
......@@ -212,7 +212,7 @@ class MonitorAccessMixin(object):
cursor.execute(
"SELECT reference, xml, connection_xml, partition_reference, "
"software_release, requested_state, software_type "
"FROM partition14 "
"FROM partition15 "
"WHERE slap_state='busy'")
return cursor.fetchall()
......
......@@ -181,8 +181,8 @@ setup = ${slapos-repository:location}/software/jscrawler/test/
[slapos.core-repository]
<= git-clone-repository
repository = https://lab.nexedi.com/nexedi/slapos.core.git
branch = master
repository = https://lab.nexedi.com/xavier_thompson/slapos.core.git
branch = proxy_root_path_migrate
[slapos.test.caucase-setup]
<= setup-develop-egg
......
......@@ -20,6 +20,10 @@ extends =
./buildout.hash.cfg
parts =
# >>>>>>>>>>>>
# Use unreleased version of slapos.core
slapos.core-dev
# <<<<<<<<<<<<
theia-wrapper
slapos-cookbook
instance
......@@ -27,6 +31,24 @@ parts =
# default for slapos-standalone
shared-part-list =
# >>>>>>>>>>>>
# Use unreleased version of slapos.core
[slapos.core-repository]
recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/xavier_thompson/slapos.core.git
branch = proxy_root_path_migrate
git-executable = ${git:location}/bin/git
develop = true
[slapos.core-dev]
recipe = zc.recipe.egg:develop
egg = slapos.core
setup = ${slapos.core-repository:location}
[versions]
slapos.core =
# <<<<<<<<<<<<
# We keep the gcc part in sync with the one from erp5 software, so that when we install
# erp5 inside theia's slapos parts can be shared.
[gcc]
......@@ -97,6 +119,7 @@ initialization =
software_root="%s/software" % args.base_directory,
instance_root="%s/instance" % args.base_directory,
partition_forward_configuration=partition_forward_configuration,
slapos_bin="${buildout:bin-directory}/slapos",
)
standalone.start()
partition_count = 20
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment