TestData.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. namespace Tests.Mcp;
  2. internal static class TestData {
  3. /// <summary>
  4. /// A small, fully-understood inventory: two pieces of connected hardware, a
  5. /// system on the server, two services on the system, one cabled connection.
  6. /// Small enough that every test can state its expectations exactly.
  7. /// </summary>
  8. public const string Seed =
  9. """
  10. version: 4
  11. resources:
  12. - kind: Server
  13. name: rack-server
  14. discoveryId: rpk1:sys:aaaaaaaaaaaaaaaa
  15. tags:
  16. - prod
  17. labels:
  18. ansible_host: 10.0.0.2
  19. ports:
  20. - type: rj45
  21. speed: 1
  22. count: 4
  23. - kind: Switch
  24. name: rack-switch
  25. ports:
  26. - type: rj45
  27. speed: 1
  28. count: 8
  29. - kind: System
  30. name: host-os
  31. type: baremetal
  32. os: debian
  33. cores: 8
  34. ram: 32
  35. ip: 10.0.0.5
  36. runsOn:
  37. - rack-server
  38. labels:
  39. env: prod
  40. - kind: Service
  41. name: grafana
  42. runsOn:
  43. - host-os
  44. network:
  45. ip: 10.0.0.5
  46. port: 3000
  47. protocol: TCP
  48. - kind: Service
  49. name: prometheus
  50. runsOn:
  51. - host-os
  52. network:
  53. ip: 10.0.1.9
  54. port: 9090
  55. protocol: TCP
  56. connections:
  57. - a:
  58. resource: rack-server
  59. portGroup: 0
  60. portIndex: 0
  61. b:
  62. resource: rack-switch
  63. portGroup: 0
  64. portIndex: 0
  65. label: uplink
  66. """;
  67. /// <summary>The 46-resource demo inventory shipped with the repo, for breadth tests.</summary>
  68. public static string DemoConfig() =>
  69. File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "TestConfigs", "demo-config.yaml"));
  70. /// <summary>Captured API output shared with Tests.Discovery, for the discovery tools.</summary>
  71. public static string Fixture(string name) =>
  72. File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "Fixtures", name));
  73. }