@nginstack/engine-node 77.0.40 → 78.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -37
- package/index.js +1 -1
- package/lib/Engine.js +535 -535
- package/lib/Engine.spec.js +96 -96
- package/package.json +2 -2
package/lib/Engine.spec.js
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
const Engine = require('./Engine');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const del = require('del');
|
|
5
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
|
-
const expect = require('chai').expect;
|
|
7
|
-
const findUp = require('find-up');
|
|
8
|
-
const dotenv = require('dotenv');
|
|
9
|
-
|
|
10
|
-
let workspaceRoot = findUp.sync('.git', { type: 'directory' });
|
|
11
|
-
if (!workspaceRoot) {
|
|
12
|
-
workspaceRoot = findUp.sync('package.json');
|
|
13
|
-
}
|
|
14
|
-
workspaceRoot = path.dirname(workspaceRoot);
|
|
15
|
-
|
|
16
|
-
dotenv.config({
|
|
17
|
-
path: path.resolve(workspaceRoot, '.env')
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('Engine', function () {
|
|
21
|
-
|
|
22
|
-
it('should install and uninstall', async function () {
|
|
23
|
-
const installPath = path.resolve(workspaceRoot, '.engine',
|
|
24
|
-
process.env.ENGINE_DATABASE, 'install-test');
|
|
25
|
-
if (fs.existsSync(installPath)) {
|
|
26
|
-
del.sync(installPath.replace(/\\/g, '/'), {
|
|
27
|
-
force: true
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
const engine = new Engine(
|
|
31
|
-
installPath,
|
|
32
|
-
process.env.ENGINE_URL,
|
|
33
|
-
process.env.ENGINE_DATABASE, {
|
|
34
|
-
instanceId: Engine.formatWorkspaceInstanceId()
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
expect(engine.installed).to.be.false;
|
|
38
|
-
await engine.install();
|
|
39
|
-
expect(engine.installed).to.be.true;
|
|
40
|
-
await engine.uninstall();
|
|
41
|
-
expect(engine.installed).to.be.false;
|
|
42
|
-
expect(fs.existsSync(installPath)).to.be.false;
|
|
43
|
-
}).timeout(5 * 60000);
|
|
44
|
-
|
|
45
|
-
it('should start and stop', async function () {
|
|
46
|
-
const dbName = 'NGINSTACK';
|
|
47
|
-
const dbUrl = 'https://nginstack.nginstack.com';
|
|
48
|
-
const installPath = path.resolve(workspaceRoot, '.engine', dbName);
|
|
49
|
-
const engine = new Engine(installPath, dbUrl, dbName, {
|
|
50
|
-
instanceId: Engine.formatWorkspaceInstanceId()
|
|
51
|
-
});
|
|
52
|
-
if (!engine.installed) {
|
|
53
|
-
await engine.install();
|
|
54
|
-
}
|
|
55
|
-
await engine.start();
|
|
56
|
-
expect(engine.running).to.be.true;
|
|
57
|
-
await engine.stop();
|
|
58
|
-
expect(engine.running).to.be.false;
|
|
59
|
-
}).timeout(20 * 60000);
|
|
60
|
-
|
|
61
|
-
it('should redirect logs to console', async function () {
|
|
62
|
-
const nativeLog = console.log;
|
|
63
|
-
let startupLogFound = false;
|
|
64
|
-
let shutdownLogFound = false;
|
|
65
|
-
console.log = function (s) {
|
|
66
|
-
if (String(s).includes('Starting DBContextManager')) {
|
|
67
|
-
startupLogFound = true;
|
|
68
|
-
}
|
|
69
|
-
if (String(s).includes('Engine was requested to shutdown')) {
|
|
70
|
-
shutdownLogFound = true;
|
|
71
|
-
}
|
|
72
|
-
return nativeLog.apply(console, arguments);
|
|
73
|
-
};
|
|
74
|
-
try {
|
|
75
|
-
const dbName = 'NGINSTACK';
|
|
76
|
-
const dbUrl = 'https://nginstack.nginstack.com';
|
|
77
|
-
const installPath = path.resolve(workspaceRoot, '.engine', dbName);
|
|
78
|
-
const engine = new Engine(installPath, dbUrl, dbName, {
|
|
79
|
-
instanceId: Engine.formatWorkspaceInstanceId(),
|
|
80
|
-
redirectLogsToStdout: true
|
|
81
|
-
});
|
|
82
|
-
if (!engine.installed) {
|
|
83
|
-
await engine.install();
|
|
84
|
-
}
|
|
85
|
-
await engine.start();
|
|
86
|
-
expect(engine.running).to.be.true;
|
|
87
|
-
await engine.stop();
|
|
88
|
-
expect(engine.running).to.be.false;
|
|
89
|
-
expect(startupLogFound).to.be.true;
|
|
90
|
-
expect(shutdownLogFound).to.be.true;
|
|
91
|
-
} finally {
|
|
92
|
-
console.log = nativeLog;
|
|
93
|
-
}
|
|
94
|
-
}).timeout(20 * 60000);
|
|
95
|
-
|
|
96
|
-
});
|
|
1
|
+
const Engine = require('./Engine');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const del = require('del');
|
|
5
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
|
+
const expect = require('chai').expect;
|
|
7
|
+
const findUp = require('find-up');
|
|
8
|
+
const dotenv = require('dotenv');
|
|
9
|
+
|
|
10
|
+
let workspaceRoot = findUp.sync('.git', { type: 'directory' });
|
|
11
|
+
if (!workspaceRoot) {
|
|
12
|
+
workspaceRoot = findUp.sync('package.json');
|
|
13
|
+
}
|
|
14
|
+
workspaceRoot = path.dirname(workspaceRoot);
|
|
15
|
+
|
|
16
|
+
dotenv.config({
|
|
17
|
+
path: path.resolve(workspaceRoot, '.env')
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe('Engine', function () {
|
|
21
|
+
|
|
22
|
+
it('should install and uninstall', async function () {
|
|
23
|
+
const installPath = path.resolve(workspaceRoot, '.engine',
|
|
24
|
+
process.env.ENGINE_DATABASE, 'install-test');
|
|
25
|
+
if (fs.existsSync(installPath)) {
|
|
26
|
+
del.sync(installPath.replace(/\\/g, '/'), {
|
|
27
|
+
force: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const engine = new Engine(
|
|
31
|
+
installPath,
|
|
32
|
+
process.env.ENGINE_URL,
|
|
33
|
+
process.env.ENGINE_DATABASE, {
|
|
34
|
+
instanceId: Engine.formatWorkspaceInstanceId()
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
expect(engine.installed).to.be.false;
|
|
38
|
+
await engine.install();
|
|
39
|
+
expect(engine.installed).to.be.true;
|
|
40
|
+
await engine.uninstall();
|
|
41
|
+
expect(engine.installed).to.be.false;
|
|
42
|
+
expect(fs.existsSync(installPath)).to.be.false;
|
|
43
|
+
}).timeout(5 * 60000);
|
|
44
|
+
|
|
45
|
+
it('should start and stop', async function () {
|
|
46
|
+
const dbName = 'NGINSTACK';
|
|
47
|
+
const dbUrl = 'https://nginstack.nginstack.com';
|
|
48
|
+
const installPath = path.resolve(workspaceRoot, '.engine', dbName);
|
|
49
|
+
const engine = new Engine(installPath, dbUrl, dbName, {
|
|
50
|
+
instanceId: Engine.formatWorkspaceInstanceId()
|
|
51
|
+
});
|
|
52
|
+
if (!engine.installed) {
|
|
53
|
+
await engine.install();
|
|
54
|
+
}
|
|
55
|
+
await engine.start();
|
|
56
|
+
expect(engine.running).to.be.true;
|
|
57
|
+
await engine.stop();
|
|
58
|
+
expect(engine.running).to.be.false;
|
|
59
|
+
}).timeout(20 * 60000);
|
|
60
|
+
|
|
61
|
+
it('should redirect logs to console', async function () {
|
|
62
|
+
const nativeLog = console.log;
|
|
63
|
+
let startupLogFound = false;
|
|
64
|
+
let shutdownLogFound = false;
|
|
65
|
+
console.log = function (s) {
|
|
66
|
+
if (String(s).includes('Starting DBContextManager')) {
|
|
67
|
+
startupLogFound = true;
|
|
68
|
+
}
|
|
69
|
+
if (String(s).includes('Engine was requested to shutdown')) {
|
|
70
|
+
shutdownLogFound = true;
|
|
71
|
+
}
|
|
72
|
+
return nativeLog.apply(console, arguments);
|
|
73
|
+
};
|
|
74
|
+
try {
|
|
75
|
+
const dbName = 'NGINSTACK';
|
|
76
|
+
const dbUrl = 'https://nginstack.nginstack.com';
|
|
77
|
+
const installPath = path.resolve(workspaceRoot, '.engine', dbName);
|
|
78
|
+
const engine = new Engine(installPath, dbUrl, dbName, {
|
|
79
|
+
instanceId: Engine.formatWorkspaceInstanceId(),
|
|
80
|
+
redirectLogsToStdout: true
|
|
81
|
+
});
|
|
82
|
+
if (!engine.installed) {
|
|
83
|
+
await engine.install();
|
|
84
|
+
}
|
|
85
|
+
await engine.start();
|
|
86
|
+
expect(engine.running).to.be.true;
|
|
87
|
+
await engine.stop();
|
|
88
|
+
expect(engine.running).to.be.false;
|
|
89
|
+
expect(startupLogFound).to.be.true;
|
|
90
|
+
expect(shutdownLogFound).to.be.true;
|
|
91
|
+
} finally {
|
|
92
|
+
console.log = nativeLog;
|
|
93
|
+
}
|
|
94
|
+
}).timeout(20 * 60000);
|
|
95
|
+
|
|
96
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nginstack/engine-node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "78.0.8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"thread-sleep": "^2.2.0",
|
|
25
25
|
"tmp": "^0.2.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "358e5ca14bd7e3918cb26a883585d13231884a08"
|
|
28
28
|
}
|