Skip to content

Commit

Permalink
#23 Allow to write nested TeamCity Service Message inside WriteMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov authored and NikolayPianikov committed Sep 27, 2017
1 parent 80a8cc2 commit 914f87b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ protected override ITeamCityMessageWriter Create(IServiceMessageProcessor proc)
[Test]
public void TestErrorMessage()
{
DoTest(x => x.WriteError("Opps"), "##teamcity[message text='Opps' status='ERROR']");
DoTest(x => x.WriteError("Opps"), "##teamcity[message text='Opps' status='ERROR' tc:tags='tc:parseServiceMessagesInside']");
}

[Test]
public void TestErrorMessage2()
{
DoTest(x => x.WriteError("Opps", "Es gefaehlt mir gut"), "##teamcity[message text='Opps' status='ERROR' errorDetails='Es gefaehlt mir gut']");
DoTest(x => x.WriteError("Opps", "Es gefaehlt mir gut"), "##teamcity[message text='Opps' status='ERROR' tc:tags='tc:parseServiceMessagesInside' errorDetails='Es gefaehlt mir gut']");
}

[Test]
public void TestNormalMessage()
{
DoTest(x => x.WriteMessage("Hello TeamCity World"), "##teamcity[message text='Hello TeamCity World' status='NORMAL']");
DoTest(x => x.WriteMessage("Hello TeamCity World"), "##teamcity[message text='Hello TeamCity World' status='NORMAL' tc:tags='tc:parseServiceMessagesInside']");
}

[Test]
public void TestWarningMessage()
{
DoTest(x => x.WriteWarning("Opps"), "##teamcity[message text='Opps' status='WARNING']");
DoTest(x => x.WriteWarning("Opps"), "##teamcity[message text='Opps' status='WARNING' tc:tags='tc:parseServiceMessagesInside']");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ public void TestFlows_FromBlock()
},
"##teamcity[blockOpened name='xB' flowId='1']",
"##teamcity[flowStarted parent='1' flowId='2']",
"##teamcity[message text='flow' status='NORMAL' flowId='2']",
"##teamcity[message text='base' status='NORMAL' flowId='1']",
"##teamcity[message text='flow' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='2']",
"##teamcity[message text='base' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='1']",
"##teamcity[flowFinished flowId='2']",
"##teamcity[blockClosed name='xB' flowId='1']"
);
Expand All @@ -194,9 +194,9 @@ public void TestFlows_OneFlow()
}
},
"##teamcity[flowStarted parent='1' flowId='2']",
"##teamcity[message text='flow1 message' status='NORMAL' flowId='2']",
"##teamcity[message text='flowB message' status='NORMAL' flowId='1']",
"##teamcity[message text='flow1 message' status='NORMAL' flowId='2']",
"##teamcity[message text='flow1 message' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='2']",
"##teamcity[message text='flowB message' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='1']",
"##teamcity[message text='flow1 message' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='2']",
"##teamcity[flowFinished flowId='2']"
);
}
Expand Down Expand Up @@ -307,9 +307,9 @@ public void TestFlows_TwoBlocks()
"##teamcity[blockOpened name='b1' flowId='2']",
"##teamcity[blockOpened name='b2' flowId='3']",
"##teamcity[blockOpened name='root' flowId='1']",
"##teamcity[message text='root' status='NORMAL' flowId='1']",
"##teamcity[message text='flow1 message' status='NORMAL' flowId='2']",
"##teamcity[message text='flow2 message' status='NORMAL' flowId='3']",
"##teamcity[message text='root' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='1']",
"##teamcity[message text='flow1 message' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='2']",
"##teamcity[message text='flow2 message' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='3']",
"##teamcity[blockClosed name='b1' flowId='2']",
"##teamcity[blockClosed name='root' flowId='1']",
"##teamcity[blockClosed name='b2' flowId='3']",
Expand Down Expand Up @@ -338,9 +338,9 @@ public void TestFlows_TwoFlow()
},
"##teamcity[flowStarted parent='1' flowId='2']",
"##teamcity[flowStarted parent='1' flowId='3']",
"##teamcity[message text='flow1 message' status='NORMAL' flowId='2']",
"##teamcity[message text='flowB message' status='NORMAL' flowId='1']",
"##teamcity[message text='flow2 message' status='NORMAL' flowId='3']",
"##teamcity[message text='flow1 message' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='2']",
"##teamcity[message text='flowB message' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='1']",
"##teamcity[message text='flow2 message' status='NORMAL' tc:tags='tc:parseServiceMessagesInside' flowId='3']",
"##teamcity[flowFinished flowId='3']",
"##teamcity[flowFinished flowId='2']"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void Write([NotNull] string text, string details, [NotNull] string statu
{
if (text == null) throw new ArgumentNullException(nameof(text));
if (status == null) throw new ArgumentNullException(nameof(status));
var msg = new ServiceMessage("message") {{"text", text}, {"status", status}};
var msg = new ServiceMessage("message") {{"text", text}, {"status", status}, {"tc:tags", "tc:parseServiceMessagesInside"}};
if (!string.IsNullOrEmpty(details))
{
msg.Add("errorDetails", details);
Expand Down

0 comments on commit 914f87b

Please sign in to comment.