Evaluate all env vars as part of async flow start

This commit is contained in:
Nick O'Leary
2023-06-23 02:11:57 +01:00
parent 8db2972288
commit 1c5fdb6ab6
16 changed files with 1141 additions and 1290 deletions

View File

@@ -93,7 +93,7 @@ describe('flows/index', function() {
flowCreate.flows[id] = {
flow: flow,
global: global,
start: sinon.spy(),
start: sinon.spy(async() => {}),
update: sinon.spy(),
stop: sinon.spy(),
getActiveNodes: function() {
@@ -221,13 +221,18 @@ describe('flows/index', function() {
return Promise.resolve({flows:originalConfig});
}
events.once('flows:started',function() {
flows.setFlows(newConfig,"nodes").then(function() {
flows.getFlows().flows.should.eql(newConfig);
flowCreate.flows['t1'].update.called.should.be.true();
flowCreate.flows['t2'].start.called.should.be.true();
flowCreate.flows['_GLOBAL_'].update.called.should.be.true();
done();
events.once('flows:started', function() {
try {
flows.getFlows().flows.should.eql(newConfig);
flowCreate.flows['t1'].update.called.should.be.true();
flowCreate.flows['t2'].start.called.should.be.true();
flowCreate.flows['_GLOBAL_'].update.called.should.be.true();
done();
} catch(err) {
done(err)
}
})
flows.setFlows(newConfig,"nodes")
});
flows.init({log:mockLog, settings:{},storage:storage});
@@ -250,13 +255,14 @@ describe('flows/index', function() {
}
events.once('flows:started',function() {
flows.setFlows(newConfig,"nodes").then(function() {
events.once('flows:started',function() {
flows.getFlows().flows.should.eql(newConfig);
flowCreate.flows['t1'].update.called.should.be.true();
flowCreate.flows['t2'].start.called.should.be.true();
flowCreate.flows['_GLOBAL_'].update.called.should.be.true();
flows.stopFlows().then(done);
})
flows.setFlows(newConfig,"nodes")
});
flows.init({log:mockLog, settings:{},storage:storage});