Skip to content

Commit 7cd8133

Browse files
committed
Update TestListAddressesByNetwork to support servers which are not connected to *all* networks
1 parent 75bb37c commit 7cd8133

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/testing/integration/Providers/Rackspace/UserServerTests.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Net;
88
using Microsoft.VisualStudio.TestTools.UnitTesting;
99
using net.openstack.Core.Domain;
10+
using net.openstack.Core.Exceptions.Response;
1011
using net.openstack.Core.Providers;
1112
using net.openstack.Providers.Rackspace;
1213
using Newtonsoft.Json;
@@ -277,11 +278,18 @@ public void TestListAddressesByNetwork()
277278
foreach (CloudNetwork network in networks)
278279
{
279280
Console.WriteLine("Network: {0}", network.Label);
280-
IEnumerable<IPAddress> addresses = provider.ListAddressesByNetwork(_server.Id, network.Label);
281-
foreach (IPAddress address in addresses)
281+
try
282282
{
283-
foundAddress = true;
284-
Console.WriteLine(" {0}", address);
283+
IEnumerable<IPAddress> addresses = provider.ListAddressesByNetwork(_server.Id, network.Label);
284+
foreach (IPAddress address in addresses)
285+
{
286+
foundAddress = true;
287+
Console.WriteLine(" {0}", address);
288+
}
289+
}
290+
catch (ItemNotFoundException)
291+
{
292+
Console.WriteLine(" Server is not attached to this network.");
285293
}
286294
}
287295

0 commit comments

Comments
 (0)