Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Expect DV to have data.
expect(
dv.state.purchasedDatasets,
`Data-set ${dataSetId} was not purchased.`,
).to.have.key(dataSetId);
// Get original import info.
const dcImportInfo =
await httpApiHelper.apiImportInfo(dc.state.node_rpc_url, this.state.lastImport.data_set_id);
const dvImportInfo =
await httpApiHelper.apiImportInfo(dv.state.node_rpc_url, this.state.lastImport.data_set_id);
// TODO: fix different root hashes error.
dvImportInfo.root_hash = dcImportInfo.root_hash;
if (!deepEqual(dcImportInfo, dvImportInfo)) {
throw Error(`Objects not equal: ${JSON.stringify(dcImportInfo)} and ${JSON.stringify(dvImportInfo)}`);
}
expect(dcImportInfo.transaction, 'DC transaction hash should be defined').to.not.be.undefined;
expect(dvImportInfo.transaction, 'DV/DV2 transaction hash should be defined').to.not.be.undefined;
});
promises.push(new Promise(async (accept, reject) => {
const dhImportInfo =
await httpApiHelper.apiImportInfo(
node.state.node_rpc_url,
this.state.lastImport.data_set_id,
);
expect(dhImportInfo.transaction, 'DH transaction hash should be defined').to.not.be.undefined;
// TODO: fix different root hashes error.
dhImportInfo.root_hash = dcImportInfo.root_hash;
if (deepEqual(dcImportInfo, dhImportInfo)) {
accept();
} else {
reject(Error(`Objects not equal: ${JSON.stringify(dcImportInfo)} ` +
`and ${JSON.stringify(dhImportInfo)}`));
}
}));
}
var matchedImgs = imgs.filter(function _cachedImgFilter(img) {
// Images must have the same Cmd entry.
if (opts.cmd !== img.container_config.Cmd.join(' ')) {
return false;
}
// Some fields (like Labels) can also be set from the client, check
// that these fields are the same.
if (!(jsprim.deepEqual(opts.labels, img.image.config.Labels))) {
return false;
}
return true;
});
expect(this.state.nodesWalletAddress !== 'null', 'Nodes wallet should be non null value').to.be.equal(true);
const { dc } = this.state;
const firstImportFingerprint =
await httpApiHelper.apiFingerprint(
dc.state.node_rpc_url,
this.state.lastMinusOneImport.data_set_id,
);
expect(firstImportFingerprint).to.have.keys(['root_hash']);
expect(Utilities.isZeroHash(firstImportFingerprint.root_hash), 'root hash value should not be zero hash').to.be.equal(false);
expect(firstImportFingerprint.root_hash)
.to.be.equal(this.state.lastMinusOneImportFingerprint.root_hash);
expect(
deepEqual(firstImportFingerprint, this.state.lastMinusOneImportFingerprint),
'import and root has in both scenario should be indentical',
).to.be.equal(true);
});
{
var peer = this;
var config, error;
this.moving();
mod_assertplus.ok(this.mp_pg_online !== null);
if (this.mp_pg_transitioning) {
this.mp_log.info('skipping pgApplyConfig ' +
'(already transitioning)');
return;
}
config = this.pgConfig();
if (this.mp_pg_applied !== null &&
mod_jsprim.deepEqual(config, this.mp_pg_applied)) {
this.mp_log.info('skipping pgApplyConfig ' +
'(no changes)');
this.rest();
return;
}
error = mod_validation.validatePgStatus(config);
if (error instanceof Error)
this.fatal(error);
peer.mp_pg_transitioning = true;
mod_vasync.waterfall([
function pgReconfig(callback) {
peer.mp_log.debug('pg.reconfigure', config);
peer.mp_pg.reconfigure(config,
function (err) { callback(err); });
function _verifyStates(_, cb) {
/*
* We want to make sure that the object we verify against is the
* same as the one we'll eventually write back to ZooKeeper.
*/
if (!jsprim.deepEqual(_.state[_.shard], _.originalState)) {
cb(new VError('state has unexpectedly changed'));
return;
}
cb();
},
_addPostgresStatus,