Minor cleanup

This commit is contained in:
Eric Fontana
2015-04-11 06:35:09 -04:00
parent 349b0bf031
commit 9d08fc2b28
7 changed files with 109 additions and 11 deletions

View File

@@ -199,11 +199,18 @@ namespace TimberWinR.TestGenerator
switch (inputProp.Name)
{
case "udp":
return VerifyConditions(json, new string[] { "udp" }, inputProp, jresult);
if (VerifyConditions(json, new string[] {"udp"}, inputProp, jresult) != 0)
return 1;
break;
case "tcp":
if (VerifyConditions(json, new string[] {"tcp"}, inputProp, jresult) != 0)
return 1;
break;
case "log":
case "taillog":
return VerifyConditions(json, new string[] { "log", "taillog" }, inputProp, jresult);
if (VerifyConditions(json, new string[] {"log", "taillog"}, inputProp, jresult) != 0)
return 1;
break;
}
}
@@ -356,9 +363,7 @@ namespace TimberWinR.TestGenerator
}
private static void TimberWinROnOnConfigurationProcessed(Configuration configuration)
{
Console.WriteLine("Processed Config: {0}", configuration.GetHashCode());
{
if (!string.IsNullOrEmpty(Options.RedisHost) && configuration.RedisOutputs != null && configuration.RedisOutputs.Count() > 0)
{
foreach (var ro in configuration.RedisOutputs)

View File

@@ -99,6 +99,15 @@
<Content Include="results2.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="test3.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="test3-tw.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="results3.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TimberWinR\TimberWinR.csproj">

View File

@@ -0,0 +1,20 @@
{
"Results": {
"Inputs": [
{
"taillog": {
"test1: message sent count": "[messages] == 7404",
"test2: average cpu": "[avgCpuUsage] <= 30",
"test3: maximum memory": "[maxMemUsage] <= 15"
}
},
{
"tcp": {
"test4: message sent count": "[messages] == 1234",
"test5: average cpu": "[avgCpuUsage] <= 30",
"test6: maximum memory": "[maxMemUsage] <= 15"
}
}
]
}
}

View File

@@ -0,0 +1,45 @@
{
"TimberWinR": {
"Inputs": {
"Tcp": [
{
"_comment": "Output from NLog",
"port": 5140
}
],
"Logs": [
{
"interval": 5,
"logSource": "log files",
"location": "*.jlog",
"recurse": -1
}
]
},
"Filters": [
{
"grok": {
"condition": "\"[EventTypeName]\" == \"Information Event\"",
"match": [
"Text",
""
],
"drop": "true"
}
}
],
"Outputs": {
"Redis": [
{
"_comment": "Change the host to your Redis instance",
"port": 6379,
"batch_count": 500,
"threads": 2,
"host": [
"tstlexiceapp006.vistaprint.svc"
]
}
]
}
}
}

View File

@@ -0,0 +1,14 @@
{
"test": "Test 3",
"arguments": {
"--testFile": "test3.json",
"--testDir": "test3",
"--timberWinRConfig": "test3-tw.json",
"--numMessages": 1234,
"--logLevel": "debug",
"--tcp": "5140",
"--jroll": ["r1.jlog", "r2.jlog"],
"--json": ["1.jlog", "2.jlog", "3.jlog", "4.jlog"],
"--resultsFile": "results3.json"
}
}

View File

@@ -16,7 +16,9 @@ namespace TimberWinR.Inputs
private Thread _listenThreadV4;
private Thread _listenThreadV6;
private readonly int _port;
private long _receivedMessages;
private long _errorCount;
public override JObject ToJson()
{
@@ -24,9 +26,9 @@ namespace TimberWinR.Inputs
new JProperty("tcp",
new JObject(
new JProperty("port", _port),
new JProperty("errors", _errorCount),
new JProperty("messages", _receivedMessages)
)));
return json;
}
@@ -68,7 +70,6 @@ namespace TimberWinR.Inputs
listener.Start();
while (!CancelToken.IsCancellationRequested)
{
try
@@ -79,7 +80,7 @@ namespace TimberWinR.Inputs
// Wait for a client, spin up a thread.
var clientThread = new Thread(new ParameterizedThreadStart(HandleNewClient));
clientThread.Start(client);
}
}
catch (SocketException ex)
{
if (ex.SocketErrorCode == SocketError.Interrupted)
@@ -109,7 +110,7 @@ namespace TimberWinR.Inputs
{
JObject json = JObject.Load(reader);
ProcessJson(json);
_receivedMessages++;
Interlocked.Increment(ref _receivedMessages);
}
catch (Exception ex)
{
@@ -118,12 +119,16 @@ namespace TimberWinR.Inputs
ProcessJson(jex1);
LogManager.GetCurrentClassLogger().Warn(ex);
Interlocked.Increment(ref _errorCount);
}
}
}
}
}
catch(OperationCanceledException)
{
}
catch (Exception ex)
{
LogManager.GetCurrentClassLogger().Error(ex);

View File

@@ -1,7 +1,7 @@
$packageName = 'TimberWinR-${version}' # arbitrary name for the package, used in messages
$installerType = 'msi' #only one of these: exe, msi, msu
$url = 'http://www.ericfontana.com/TimberWinR/TimberWinR-${version}.0.msi' # download url
$silentArgs = '{D066A694-B9F7-4B35-BB7D-D34CB88CA89F} /quiet'
$silentArgs = '{D248DF6E-0109-4A9C-BEC1-A5AEDA8D167A} /quiet'
$validExitCodes = @(0) #please insert other valid exit codes here, exit codes for ms http://msdn.microsoft.com/en-us/library/aa368542(VS.85).aspx
UnInstall-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" -validExitCodes $validExitCodes