Prepare verified laboratory 6 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:32:06 +03:00
parent 470d9d6f1e
commit 7d56e52fd0
335 changed files with 31206 additions and 72 deletions
@@ -0,0 +1,5 @@
import{test,expect}from'bun:test';import{dashboardMatches,rulesMatch}from'../scripts/lib/grafana-provisioning';
const expected={uid:'messenger',panels:[{id:1,title:'RPS'},{id:2,title:'API p95'}]};
test('accepts the actual configured dashboard and exact rule UID set',()=>{expect(dashboardMatches({dashboard:expected},expected)).toBe(true);expect(rulesMatch([{uid:'b'},{uid:'a'}],['a','b'])).toBe(true)});
test('rejects empty or mismatched dashboard payload despite successful HTTP status',()=>{expect(dashboardMatches({},expected)).toBe(false);expect(dashboardMatches({dashboard:{uid:'other',panels:expected.panels}},expected)).toBe(false);expect(dashboardMatches({dashboard:{...expected,panels:[]}},expected)).toBe(false);expect(dashboardMatches({dashboard:{...expected,panels:[expected.panels[0],expected.panels[0]]}},expected)).toBe(false);expect(dashboardMatches({dashboard:{...expected,panels:[expected.panels[0],{id:2,title:'Wrong signal'}]}},expected)).toBe(false)});
test('rejects absent, duplicated or wrong rule UIDs even when counts match',()=>{expect(rulesMatch([],['a','b'])).toBe(false);expect(rulesMatch([{uid:'a'},{uid:'a'}],['a','b'])).toBe(false);expect(rulesMatch([{uid:'a'},{uid:'c'}],['a','b'])).toBe(false);expect(rulesMatch([],[])).toBe(false)});