Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local cloud stack for Azure similar to LocalStack for AWS?

Is there a mocking framework for Azure similar to LocalStack for AWS? Please understand that I am not looking for a SDK mock but a resource stack mock.

So much so, that I could replace the configurations of my local Azure stack with actual Azure resources in my project and the functionality would remain just the same. Quite like how it works with Localstack.

I have found Azure Cloud Fabric to come closest to this, but it is tightly coupled with Visual Studio IDE.

like image 928
Rajan Prasad Avatar asked Dec 21 '18 17:12

Rajan Prasad


People also ask

What is local stack in AWS?

LocalStack is a cloud application development tool that provides an easy-to-use test/mock system. It creates a testing environment on your local computer that emulates the AWS cloud environment in terms of functionality and APIs.

Is Azure cloud similar to AWS?

Is Azure the same as AWS? No, Azure is a cloud platform introduced by Microsoft in 2010, whereas AWS is another cloud platform introduced by Amazon in 2006. While both the platforms have similar use cases and are prevalent in the Big Data community, their parent companies are not the same.

What is Azure cloud Stack?

Azure Stack is a portfolio of products that extend Azure services and capabilities to your environment of choice—from the datacenter to edge locations and remote offices. Build and deploy hybrid and edge computing applications and run them consistently across location boundaries.

What is AWS equivalent of Azure policy?

Azure Functions is the primary equivalent of AWS Lambda in providing serverless, on-demand code.


2 Answers

Although there is not an equivalent of LocalStack for Azure, Microsoft publish three emulators you can run locally to help with integration testing:

  • Azure Functions Core Tools, a local version of the Azure Functions Runtime, allowing you to execute your Azure functions locally without deploying them.

  • Azure Storage Emulator, a local emulator of Azure storage.

  • Cosmos DB Emulator, a local emulator of CosmosDB.

The above three can get you a lot of integration test coverage, however since Azure Functions, AWS Lambda and most modern web stacks even non-serverless have moved to consuming services rather than just consuming software modules, the only way to have complete parity between integration test and production environments is to automate the creation and tear-down of real, paid for services.

A recipe for End to End/Integration testing on Azure:

  • Use Azure DevOps Piplines to automate the entire CI process
  • Add tasks to the pipeline for creating and tearing down (real) text fixture resources with persistent state (databases, file storage etc) using the Azure command line tools.
  • Provide the test application access to real, stateless services (such as Azure Cognitive Services etc.) as you would for production.
  • Use Azure Variable Groups to store names, connection strings etc. for the test fixture resources. You can store a different set for production in a different group, allowing easy switching between them in YAML for different stages. These variables can also be templated in their own YAML file.
  • Use the Azure Functions Core Tools emulator to host and run functions within the CI agent rather than deploying, with a unit test framework giving them requests. The functions will be using the non-emulated, services stood up as test fixtures.
  • Or create a deploy for test stage, publishing the API for real, then write API tests that make raw HTTP requests, or use this as a backend for Selenium web driver testing a UI/frontend.

The above approach relies on real services to provide testing rather than emulated ones, testing something that's pretty close to what you deploy in production. It will incur usage fees each time you run your tests. If this is a problem, use unit testing and emulator integration testing first in the pipeline and add a human check/different pipeline for this level of testing which you only perform before pushing to production.

Azure Slots may also be worth looking up.

like image 117
James Avatar answered Oct 13 '22 04:10

James


There is now https://github.com/azure/azurite providing also a docker https://hub.docker.com/_/microsoft-azure-storage-azurite

like image 20
raphaelauv Avatar answered Oct 13 '22 04:10

raphaelauv