meta.test.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { parseSchemaRetentions } from './meta';
  2. describe('metadata parsing', () => {
  3. it('should parse schema retentions', () => {
  4. const retentions = '1s:35d:20min:5:1542274085,1min:38d:2h:1:true,10min:120d:6h:1:true,2h:2y:6h:2';
  5. const info = parseSchemaRetentions(retentions);
  6. expect(info).toMatchInlineSnapshot(`
  7. Array [
  8. Object {
  9. "chunkspan": "20min",
  10. "interval": "1s",
  11. "numchunks": 5,
  12. "ready": 1542274085,
  13. "retention": "35d",
  14. },
  15. Object {
  16. "chunkspan": "2h",
  17. "interval": "1min",
  18. "numchunks": 1,
  19. "ready": true,
  20. "retention": "38d",
  21. },
  22. Object {
  23. "chunkspan": "6h",
  24. "interval": "10min",
  25. "numchunks": 1,
  26. "ready": true,
  27. "retention": "120d",
  28. },
  29. Object {
  30. "chunkspan": "6h",
  31. "interval": "2h",
  32. "numchunks": 2,
  33. "ready": undefined,
  34. "retention": "2y",
  35. },
  36. ]
  37. `);
  38. });
  39. });