public void TestMedium() { var f = Files.pf_large3; var l = new LargeFileGenerator(1_000, 1986); l.Generate(); l.Store(f); var stopwatch = new Stopwatch(); stopwatch.Start(); Client.TextDocument.DidOpen(f, "dfy"); CompilerParams p = new CompilerParams { CompilationArguments = new string[] { }, FileToCompile = f }; CancellationSource.CancelAfter(TimeSpan.FromMinutes(1)); Client.SendRequest <CompilerResults>("compile", p, CancellationSource.Token).Wait(); stopwatch.Stop(); var elapsed_time = stopwatch.ElapsedMilliseconds; Console.WriteLine($"Performancetest 2 with 1'000 LOC took {elapsed_time}ms"); Assert.Less(elapsed_time, 60e3, "Runtime takes too long! Was: " + elapsed_time); }
public async Task ExecDefaultContainerStdOut() { if (!Debugger.IsAttached) { CancellationSource.CancelAfter( TimeSpan.FromSeconds(5)); } await Host.StartAsync(TestCancellation).ConfigureAwait(false); using (Kubernetes client = CreateTestClient()) { testOutput.WriteLine("Invoking exec operation..."); WebSocket clientSocket = await client.WebSocketNamespacedPodExecAsync( "mypod", "mynamespace", new string[] { "/bin/bash" }, "mycontainer", false, false, true, webSocketSubProtol : WebSocketProtocol.ChannelWebSocketProtocol, cancellationToken : TestCancellation).ConfigureAwait(false); Assert.Equal( WebSocketProtocol.ChannelWebSocketProtocol, clientSocket.SubProtocol); // For WebSockets, the Kubernetes API defaults to the binary channel (v1) protocol. testOutput.WriteLine( $"Client socket connected (socket state is {clientSocket.State}). Waiting for server-side socket to become available..."); WebSocket serverSocket = await WebSocketTestAdapter.AcceptedPodExecV1Connection; testOutput.WriteLine( $"Server-side socket is now available (socket state is {serverSocket.State}). Sending data to server socket..."); const int STDOUT = 1; const string expectedOutput = "This is text send to STDOUT."; int bytesSent = await SendMultiplexed(serverSocket, STDOUT, expectedOutput).ConfigureAwait(false); testOutput.WriteLine($"Sent {bytesSent} bytes to server socket; receiving from client socket..."); (string receivedText, byte streamIndex, int bytesReceived) = await ReceiveTextMultiplexed(clientSocket).ConfigureAwait(false); testOutput.WriteLine( $"Received {bytesReceived} bytes from client socket ('{receivedText}', stream {streamIndex})."); Assert.Equal(STDOUT, streamIndex); Assert.Equal(expectedOutput, receivedText); await Disconnect(clientSocket, serverSocket, WebSocketCloseStatus.NormalClosure, "Normal Closure").ConfigureAwait(false); WebSocketTestAdapter.CompleteTest(); } }