only deploy configured contracts in the tests
This commit is contained in:
parent
83227beaa1
commit
6479bf816b
|
@ -15,6 +15,7 @@ class ContractsManager {
|
|||
this.plugins = options.plugins;
|
||||
this.contractDependencies = {};
|
||||
this.gasLimit = options.gasLimit;
|
||||
this.deployOnlyOnConfig = false;
|
||||
}
|
||||
|
||||
build(done) {
|
||||
|
@ -71,6 +72,10 @@ class ContractsManager {
|
|||
for (className in self.contracts) {
|
||||
contract = self.contracts[className];
|
||||
contract.deploy = (contract.deploy === undefined) || contract.deploy;
|
||||
if (self.deployOnlyOnConfig && !self.contractsConfig.contracts[className]) {
|
||||
contract.deploy = false;
|
||||
}
|
||||
|
||||
if (contract.code === "") {
|
||||
self.logger.info("assuming " + className + " to be an interface");
|
||||
contract.deploy = false;
|
||||
|
|
|
@ -16,6 +16,7 @@ class DeployManager {
|
|||
this.contractsManager = options.contractsManager;
|
||||
this.gasLimit = false;
|
||||
this.fatalErrors = false;
|
||||
this.deployOnlyOnConfig = false;
|
||||
}
|
||||
|
||||
deployContracts(done) {
|
||||
|
@ -29,6 +30,7 @@ class DeployManager {
|
|||
|
||||
async.waterfall([
|
||||
function buildContracts(callback) {
|
||||
self.contractsManager.deployOnlyOnConfig = self.deployOnlyOnConfig; // temporary, should refactor
|
||||
self.contractsManager.build(callback);
|
||||
},
|
||||
function checkWeb3IsConnected(contractsManager, callback) {
|
||||
|
|
|
@ -79,6 +79,7 @@ Test.prototype.deployAll = function(contractsConfig, cb) {
|
|||
self.engine.deployManager.gasLimit = 6000000;
|
||||
self.engine.contractsManager.gasLimit = 6000000;
|
||||
self.engine.deployManager.fatalErrors = true;
|
||||
self.engine.deployManager.deployOnlyOnConfig = true;
|
||||
self.engine.deployManager.deployContracts(function(err, _result) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
|
|
|
@ -8,29 +8,6 @@ contract("AnotherStorage", function() {
|
|||
},
|
||||
"AnotherStorage": {
|
||||
args: ["$SimpleStorage"]
|
||||
},
|
||||
"Token": {
|
||||
deploy: false,
|
||||
args: [1000]
|
||||
},
|
||||
"MyToken": {
|
||||
instanceOf: "Token"
|
||||
},
|
||||
"MyToken2": {
|
||||
instanceOf: "Token",
|
||||
args: [2000]
|
||||
},
|
||||
"ContractArgs": {
|
||||
"args": {
|
||||
"initialValue": 123,
|
||||
"_addresses": ["$MyToken2", "$SimpleStorage"]
|
||||
}
|
||||
},
|
||||
"SomeContract": {
|
||||
"args": [
|
||||
["$MyToken2", "$SimpleStorage"],
|
||||
100
|
||||
]
|
||||
}
|
||||
};
|
||||
EmbarkSpec.deployAll(contractsConfig, () => { done() });
|
||||
|
|
|
@ -2,9 +2,13 @@ contract("Test", function() {
|
|||
before(function(done) {
|
||||
this.timeout(0);
|
||||
var contractsConfig = {
|
||||
"Test2": {
|
||||
},
|
||||
"Test": {
|
||||
"gas": 2000000
|
||||
},
|
||||
"ZAMyLib": {
|
||||
},
|
||||
"ZAMyLib2": {
|
||||
"deploy": true
|
||||
},
|
||||
|
|
|
@ -10,6 +10,10 @@ describe("Token", function() {
|
|||
//});
|
||||
|
||||
var contractsConfig = {
|
||||
"ZAMyLib": {
|
||||
},
|
||||
"Token": {
|
||||
},
|
||||
"SimpleStorage": {
|
||||
args: [100]
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue