Skip to content

Commit c765eba

Browse files
Merge pull request #319 from guzman-raphael/package-ext
Fix merge issues and housekeeping items
2 parents 5e5cbbd + 6b72f10 commit c765eba

File tree

8 files changed

+52
-28
lines changed

8 files changed

+52
-28
lines changed

+dj/conn.m

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@
5151
end
5252
end
5353
else
54-
% optional environment variables specifying the connection.
55-
env = struct(...
56-
'host', 'DJ_HOST', ...
57-
'user', 'DJ_USER', ...
58-
'pass', 'DJ_PASS', ...
59-
'init', 'DJ_INIT');
60-
6154
% get host address
6255
if isempty(host)
6356
host = input('Enter datajoint host address> ','s');

.github/workflows/development.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
DOCKER_CLIENT_TIMEOUT: "120"
3737
COMPOSE_HTTP_TIMEOUT: "120"
3838
run: |
39-
docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
39+
docker-compose -f LNX-docker-compose.yaml up --build --exit-code-from app

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mym/
33
*.env
44
notebook
55
*getSchema.m
6-
docker-compose.yml
6+
docker-compose.yaml
77
.vscode
88
matlab.prf
99
win.*

LNX-docker-compose.yml renamed to LNX-docker-compose.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# docker-compose -f LNX-docker-compose.yml --env-file LNX.env up --build --exit-code-from app
1+
# docker-compose -f LNX-docker-compose.yaml --env-file LNX.env up --build --exit-code-from app
22
version: '2.2'
33
x-net: &net
44
networks:
@@ -79,11 +79,11 @@ services:
7979
try\
8080
websave([tempdir 'GHToolbox.mltbx'],\
8181
['https://github.com/datajoint/GHToolbox' \
82-
'/releases/download/' subsref(webread(['https://api.github.com/repos' \
82+
'/releases/download/' subsref(webread(['https://api.github.com/repos' \
8383
'/datajoint/GHToolbox' \
8484
'/releases/latest']),\
85-
substruct('.', 'tag_name')) \
86-
'/GHToolbox.mltbx']);\
85+
substruct('.', 'tag_name')) \
86+
'/GHToolbox.mltbx']);\
8787
matlab.addons.toolbox.installToolbox([tempdir 'GHToolbox.mltbx']);\
8888
fid = fopen('README.md', 'r');\
8989
docs = fread(fid, '*char')';\
@@ -92,18 +92,19 @@ services:
9292
'Raphael Guzman',\
9393
'raphael.h.guzman@gmail.com',\
9494
['Scientific workflow management framework built on top of a ' \
95-
'relational database.'],\
95+
'relational database.'],\
9696
docs,\
97-
{'.vscode', '.git', '*.env', '.gitignore', '*.yml', 'tests', 'mym'\
98-
'docs-parts', '*.txt', '*.prf', '*.md'},\
97+
{'.vscode', '.git*', '*.env', '*.yaml', 'tests', 'mym', 'docs-parts',\
98+
'*.txt', '*.prf', '*.md', 'notebook'},\
9999
@() strjoin(arrayfun(@(x) num2str(x),\
100-
cell2mat(struct2cell(dj.version)),\
101-
'uni', false),\
102-
'.'),\
100+
cell2mat(struct2cell(dj.version)),\
101+
'uni', false),\
102+
'.'),\
103103
{'+dj', 'erd.m'});\
104104
matlab.addons.toolbox.installToolbox('DataJoint.mltbx');\
105105
cd(getenv('ORIG_DIR'));\
106106
addpath('tests');\
107+
dir(fileparts(which('erd')));\
107108
res=run(Main);\
108109
disp(res);\
109110
if all([res.Passed]) exit, else exit(1), end;\

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ MATLAB_UID=1000
4747
MATLAB_GID=1000
4848
MYSQL_TAG=5.7
4949
```
50-
* `cp local-docker-compose.yml docker-compose.yml`
50+
* `cp local-docker-compose.yaml docker-compose.yaml`
5151
* `docker-compose up` (Note configured `JUPYTER_PASSWORD`)
5252
* Select a means of running MATLAB e.g. Jupyter Notebook, GUI, or Terminal (see bottom)
5353
* Add `tests` directory to path e.g. in MATLAB, `addpath('tests')`

local-docker-compose.yml renamed to local-docker-compose.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# docker-compose -f local-docker-compose.yml --env-file LNX.env up --build
1+
# docker-compose -f local-docker-compose.yaml --env-file LNX.env up --build
22
version: '2.4'
33
x-net: &net
44
networks:
@@ -105,8 +105,8 @@ services:
105105
['Scientific workflow management framework built on top of a ' \
106106
'relational database.'],\
107107
docs,\
108-
{'.vscode', '.git', '*.env', '.gitignore', '*.yml', 'tests', 'mym'\
109-
'docs-parts', '*.txt', '*.prf', '*.md'},\
108+
{'.vscode', '.git*', '*.env', '*.yaml', 'tests', 'mym', 'docs-parts',\
109+
'*.txt', '*.prf', '*.md', 'notebook'},\
110110
@() strjoin(arrayfun(@(x) num2str(x),\
111111
cell2mat(struct2cell(dj.version)),\
112112
'uni', false),\
@@ -116,6 +116,7 @@ services:
116116
addpath('tests');\
117117
savepath;\
118118
cd(tempdir);\
119+
dir(fileparts(which('erd')));\
119120
disp(dj.version);\
120121
"
121122
cd "$${ORIG_DIR}"

tests/TestConnection.m

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,39 @@ function TestConnection_testPort(testCase)
3939
testCase.CONN_INFO.password,'',true), ...
4040
'MySQL:Error');
4141
end
42+
function TestConnection_testTransactionRollback(testCase)
43+
st = dbstack;
44+
disp(['---------------' st(1).name '---------------']);
45+
package = 'University';
46+
47+
c1 = dj.conn(...
48+
testCase.CONN_INFO.host,...
49+
testCase.CONN_INFO.user,...
50+
testCase.CONN_INFO.password,'',true);
51+
dj.createSchema(package,[testCase.test_root '/test_schemas'], ...
52+
[testCase.PREFIX '_university']);
53+
schema = University.getSchema;
54+
tmp = {
55+
20 'Henry' 'Jupyter' '2020-11-25 12:34:56'
56+
21 'Lacy' 'Mars' '2017-11-25 12:34:56'
57+
};
58+
59+
insert(University.Student, tmp(1, :));
60+
61+
schema.conn.startTransaction
62+
try
63+
insert(University.Student, tmp(2, :));
64+
assert(false, 'Customer:Error', 'Message')
65+
catch ME
66+
schema.conn.cancelTransaction
67+
if ~strcmp(ME.identifier,'Customer:Error')
68+
rethrow(ME);
69+
end
70+
end
71+
72+
q = University.Student & 'student_id in (20,21)';
73+
testCase.verifyEqual(q.count, 1);
74+
testCase.verifyEqual(q.fetch1('student_id'), 20);
75+
end
4276
end
4377
end

tests/TestTls.m

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ function TestTls_testRejectException(testCase)
4747
'djssl', ...
4848
'',true,false);
4949
testCase.verifyTrue(false);
50-
% catch
51-
% e = lasterror;
52-
% testCase.verifyEqual(e.identifier, 'MySQL:Error');
53-
% testCase.verifyTrue(contains(e.message,...
54-
% {'requires secure connection','Access denied'})); %MySQL8,MySQL5
5550
catch ME
5651
testCase.verifyEqual(ME.identifier, 'MySQL:Error');
5752
testCase.verifyTrue(contains(ME.message,'requires secure connection') || ...

0 commit comments

Comments
 (0)