Skip to content

Commit f0dc44d

Browse files
committed
Merge branch 1.2 into 1.3
2 parents 0375eb0 + 4ba6cc7 commit f0dc44d

22 files changed

+375
-149
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,19 @@ See files under `examples/` on how to use.
224224

225225
## Testing
226226

227+
Tests **require** latest [Boltkit](https://github.com/neo4j-contrib/boltkit) to be installed in the system. It is needed to start, stop and configure local test database. Boltkit can be installed with the following command:
228+
229+
pip install --upgrade boltkit
230+
231+
To run tests against "default" Neo4j version:
232+
227233
./runTests.sh
234+
235+
To run tests against specified Neo4j version (latest enterprise 3.2 snapshot in this case):
236+
237+
./runTests.sh '-e 3.2'
228238

229-
This runs the test suite against a fresh download of Neo4j.
230-
Or `npm test` if you already have a running version of a compatible Neo4j server.
239+
Simple `npm test` can also be used if you already have a running version of a compatible Neo4j server.
231240

232241
For development, you can have the build tool rerun the tests each time you change
233242
the source code:

gulpfile.babel.js

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ var source = require('vinyl-source-stream');
2222
var buffer = require('vinyl-buffer');
2323
var gulp = require('gulp');
2424
var through = require('through2');
25-
var gulpif = require('gulp-if');
2625
var uglify = require('gulp-uglify');
2726
var concat = require('gulp-concat');
2827
var gutil = require('gulp-util');
@@ -40,14 +39,14 @@ var decompress = require('gulp-decompress');
4039
var fs = require("fs-extra");
4140
var runSequence = require('run-sequence');
4241
var path = require('path');
43-
var childProcess = require("child_process");
4442
var minimist = require('minimist');
4543
var cucumber = require('gulp-cucumber');
4644
var merge = require('merge-stream');
4745
var install = require("gulp-install");
4846
var os = require('os');
4947
var file = require('gulp-file');
5048
var semver = require('semver');
49+
var sharedNeo4j = require('./test/internal/shared-neo4j').default;
5150

5251
gulp.task('default', ["test"]);
5352

@@ -232,43 +231,12 @@ gulp.task('set', function() {
232231
});
233232

234233

235-
var neo4jHome = path.resolve('./build/neo4j');
236-
var neorunPath = path.resolve('./neokit/neorun.py');
237-
var neorunStartArgsName = "--neorun.start.args"; // use this args to provide additional args for running neorun.start
234+
var neo4jHome = path.resolve('./build/neo4j');
238235

239-
gulp.task('start-neo4j', function() {
240-
241-
var neorunStartArgs = '-p neo4j'; // default args to neorun.start: change the default password to neo4j
242-
process.argv.slice(2).forEach(function (val) {
243-
if(val.startsWith(neorunStartArgsName))
244-
{
245-
neorunStartArgs = val.split("=")[1];
246-
}
247-
});
248-
249-
neorunStartArgs = neorunStartArgs.match(/\S+/g) || '';
250-
251-
return runScript([
252-
neorunPath, '--start=' + neo4jHome
253-
].concat( neorunStartArgs ) );
236+
gulp.task('start-neo4j', function () {
237+
sharedNeo4j.start(neo4jHome, process.env.NEOCTRL_ARGS);
254238
});
255239

256-
gulp.task('stop-neo4j', function() {
257-
return runScript([
258-
neorunPath, '--stop=' + neo4jHome
259-
]);
240+
gulp.task('stop-neo4j', function () {
241+
sharedNeo4j.stop(neo4jHome);
260242
});
261-
262-
var runScript = function(cmd) {
263-
var spawnSync = childProcess.spawnSync, child, code;
264-
child = spawnSync('python', cmd);
265-
console.log("Script Outputs:\n" + child.stdout.toString());
266-
var error = child.stderr.toString();
267-
if (error.trim() !== "")
268-
console.log("Script Errors:\n"+ error);
269-
code = child.status;
270-
if( code !==0 )
271-
{
272-
throw "Script finished with code " + code
273-
}
274-
};

neokit

Lines changed: 0 additions & 1 deletion
This file was deleted.

runTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ try
1010
}
1111
else
1212
{
13-
$env:NEORUN_START_ARGS="$args"
13+
$env:NEOCTRL_ARGS="$args"
1414
npm run start-neo4j
1515
}
1616

runTests.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ npm install
1010
if [ "$1" == "" ]; then
1111
npm run start-neo4j
1212
else
13-
# Example: ./runTests.sh '-v 3.0.1 -p neo4j'
14-
# Example: npm run start-neo4j -- --neorun.start.args='-v 3.0.1 -p neo4j'
15-
NEORUN_START_ARGS="$1" npm run start-neo4j
13+
# Example: ./runTests.sh '-e 3.1.3'
14+
NEOCTRL_ARGS="$1" npm run start-neo4j
1615
fi
1716

1817
sleep 2
19-
npm test
18+
npm test

test/internal/connector.test.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {Packer} from '../../src/v1/internal/packstream';
2323
import {Chunker} from '../../src/v1/internal/chunking';
2424
import {alloc} from '../../src/v1/internal/buf';
2525
import {Neo4jError} from '../../src/v1/error';
26+
import sharedNeo4j from '../internal/shared-neo4j';
2627

2728
describe('connector', () => {
2829

@@ -31,7 +32,7 @@ describe('connector', () => {
3132
const conn = connect("bolt://localhost");
3233

3334
// When
34-
conn.initialize("mydriver/0.0.0", {scheme: "basic", principal: "neo4j", credentials: "neo4j"}, {
35+
conn.initialize("mydriver/0.0.0", basicAuthToken(), {
3536
onCompleted: msg => {
3637
expect(msg).not.toBeNull();
3738
conn.close();
@@ -49,7 +50,7 @@ describe('connector', () => {
4950

5051
// When
5152
const records = [];
52-
conn.initialize("mydriver/0.0.0", {scheme: "basic", principal: "neo4j", credentials: "neo4j"});
53+
conn.initialize("mydriver/0.0.0", basicAuthToken());
5354
conn.run("RETURN 1.0", {});
5455
conn.pullAll({
5556
onNext: record => {
@@ -70,10 +71,10 @@ describe('connector', () => {
7071
const conn = connect("bolt://localhost", {channel: DummyChannel.channel});
7172

7273
// When
73-
conn.initialize("mydriver/0.0.0", {scheme: "basic", principal: "neo4j", credentials: "neo4j"});
74+
conn.initialize("mydriver/0.0.0", basicAuthToken());
7475
conn.run("RETURN 1", {});
7576
conn.sync();
76-
expect(observer.instance.toHex()).toBe('60 60 b0 17 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 41 b2 01 8e 6d 79 64 72 69 76 65 72 2f 30 2e 30 2e 30 a3 86 73 63 68 65 6d 65 85 62 61 73 69 63 89 70 72 69 6e 63 69 70 61 6c 85 6e 65 6f 34 6a 8b 63 72 65 64 65 6e 74 69 61 6c 73 85 6e 65 6f 34 6a 00 00 00 0c b2 10 88 52 45 54 55 52 4e 20 31 a0 00 00 ');
77+
expect(observer.instance.toHex()).toBe('60 60 b0 17 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 44 b2 01 8e 6d 79 64 72 69 76 65 72 2f 30 2e 30 2e 30 a3 86 73 63 68 65 6d 65 85 62 61 73 69 63 89 70 72 69 6e 63 69 70 61 6c 85 6e 65 6f 34 6a 8b 63 72 65 64 65 6e 74 69 61 6c 73 88 70 61 73 73 77 6f 72 64 00 00 00 0c b2 10 88 52 45 54 55 52 4e 20 31 a0 00 00 ');
7778
done();
7879
});
7980

@@ -82,7 +83,7 @@ describe('connector', () => {
8283
const conn = connect("bolt://localhost:7474", {encrypted: false});
8384

8485
// When
85-
conn.initialize("mydriver/0.0.0", {scheme: "basic", principal: "neo4j", credentials: "neo4j"}, {
86+
conn.initialize("mydriver/0.0.0", basicAuthToken(), {
8687
onCompleted: msg => {
8788
},
8889
onError: err => {
@@ -142,4 +143,12 @@ describe('connector', () => {
142143
}).toThrow(new Neo4jError(expectedMessage, expectedCode));
143144
}
144145

146+
function basicAuthToken() {
147+
return {
148+
scheme: 'basic',
149+
principal: sharedNeo4j.username,
150+
credentials: sharedNeo4j.password
151+
};
152+
}
153+
145154
});

0 commit comments

Comments
 (0)