MCPcopy Create free account
hub / github.com/avoidwork/tenso / testServerLifecycle

Function testServerLifecycle

benchmarks/memory.js:105–147  ·  view source on GitHub ↗

* Tests server creation and destruction memory usage

()

Source from the content-addressed store, hash-verified

103 * Tests server creation and destruction memory usage
104 */
105async function testServerLifecycle () {
106 console.log("🔥 Server Lifecycle Memory Test");
107 console.log("-".repeat(50));
108
109 const monitor = new MemoryMonitor();
110 monitor.snapshot("Initial state");
111
112 // Create multiple servers
113 const servers = [];
114 for (let i = 0; i < 10; i++) {
115 const server = tenso({
116 port: 0,
117 silent: true,
118 logging: { enabled: false },
119 auth: { protect: [] },
120 rate: { enabled: false },
121 security: { csrf: false }
122 });
123 servers.push(server);
124 }
125
126 monitor.snapshot("After creating 10 servers");
127
128 // Start servers
129 for (const server of servers) {
130 server.start();
131 }
132
133 monitor.snapshot("After starting servers");
134
135 // Stop and cleanup servers
136 for (const server of servers) {
137 server.stop();
138 }
139
140 monitor.snapshot("After stopping servers");
141
142 // Clear references
143 servers.length = 0;
144
145 monitor.snapshot("After clearing references");
146 monitor.report();
147}
148
149/**
150 * Tests request processing memory usage

Callers 1

mainFunction · 0.85

Calls 6

snapshotMethod · 0.95
reportMethod · 0.95
tensoFunction · 0.90
logMethod · 0.80
startMethod · 0.80
stopMethod · 0.80

Tested by

no test coverage detected