Build standard: never take a fiber dark under a customer's wave; the intern no longer skips leased pairs and IRUs
The build standard's Apply could swap the line system on a fiber that carries a sold alien wave or a Lambda Bazaar managed wave, taking those customers dark for a day with no warning. The intern refused any fiber with any customer on it, leased pairs and IRUs included, though a line-system swap cannot touch them. One helper next to fiberOk(), dfWaveCust(), says whether a customer rides the fiber's line system (every fiber type but glass: dfpair, pairs, capfib), and both bstdDarkOk() and opsDarkPre() use it. bstdPlan() holds such a fiber (J.held) and lists it in J.wv; the sheet and the MCP quote give that reason. The link panel's own upgrade button (ACT.upSys) still swaps with a warning toast.
This commit is contained in:
parent
1f76639b8f
commit
286ae48207
14 changed files with 102 additions and 24 deletions
|
|
@ -283,6 +283,51 @@ test('a busy fiber with nothing parallel keeps its line system: the sheet, the b
|
|||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test("a customer's wave keeps its fiber's line system, for the button and the intern; leased pairs and IRUs do not", t => {
|
||||
const h = load({ agent: true });
|
||||
t.after(() => h.dom.window.close());
|
||||
const { ev, errors } = h;
|
||||
ev(BASE);
|
||||
const chonk = ev("RG.findIndex(r=>r.n==='Chonk 800')");
|
||||
ev(`ACT.buildPop({city:'par'});for(const c of ['fra','ams','par']){S.pops[c].rgen=${chonk};S.pops[c].routers=4;}`);
|
||||
// Two quiet fibers: Amsterdam's carries a carrier's managed 100G wave (Lambda Bazaar), Paris's nothing.
|
||||
const a = fiber(ev, 'fra', 'ams', ['zr4', 'zr4']), b = fiber(ev, 'fra', 'par', ['zr4', 'zr4']);
|
||||
ev(`S.biz.push({id:'mw',name:'Photon Express',city:'fra',city2:'ams',link:${lit(a)},slots:1,g:100,type:'mwave',bw:1,rate:1000,reqs:[],mood:100,since:S.day})`);
|
||||
const quiet = 'compute();for(const l of S.links)R.load[l.id]=0;';
|
||||
ev(quiet);
|
||||
assert.equal(ev("fiberOk(S.biz.find(b=>b.id==='mw'))"), true);
|
||||
std(ev, { sys: 'roadm' });
|
||||
const q = JSON.parse(ev('JSON.stringify(bstdQuote(false))'));
|
||||
assert.deepEqual([q.held, q.wv, q.wait, q.links, q.n], [['fra|ams'], ['fra|ams'], [], 2, 1], 'only Paris\'s fiber is on the bill');
|
||||
ev(`closeModal();${quiet}`);
|
||||
const dry = JSON.parse(ev("JSON.stringify(apiRun('bstdApply',{},{dryRun:true}))"));
|
||||
assert.match(dry.quote.blocked[0], /^Frankfurt–Amsterdam: its line system waits: a customer's wave rides it/);
|
||||
ev(`${quiet}ACT.bstdOpen()`);
|
||||
const txt = h.dom.window.document.getElementById('modalCard').textContent;
|
||||
assert.match(txt, /One fiber keeps its line system: a customer's wave rides it/);
|
||||
assert.doesNotMatch(txt, /until it is quiet/, 'not the reason a busy fiber waits for');
|
||||
ev(`${quiet}document.querySelector('#modalCard [data-act="bstdApply"]').click()`);
|
||||
const L = id => JSON.parse(ev(`JSON.stringify(S.links.find(l=>l.id===${lit(id)}))`));
|
||||
assert.equal(L(b).sys, 'roadm', 'the free fiber is swapped');
|
||||
assert.deepEqual([L(a).sys, L(a).eqDown > ev('S.day')], ['lite', false], 'the wave\'s fiber stays lit');
|
||||
ev('compute()');
|
||||
assert.equal(ev("fiberOk(S.biz.find(b=>b.id==='mw'))"), true, 'and the customer is served');
|
||||
// The intern waits on it too: no swap, however quiet.
|
||||
hire(ev, 'annie');
|
||||
ev(`S.day+=2;${quiet}opsDay(S.day)`);
|
||||
assert.equal(L(a).sys, 'lite');
|
||||
// Glass only (an IRU, or a hyperscaler's pairs on your own build) never notices a line-system swap: the intern goes ahead.
|
||||
for (const type of ['dfpair', 'pairs']) {
|
||||
ev(`S.links.find(l=>l.id===${lit(a)}).sys='lite';S.links.find(l=>l.id===${lit(a)}).own=true;S.biz=S.biz.filter(b=>b.id!=='mw'&&b.id!=='g');S.biz.push({id:'g',name:'Strand Theft Auto',city:'fra',city2:'ams',link:${lit(a)},type:'${type}',bw:1,rate:1000,reqs:[],mood:100,since:S.day})`);
|
||||
ev(`S.day+=2;${quiet}`);
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(bstdQuote(true).held)')), [], type + ': nothing waits');
|
||||
ev(`${quiet}opsDay(S.day)`);
|
||||
assert.deepEqual([L(a).sys, L(a).eqDown > ev('S.day')], ['roadm', true], type + ': the intern swapped it');
|
||||
assert.equal(ev("fiberOk(S.biz.find(b=>b.id==='g'))"), true, type + ': and the pair stays up');
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('optics a new router model takes are on the bill with it, and wait for its swap', t => {
|
||||
const { ev, errors } = game(t);
|
||||
// Edge Lords take no zr8: the Absolute Unit does.
|
||||
|
|
@ -304,7 +349,7 @@ test('optics a new router model takes are on the bill with it, and wait for its
|
|||
ev('ACT.bstdApply()');
|
||||
assert.equal(c0 - ev('S.cash'), q.cost);
|
||||
assert.deepEqual(JSON.parse(ev(`JSON.stringify(S.links.find(l=>l.id===${lit(a)}).ch)`)), ['zr8', 'zr8']);
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(bstdQuote(false))')), { cost: 0, mo: 0, pops: 0, ports: 0, links: 0, n: 0, held: [] }, 'one tap brought everything up');
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(bstdQuote(false))')), { cost: 0, mo: 0, pops: 0, ports: 0, links: 0, n: 0, held: [], wait: [], wv: [] }, 'one tap brought everything up');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
|
|
@ -377,7 +422,7 @@ test('"Bring everything up now" spends what the quote said and does what it list
|
|||
const c0 = ev('S.cash');
|
||||
ev("document.querySelector('#modalCard [data-act=\"bstdApply\"]').click()");
|
||||
assert.equal(c0 - ev('S.cash'), q.cost, 'it cost exactly the quote');
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(bstdQuote(false))')), { cost: 0, mo: 0, pops: 0, ports: 0, links: 0, n: 0, held: [] }, 'and everything is up to the standard');
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(bstdQuote(false))')), { cost: 0, mo: 0, pops: 0, ports: 0, links: 0, n: 0, held: [], wait: [], wv: [] }, 'and everything is up to the standard');
|
||||
assert.match(ev("document.getElementById('toasts').textContent"), /jobs done for the build standard/);
|
||||
assert.match(ev("document.getElementById('modalCard').textContent"), /Everything meets the standard/);
|
||||
assert.equal(ev('S.ixSite.ams'), 'ab');
|
||||
|
|
|
|||
|
|
@ -69,6 +69,15 @@ test('no way around, or a customer on the fiber: no swap; bigger optics instead,
|
|||
heat(ev2);
|
||||
ev2('opsDay(S.day)');
|
||||
assert.equal(fiber(ev2).sys, 'lite');
|
||||
// A managed wave too. Leased pairs and IRUs are glass: the swap never touches them, so it goes ahead.
|
||||
for (const [type, sys] of [['mwave', 'lite'], ['dfpair', 'roadm'], ['pairs', 'roadm']]) {
|
||||
const { ev: ev3, errors: e3 } = game(t, `S.biz.push({id:'cx',name:'Customer',city:'fra',city2:'ams',type:'${type}',link:'f',slots:1,g:100,bw:1,rate:1})`);
|
||||
order(ev3, { at: 80, swap: false });
|
||||
heat(ev3);
|
||||
ev3('opsDay(S.day)');
|
||||
assert.equal(fiber(ev3).sys, sys, type);
|
||||
assert.deepEqual(e3, []);
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue