Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions +dj/conn.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@
end
end
else
% optional environment variables specifying the connection.
env = struct(...
'host', 'DJ_HOST', ...
'user', 'DJ_USER', ...
'pass', 'DJ_PASS', ...
'init', 'DJ_INIT');

% get host address
if isempty(host)
host = input('Enter datajoint host address> ','s');
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
DOCKER_CLIENT_TIMEOUT: "120"
COMPOSE_HTTP_TIMEOUT: "120"
run: |
docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
docker-compose -f LNX-docker-compose.yaml up --build --exit-code-from app
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mym/
*.env
notebook
*getSchema.m
docker-compose.yml
docker-compose.yaml
.vscode
matlab.prf
win.*
Expand Down
21 changes: 11 additions & 10 deletions LNX-docker-compose.yml → LNX-docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# docker-compose -f LNX-docker-compose.yml --env-file LNX.env up --build --exit-code-from app
# docker-compose -f LNX-docker-compose.yaml --env-file LNX.env up --build --exit-code-from app
version: '2.2'
x-net: &net
networks:
Expand Down Expand Up @@ -79,11 +79,11 @@ services:
try\
websave([tempdir 'GHToolbox.mltbx'],\
['https://github.com/datajoint/GHToolbox' \
'/releases/download/' subsref(webread(['https://api.github.com/repos' \
'/releases/download/' subsref(webread(['https://api.github.com/repos' \
'/datajoint/GHToolbox' \
'/releases/latest']),\
substruct('.', 'tag_name')) \
'/GHToolbox.mltbx']);\
substruct('.', 'tag_name')) \
'/GHToolbox.mltbx']);\
matlab.addons.toolbox.installToolbox([tempdir 'GHToolbox.mltbx']);\
fid = fopen('README.md', 'r');\
docs = fread(fid, '*char')';\
Expand All @@ -92,18 +92,19 @@ services:
'Raphael Guzman',\
'raphael.h.guzman@gmail.com',\
['Scientific workflow management framework built on top of a ' \
'relational database.'],\
'relational database.'],\
docs,\
{'.vscode', '.git', '*.env', '.gitignore', '*.yml', 'tests', 'mym'\
'docs-parts', '*.txt', '*.prf', '*.md'},\
{'.vscode', '.git*', '*.env', '*.yaml', 'tests', 'mym', 'docs-parts',\
'*.txt', '*.prf', '*.md', 'notebook'},\
@() strjoin(arrayfun(@(x) num2str(x),\
cell2mat(struct2cell(dj.version)),\
'uni', false),\
'.'),\
cell2mat(struct2cell(dj.version)),\
'uni', false),\
'.'),\
{'+dj', 'erd.m'});\
matlab.addons.toolbox.installToolbox('DataJoint.mltbx');\
cd(getenv('ORIG_DIR'));\
addpath('tests');\
dir(fileparts(which('erd')));\
res=run(Main);\
disp(res);\
if all([res.Passed]) exit, else exit(1), end;\
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ MATLAB_UID=1000
MATLAB_GID=1000
MYSQL_TAG=5.7
```
* `cp local-docker-compose.yml docker-compose.yml`
* `cp local-docker-compose.yaml docker-compose.yaml`
* `docker-compose up` (Note configured `JUPYTER_PASSWORD`)
* Select a means of running MATLAB e.g. Jupyter Notebook, GUI, or Terminal (see bottom)
* Add `tests` directory to path e.g. in MATLAB, `addpath('tests')`
Expand Down
7 changes: 4 additions & 3 deletions local-docker-compose.yml → local-docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# docker-compose -f local-docker-compose.yml --env-file LNX.env up --build
# docker-compose -f local-docker-compose.yaml --env-file LNX.env up --build
version: '2.4'
x-net: &net
networks:
Expand Down Expand Up @@ -105,8 +105,8 @@ services:
['Scientific workflow management framework built on top of a ' \
'relational database.'],\
docs,\
{'.vscode', '.git', '*.env', '.gitignore', '*.yml', 'tests', 'mym'\
'docs-parts', '*.txt', '*.prf', '*.md'},\
{'.vscode', '.git*', '*.env', '*.yaml', 'tests', 'mym', 'docs-parts',\
'*.txt', '*.prf', '*.md', 'notebook'},\
@() strjoin(arrayfun(@(x) num2str(x),\
cell2mat(struct2cell(dj.version)),\
'uni', false),\
Expand All @@ -116,6 +116,7 @@ services:
addpath('tests');\
savepath;\
cd(tempdir);\
dir(fileparts(which('erd')));\
disp(dj.version);\
"
cd "$${ORIG_DIR}"
Expand Down
34 changes: 34 additions & 0 deletions tests/TestConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,39 @@ function TestConnection_testPort(testCase)
testCase.CONN_INFO.password,'',true), ...
'MySQL:Error');
end
function TestConnection_testTransactionRollback(testCase)
st = dbstack;
disp(['---------------' st(1).name '---------------']);
package = 'University';

c1 = dj.conn(...
testCase.CONN_INFO.host,...
testCase.CONN_INFO.user,...
testCase.CONN_INFO.password,'',true);
dj.createSchema(package,[testCase.test_root '/test_schemas'], ...
[testCase.PREFIX '_university']);
schema = University.getSchema;
tmp = {
20 'Henry' 'Jupyter' '2020-11-25 12:34:56'
21 'Lacy' 'Mars' '2017-11-25 12:34:56'
};

insert(University.Student, tmp(1, :));

schema.conn.startTransaction
try
insert(University.Student, tmp(2, :));
assert(false, 'Customer:Error', 'Message')
catch ME
schema.conn.cancelTransaction
if ~strcmp(ME.identifier,'Customer:Error')
rethrow(ME);
end
end

q = University.Student & 'student_id in (20,21)';
testCase.verifyEqual(q.count, 1);
testCase.verifyEqual(q.fetch1('student_id'), 20);
end
end
end
5 changes: 0 additions & 5 deletions tests/TestTls.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ function TestTls_testRejectException(testCase)
'djssl', ...
'',true,false);
testCase.verifyTrue(false);
% catch
% e = lasterror;
% testCase.verifyEqual(e.identifier, 'MySQL:Error');
% testCase.verifyTrue(contains(e.message,...
% {'requires secure connection','Access denied'})); %MySQL8,MySQL5
catch ME
testCase.verifyEqual(ME.identifier, 'MySQL:Error');
testCase.verifyTrue(contains(ME.message,'requires secure connection') || ...
Expand Down