Error executing tests that use the azure storage emulator

James Skimming's Avatar

James Skimming

19 Jun, 2014 03:34 PM

I have xUnit tests that run components using Azure Storage.

I am starting the azure emulator using the IUseFixture feature of xUnit, specifically this implementation:

public void SetFixture(Process process)
{
    if (process == null)
        throw new ArgumentNullException("process");

    process.StartInfo.UseShellExecute = false;
    process.StartInfo.FileName =
        @"C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Storage Emulator\WAStorageEmulator.exe";
    process.StartInfo.Arguments = "start";
    process.Start();
    process.WaitForExit(10000);
}

Locally the tests run fine (I use both ReSharper and NCrunch), but when executed on AppVeror the emulator starts (with an error):

............Windows Azure Storage Emulator 3.0.0.0 command line tool
.Windows Azure Storage Emulator 3.0.0.0 command line tool
Error: Port conflict with existing application.
The storage emulator was successfully started.

But the tests fail with the following exception:

Microsoft.WindowsAzure.Storage.StorageException : The remote server returned an error: (400) Bad Request.
---- System.Net.WebException : The remote server returned an error: (400) Bad Request.
Stack Trace:
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.CloudTable.Exists(Boolean primaryOnly, TableRequestOptions requestOptions, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext)

I'm not sure if the Error: Port conflict with existing application. error is a cause/symptom/unrelated but I believe I need to use the latest 2.3 SDK.

I've tried manually installing the latest SDK using WebPICMD.exe but I can't work out the correct ID to use, and the install message is a less than helpful:

C:\Windows\system32>WebPICMD /Install /Products:VWDOrVs2013AzurePack.2E2.2E2.appids

The software that you obtain using the Web Platform Installer Command Line Tool is licensed to you by its owner.  Microsoft grants you no rights for third party software.
Successfully loaded primary feed: https://go.microsoft.com/?linkid=9842185
The following products are not available on this machine or already installed: VWDOrVs2013AzurePack.2E2.2E2.appids
No products to be installed (either not available or already installed)

What can i do to install the correct emulator and get it running?

  1. Support Staff 1 Posted by Feodor Fitsner on 19 Jun, 2014 03:40 PM

    Feodor Fitsner's Avatar

    Hi James,

    SDK 2.3 is already installed on build worker.

    - Feodor

  2. 2 Posted by James Skimming on 19 Jun, 2014 03:45 PM

    James Skimming's Avatar

    Is it here C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Storage Emulator\WAStorageEmulator.exe

    The logs indicate it is the 3.0.0.0 version.

    If it's install elsewhere that could be the cause of the Error: Port conflict with existing application.

    I'l commit a change that doesn't try to start the emulator and see how it goes.

  3. 3 Posted by James Skimming on 19 Jun, 2014 04:29 PM

    James Skimming's Avatar

    I tried not starting the emulator, but the tests failed because the emulator was not started.

    I've just tried a custom install script "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Storage Emulator\WAStorageEmulator.exe" start but it still started the 3.0.0.0 version not the 3.2.

    If SDK 2.3 is installed where is it?

    Ultimately adding the azure emulator as a service to starr like SQLExpress and IIS would be useful.

  4. Support Staff 4 Posted by Feodor Fitsner on 19 Jun, 2014 04:31 PM

    Feodor Fitsner's Avatar

    Let me take a look.

  5. Support Staff 5 Posted by Feodor Fitsner on 19 Jun, 2014 05:39 PM

    Feodor Fitsner's Avatar

    You were right, it's 3.0 emulator is currently installed. Most probably only build tools 2.3 were installed. We will install 2.3 emulator - I'll let you know when it's available.

    I was able to start 3.0 though from "before build" script: https://ci.appveyor.com/project/appvyr/appveyor-bot-test/build/1.0....

    I think the reason you see "port conflict" might be racing condition where emulator is not released after previous fixture.

  6. 6 Posted by James Skimming on 19 Jun, 2014 05:45 PM

    James Skimming's Avatar

    I think the port conflict was a false negative, I need the 2.3 emulator as I'm using the latest Storage NuGet package which doesn't work with older emulators.

  7. Support Staff 7 Posted by Feodor Fitsner on 19 Jun, 2014 06:47 PM

    Feodor Fitsner's Avatar

    OK, I see.

    - Feodor

  8. 8 Posted by James Skimming on 20 Jun, 2014 01:42 PM

    James Skimming's Avatar

    I've managed to work out the correct product ID to use WebPICMD:

    WebPICMD /Install /Products:VWDOrVs2013AzurePack.2.3 /AcceptEula
    

    Unfortunately it fails to install with the following message:

    Install completed (Failure): 'Windows Azure Storage Emulator - 3.1'
    

    I also tried just installing the emulator directly (see below for why I installed 3.1 not 3.2)

    WebPICMD /Install /Products:WindowsAzureStorageEmulator.3.1 /AcceptEula
    

    It also fails but I do get told there's a log file Log Location: %temp%\WindowsAzureStorageEmulator.txt unfortunately I can't access that log, I tried adding it as an artefact, but because the build fails no artefacts are collected.

    Why I installed 3.1 not 3.2

    For some reason WebPICMD is installing the 3.1 emulator not 3.2 (I tried WebPICMD /Install /Products:WindowsAzureStorageEmulator.3.2 /AcceptEula but it says it doesn't exit).

    I wonder (granted this is speculation), is it refusing to install the 3.2 Emulator because VS2013 Update 2 is not installed? What version of VS2013 is installed?

  9. Support Staff 9 Posted by Feodor Fitsner on 23 Jun, 2014 03:37 AM

    Feodor Fitsner's Avatar

    James,

    We've deployed the latest Azure storage emulator. It shows 3.2 now. Please give it another try and let me know how it goes.

  10. 10 Posted by James Skimming on 23 Jun, 2014 07:53 AM

    James Skimming's Avatar

    Feodor

    It works great thank you, my tests are now passing, the before build command has the following output:

    "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Storage Emulator\WAStorageEmulator.exe" start
    Windows Azure Storage Emulator 3.2.0.0 command line tool
    The storage emulator was successfully started.
    

    Thanks again.

  11. James Skimming closed this discussion on 28 Jul, 2014 04:58 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac