From 4feea90c3c8e81c9b52452a77bee14df762116d4 Mon Sep 17 00:00:00 2001 From: Jared Date: Sat, 30 Jul 2016 15:44:53 -0700 Subject: [PATCH] Added PowerShell stress test in Resources dir. --- EBS POC/EBS POC.csproj | 2 ++ EBS POC/Resources/EBS Stress Test.ps1 | 25 +++++++++++++++++++++++++ EBS POC/Resources/Test.data | 1 + 3 files changed, 28 insertions(+) create mode 100644 EBS POC/Resources/EBS Stress Test.ps1 create mode 100644 EBS POC/Resources/Test.data diff --git a/EBS POC/EBS POC.csproj b/EBS POC/EBS POC.csproj index f23ef99..b9ef68d 100644 --- a/EBS POC/EBS POC.csproj +++ b/EBS POC/EBS POC.csproj @@ -134,6 +134,8 @@ Settings.Designer.cs + + diff --git a/EBS POC/Resources/EBS Stress Test.ps1 b/EBS POC/Resources/EBS Stress Test.ps1 new file mode 100644 index 0000000..6ae855b --- /dev/null +++ b/EBS POC/Resources/EBS Stress Test.ps1 @@ -0,0 +1,25 @@ +Clear-Host + +$ClientList = [System.Collections.ArrayList]::new(); + +for ($i = 0; $i -lt 500; $i++) +{ + $newClient = [System.Net.Sockets.TcpClient]::new(); + $newClient.Connect($env:COMPUTERNAME, 33885); + $newClient.Client.Send([System.Text.Encoding]::UTF8.GetBytes("Client$i")) | Out-Null; + $ClientList.Add($newClient) | Out-Null; +} + +$ObservedClient = $ClientList[[Math]::Round($ClientList.Count / 2, 0)]; + +while ($ObservedClient.Connected) +{ + while ($ObservedClient.Available -eq 0) + { + Write-Host "Waiting for data..."; + Start-Sleep -Milliseconds 500; + } + $buffer = New-Object Byte[] $ObservedClient.Available; + $ObservedClient.Client.Receive($buffer); + Write-Host ([System.Text.Encoding]::UTF8.GetString($buffer)); +} \ No newline at end of file diff --git a/EBS POC/Resources/Test.data b/EBS POC/Resources/Test.data new file mode 100644 index 0000000..170c076 --- /dev/null +++ b/EBS POC/Resources/Test.data @@ -0,0 +1 @@ +{"HostIP":"","HostName":"OPTIMUS","WorkerList":[{"Name":"Jared","Notes":" Doing some stuff. I'm typing some words."},{"Name":"Sean","Notes":"Typing notes. Wow. Instant messaging. INSTANT!"},{"Name":"Dane","Notes":""}]} \ No newline at end of file