Change Freeze stops de-peering at exchanges
Snubs (refused and torn-down sessions at exchanges) are part of the market rule now, so Change Freeze and puzzles have none; On-call is unchanged.
This commit is contained in:
parent
9b7b1c150c
commit
e17ddc247b
12 changed files with 34 additions and 15 deletions
|
|
@ -84,9 +84,7 @@ const EXCEPTIONS = {
|
|||
'spl:hba': 'Speedyloop reaches Hobart’s exchange over its own backhaul but sells no transit there',
|
||||
},
|
||||
// M3: subsystems that annoy the player but read no rule.
|
||||
M3: {
|
||||
snub: 'de-peering at exchanges happens in every mode (open question: should Change Freeze stop it?)',
|
||||
},
|
||||
M3: {},
|
||||
};
|
||||
|
||||
// The real names the puns are based on. No network, cable, exchange, data center, router or optic may be called one.
|
||||
|
|
@ -234,7 +232,7 @@ test('M3: every subsystem that can annoy the player reads a rule', () => {
|
|||
// [function, what it must read]
|
||||
const reads = [['dayTick', 'chaosMul()'], ['fireEvent', "rule('market')"], ['ddosTick', 'ddosOff()'], ['inboxDay', "rule('inbox')"],
|
||||
['soldOut', "rule('market')"], ['hwMul', "rule('market')"], ['leadDays', "rule('lead')"], ['pniLead', 'leadDays'],
|
||||
['dfBuildDays', 'leadDays'], ['dayTick', "rule('clock')"]];
|
||||
['dfBuildDays', 'leadDays'], ['dayTick', "rule('clock')"], ['snub', "rule('market')"]];
|
||||
fail('M3', reads.filter(([f, r]) => !ev(`typeof ${f}==='function'&&${f}.toString().includes(${JSON.stringify(r)})`)).map(([f, r]) => `${f}() does not read ${r}`), 'gate it on the ruleset (src/game/40-progress/30-rules.js)');
|
||||
// and in play: no chaos, no market, no inbox means a quiet year
|
||||
const g = load();
|
||||
|
|
|
|||
|
|
@ -99,6 +99,26 @@ test('a snubbing peer tears down an existing session and the Request button expl
|
|||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('Change Freeze never refuses or tears down a session at an exchange; On-call does', () => {
|
||||
const { ev, errors } = load();
|
||||
setup(ev);
|
||||
const k = ev(`(()=>{const ok=['fra','ams','lon','par','nyc','ash','sjc','sin','tok','hkg'];
|
||||
for(let d=0;d<600;d++)for(const n of NETS)for(const c of ok){if(!ixMembers(c).includes(n.id))continue;
|
||||
S.day=d;const a=snub(n.id,c);S.day=d+1;const b=snub(n.id,c);S.day=0;if(!a&&b)return n.id+'@'+c+'@'+d;}})()`);
|
||||
assert.ok(k, 'found a snub starting at an IX');
|
||||
const [id, c, d] = k.split('@');
|
||||
ev(`S.rules=makeRules('freeze');S.day=${d}`);
|
||||
ev(`ACT.buildPop({city:'${c}'});ACT.buyIx({city:'${c}',tier:1,signed:true});S.peers['${id}@${c}']=true;compute()`);
|
||||
ev('dayTick()');
|
||||
assert.equal(ev(`!!S.peers['${id}@${c}']`), true, 'the session survives the freeze');
|
||||
assert.equal(ev(`snub('${id}','${c}')`), null, 'and nobody refuses a new one');
|
||||
assert.equal(ev(`ixSessions('${c}').has('${id}')`), true);
|
||||
assert.equal(ev('S.stats.depeered||0'), 0);
|
||||
ev(`S.rules=makeRules('oncall');S.day=${+d + 1}`);
|
||||
assert.ok(ev(`!!snub('${id}','${c}')`), 'On-call still snubs the same pair');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('remote peering is offered but costs more, gives less and gets refused more', () => {
|
||||
const { ev, errors } = load();
|
||||
setup(ev);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue