Skip to content

Commit

Permalink
Fixed unit test. 1.5.35
Browse files Browse the repository at this point in the history
## 1.5.35
* FIPS compatibility.
* FIPS is enabled by default in all container builds, built with OpenSSL 3.0.8.
* Switched Elastic to single-node to avoid some configuration annoyances on various platforms.
* REJECT_SHA1 environment variable introduced (off by default), rejects requests made by cass-npm library < 1.5.35
* Turned logging headers off by default.
* LOG_HEADERS environment variable introduced (off by default), enables logging headers.
  • Loading branch information
Lomilar committed Sep 19, 2023
1 parent 5a228c5 commit ed330a6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
4 changes: 2 additions & 2 deletions docker/standalone/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ RUN echo 'activate = 1' >> /usr/local/ssl/nodejs.cnf

USER elasticsearch
RUN mkdir CASS
COPY src CASS/src
COPY package.json CASS/package.json
RUN cd CASS && npm install --omit=dev && npm upgrade --production --omit=dev --save && npm audit --production --audit-level=high fix
COPY src CASS/src
COPY ca.crt CASS/ca.crt
COPY cass.crt CASS/cass.crt
COPY cass.key CASS/cass.key
COPY pm2.standalone.config.js CASS/pm2.standalone.config.js
COPY copyright.txt CASS/copyright.txt
COPY LICENSE CASS/LICENSE
RUN cd CASS && npm install --omit=dev && npm upgrade --production --omit=dev --save && npm audit --production --audit-level=high fix

USER root
RUN echo '-Xms2g' >> config/jvm.options
Expand Down
9 changes: 6 additions & 3 deletions src/main/server/skyRepo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9285,9 +9285,9 @@ let validateSignaturesBulk = async function(map, errorMessage) {
const signatures = this.ctx.get('signatureSheet') || [];
for (let oldGet of oldGets) {
if (oldGet) {
const oldObj = new EcRemoteLinkedData(null, null);
oldObj.copyFrom(oldGet);
try {
const oldObj = new EcRemoteLinkedData(null, null);
oldObj.copyFrom(oldGet);
if (oldObj.owner !== undefined && oldObj.owner != null && oldObj.owner.length > 0) {
let success = false;
for (let i = 0; i < signatures.length; i++) {
Expand All @@ -9310,7 +9310,10 @@ let validateSignaturesBulk = async function(map, errorMessage) {
}
}
} catch (e) {
let id = oldGet['@id'].split('/').pop();
let id = oldObj.getGuid();
failed[id] = true;
delete map[id];
id = EcCrypto.md5(oldObj.shortId());
failed[id] = true;
delete map[id];
}
Expand Down
42 changes: 21 additions & 21 deletions src/main/server/skyRepo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,34 +165,34 @@ describe('SkyRepo Adapter', function() {
console.log(result2);
assert.strictEqual(result2.length, 0);

// const getByShortId1d = await EcRepository.get(thing1.shortId());
// assert.strictEqual(thing1bid, getByShortId1d.id);
// assert.strictEqual(getByShortId1d.name, 'Thing 1c');
const getByShortId1d = await EcRepository.get(thing1.shortId());
assert.strictEqual(thing1bid, getByShortId1d.id);
assert.strictEqual(getByShortId1d.name, 'Thing 1c');

// const getByShortId2d = await EcRepository.get(thing2.shortId());
// assert.strictEqual(thing2bid, getByShortId2d.id);
// assert.strictEqual(getByShortId2d.name, 'Thing 2c');
const getByShortId2d = await EcRepository.get(thing2.shortId());
assert.strictEqual(thing2bid, getByShortId2d.id);
assert.strictEqual(getByShortId2d.name, 'Thing 2c');

// // Should fail when field types are mix of object and not object
// Should fail when field types are mix of object and not object

// const test1 = new EcCompetency();
// test1.generateId(repo.selectedServer);
// test1.testDataField = 'string';
// test1.name = 'Test 1';
const test1 = new EcCompetency();
test1.generateId(repo.selectedServer);
test1.testDataField = 'string';
test1.name = 'Test 1';

// result = await repo.multiput([test1]);
// assert.strictEqual(result.length, 1);
result = await repo.multiput([test1]);
assert.strictEqual(result.length, 1);

// const test2 = new EcCompetency();
// test2.generateId(repo.selectedServer);
// test2.testDataField = {obj: 'thing'};
// test2.name = 'Test 2';
const test2 = new EcCompetency();
test2.generateId(repo.selectedServer);
test2.testDataField = {obj: 'thing'};
test2.name = 'Test 2';

// let result3 = await repo.multiput([test1, test2]);
// assert.strictEqual(result3.length, 1);
let result3 = await repo.multiput([test1, test2]);
assert.strictEqual(result3.length, 1);

// const getTest2 = await EcRepository.get(test2.shortId());
// assert.strictEqual(getTest2, null);
const getTest2 = await EcRepository.get(test2.shortId());
assert.strictEqual(getTest2, null);

})
});

0 comments on commit ed330a6

Please sign in to comment.