Skip to content

Replace neokit with boltkit #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 20, 2017
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
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,19 @@ See files under `examples/` on how to use.

## Testing

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:

pip install --upgrade boltkit

To run tests against "default" Neo4j version:

./runTests.sh

To run tests against specified Neo4j version (latest enterprise 3.2 snapshot in this case):

./runTests.sh '-e 3.2'

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

For development, you can have the build tool rerun the tests each time you change
the source code:
Expand Down
44 changes: 6 additions & 38 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gulp = require('gulp');
var through = require('through2');
var gulpif = require('gulp-if');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var gutil = require('gulp-util');
Expand All @@ -40,14 +39,14 @@ var decompress = require('gulp-decompress');
var fs = require("fs-extra");
var runSequence = require('run-sequence');
var path = require('path');
var childProcess = require("child_process");
var minimist = require('minimist');
var cucumber = require('gulp-cucumber');
var merge = require('merge-stream');
var install = require("gulp-install");
var os = require('os');
var file = require('gulp-file');
var semver = require('semver');
var sharedNeo4j = require('./test/internal/shared-neo4j').default;

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

Expand Down Expand Up @@ -232,43 +231,12 @@ gulp.task('set', function() {
});


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

gulp.task('start-neo4j', function() {

var neorunStartArgs = '-p neo4j'; // default args to neorun.start: change the default password to neo4j
process.argv.slice(2).forEach(function (val) {
if(val.startsWith(neorunStartArgsName))
{
neorunStartArgs = val.split("=")[1];
}
});

neorunStartArgs = neorunStartArgs.match(/\S+/g) || '';

return runScript([
neorunPath, '--start=' + neo4jHome
].concat( neorunStartArgs ) );
gulp.task('start-neo4j', function () {
sharedNeo4j.start(neo4jHome, process.env.NEOCTRL_ARGS);
});

gulp.task('stop-neo4j', function() {
return runScript([
neorunPath, '--stop=' + neo4jHome
]);
gulp.task('stop-neo4j', function () {
sharedNeo4j.stop(neo4jHome);
});

var runScript = function(cmd) {
var spawnSync = childProcess.spawnSync, child, code;
child = spawnSync('python', cmd);
console.log("Script Outputs:\n" + child.stdout.toString());
var error = child.stderr.toString();
if (error.trim() !== "")
console.log("Script Errors:\n"+ error);
code = child.status;
if( code !==0 )
{
throw "Script finished with code " + code
}
};
1 change: 0 additions & 1 deletion neokit
Submodule neokit deleted from 6d5d05
2 changes: 1 addition & 1 deletion runTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ try
}
else
{
$env:NEORUN_START_ARGS="$args"
$env:NEOCTRL_ARGS="$args"
npm run start-neo4j
}

Expand Down
7 changes: 3 additions & 4 deletions runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ npm install
if [ "$1" == "" ]; then
npm run start-neo4j
else
# Example: ./runTests.sh '-v 3.0.1 -p neo4j'
# Example: npm run start-neo4j -- --neorun.start.args='-v 3.0.1 -p neo4j'
NEORUN_START_ARGS="$1" npm run start-neo4j
# Example: ./runTests.sh '-e 3.1.3'
NEOCTRL_ARGS="$1" npm run start-neo4j
fi

sleep 2
npm test
npm test
19 changes: 14 additions & 5 deletions test/internal/connector.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {Packer} from '../../src/v1/internal/packstream';
import {Chunker} from '../../src/v1/internal/chunking';
import {alloc} from '../../src/v1/internal/buf';
import {Neo4jError} from '../../src/v1/error';
import sharedNeo4j from '../internal/shared-neo4j';

describe('connector', () => {

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

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

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

// When
conn.initialize("mydriver/0.0.0", {scheme: "basic", principal: "neo4j", credentials: "neo4j"});
conn.initialize("mydriver/0.0.0", basicAuthToken());
conn.run("RETURN 1", {});
conn.sync();
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 ');
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 ');
done();
});

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

// When
conn.initialize("mydriver/0.0.0", {scheme: "basic", principal: "neo4j", credentials: "neo4j"}, {
conn.initialize("mydriver/0.0.0", basicAuthToken(), {
onCompleted: msg => {
},
onError: err => {
Expand Down Expand Up @@ -142,4 +143,12 @@ describe('connector', () => {
}).toThrow(new Neo4jError(expectedMessage, expectedCode));
}

function basicAuthToken() {
return {
scheme: 'basic',
principal: sharedNeo4j.username,
credentials: sharedNeo4j.password
};
}

});
Loading