Skip to content

Commit a5237a9

Browse files
authored
Merge pull request buildbot#3333 from rjarry/sqlite-memory
db: allow using in-memory sqlite uri
2 parents 2dfc851 + e0ee8f3 commit a5237a9

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ docker-buildbot-master-ubuntu:
6565

6666
$(VENV_NAME):
6767
virtualenv -p $(VENV_PY_VERSION) $(VENV_NAME)
68-
$(VENV_NAME)/bin/pip install -U pip
68+
$(VENV_NAME)/bin/pip install -U pip setuptools
6969
$(VENV_NAME)/bin/pip install -e pkg \
7070
-e 'master[tls,test,docs]' \
7171
-e 'worker[test]' \

master/buildbot/db/connector.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ def setup(self, check_version=True, verbose=True):
127127

128128
# make sure the db is up to date, unless specifically asked not to
129129
if check_version:
130+
if db_url == 'sqlite://':
131+
# Using in-memory database. Since it is reset after each process
132+
# restart, `buildbot upgrade-master` cannot be used (data is not
133+
# persistent). Upgrade model here to allow startup to continue.
134+
self.model.upgrade()
130135
current = yield self.model.is_current()
131136
if not current:
132137
for l in upgrade_message.format(basedir=self.master.basedir).split('\n'):

master/buildbot/test/unit/test_db_connector.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def check(_):
9292
return d
9393

9494
def test_setup_check_version_bad(self):
95+
if self.db_url == 'sqlite://':
96+
raise unittest.SkipTest(
97+
'sqlite in-memory model is always upgraded at connection')
9598
d = self.startService(check_version=True)
9699
return self.assertFailure(d, exceptions.DatabaseNotReadyError)
97100

0 commit comments

Comments
 (0)