Azure / Azure/azure-powershell

[Peering] Random IP address generation code snippet has chance to fail

Open
#14,079 0 comments 0 reactions 0 assignees View on GitHub
Peering Service Attention Test Debt
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

## Description

In Peering.Test, the random ip generation code snippet may fail for some cases

```
2021-02-01T09:47:04.0934511Z [xUnit.net 00:00:10.67] Microsoft.Azure.Commands.Peering.Test.ScenarioTests.RegisteredPrefix.TestCreateRegisteredPrefix [FAIL]
2021-02-01T09:47:04.1623367Z Run as administrator
2021-02-01T09:47:04.1626340Z Run as administrator
2021-02-01T09:47:04.1627045Z Run as administrator
2021-02-01T09:47:04.1627633Z Run as administrator
2021-02-01T09:47:04.1628177Z Run as administrator
2021-02-01T09:47:04.1631841Z Run as administrator
2021-02-01T09:47:04.1632586Z Run as administrator
2021-02-01T09:47:04.1633340Z Run as administrator
2021-02-01T09:47:04.2301083Z X Microsoft.Azure.Commands.Peering.Test.ScenarioTests.RegisteredPrefix.TestCreateRegisteredPrefix [454ms]
2021-02-01T09:47:04.2303454Z EXEC : error Message: [D:\a\1\s\build.proj]
2021-02-01T09:47:04.2304505Z System.Management.Automation.MethodInvocationException : Exception calling "OffSet" with "4" argument(s): "An invalid IP address was specified.
2021-02-01T09:47:04.2305323Z Parameter name: address"
2021-02-01T09:47:04.2306004Z ---- System.ArgumentException : An invalid IP address was specified.
2021-02-01T09:47:04.2306651Z Parameter name: address
2021-02-01T09:47:04.2307161Z Stack Trace:
2021-02-01T09:47:04.2307810Z at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2021-02-01T09:47:04.2308608Z at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2021-02-01T09:47:04.2309421Z at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2021-02-01T09:47:04.2310349Z at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2021-02-01T09:47:04.2311546Z at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2021-02-01T09:47:04.2312456Z at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)
2021-02-01T09:47:04.2313405Z at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
2021-02-01T09:47:04.2314327Z at System.Management.Automation.PowerShell.Invoke()
2021-02-01T09:47:04.2315329Z at Microsoft.WindowsAzure.Commands.ScenarioTest.EnvironmentSetupHelper.RunPowerShellTest(String[] scripts) in D:\a\1\s\tools\ScenarioTest.ResourceManager\EnvironmentSetupHelper.cs:line 573
2021-02-01T09:47:04.2316699Z at Microsoft.Azure.Commands.Peering.Test.ScenarioTests.TestController.RunPsTestWorkflow(Func`1 scriptBuilder, Action cleanup, String callingClassType, String mockName) in D:\a\1\s\src\Peering\Peering.Test\ScenarioTests\TestController.cs:line 120
2021-02-01T09:47:04.2318175Z at Microsoft.Azure.Commands.Peering.Test.ScenarioTests.TestController.RunPowerShellTest(XunitTracingInterceptor logger, String[] scripts) in D:\a\1\s\src\Peering\Peering.Test\ScenarioTests\TestController.cs:line 70
2021-02-01T09:47:04.2319457Z at Microsoft.Azure.Commands.Peering.Test.ScenarioTests.RegisteredPrefix.TestCreateRegisteredPrefix() in D:\a\1\s\src\Peering\Peering.Test\ScenarioTests\RegisteredPrefix.cs:line 54
2021-02-01T09:47:04.2320341Z ----- Inner Stack Trace -----
2021-02-01T09:47:04.2321106Z at System.Net.IPAddress..ctor(ReadOnlySpan`1 address)
2021-02-01T09:47:04.2321710Z at System.Net.IPAddress..ctor(Byte[] address)
2021-02-01T09:47:04.2322733Z at Microsoft.Azure.PowerShell.Cmdlets.Peering.Common.HelperExtensionMethods.ToIpAddress(BigInteger self, AddressFamily addressFamily) in D:\a\1\s\src\Peering\Peering\Common\HelperExtensionMethods.cs:line 91
2021-02-01T09:47:04.2324952Z at Microsoft.Azure.Commands.Peering.Test.ScenarioTests.IPGenerator.OffSet(String ipAddress, Boolean v6, Int32 offset, Boolean hasPrefix) in D:\a\1\s\src\Peering\Peering.Test\ScenarioTests\IPGenerator.cs:line 65
2021-02-01T09:47:04.2325920Z at CallSite.Target(Closure , CallSite , Object , Object , Boolean , Object , Object )
```

## Cost

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.