Git Product home page Git Product logo

servicebus-cloner's Introduction

Description

Clones a Azure Service Bus by creating a new one and cloning all queues, topics and subscriptions into it, when ready outputs the connectionstring. Because Azure doesn't have a emulator, use this for automation such as integration tests. When ready, run again with --delete to cleanup the temporary Azure resource(s).

Docker Hub

PR's and issues are welcome.

Requirements

  • Docker.
  • Azure service principal with Azure Service Bus Data Owner and Contributor on subscription level or replace Contributor with a custom one with resource group write/read/list (Microsoft.Resources/resourceGroups/write).

Example

  1. Create a clone.

    output_string=$(docker run --rm servicebus-cloner:latest \
        --tenant=a2c511af-be9b-4d4f-a265-d2a3fcf3dc98 \
        --subscription=89d5e09c-47ac-4008-8b09-3f6e67c682eb \
        --clientid=5bc23718-68c1-472c-9a82-6c73f48d049d \
        --clientsecret=MySuperSecret \
        --sbFrom=MyRealServiceBusName \
        --sbTo=MyTemporaryServiceBusForTesting)
  2. Run your tests

    dotnet test -e "ServiceBusConnectionString=$output_string"
  3. Clean up resources

    docker run --rm servicebus-cloner:latest \
        --tenant=a2c511af-be9b-4d4f-a265-d2a3fcf3dc98 \
        --subscription=89d5e09c-47ac-4008-8b09-3f6e67c682eb \
        --clientid=5bc23718-68c1-472c-9a82-6c73f48d049d \
        --clientsecret=MySuperSecret \
        --sbTo=MyTemporaryServiceBusNameForTesting \
        --action=delete

Ephemeral

For some use cases, like docker-compose,it can be benificial to use the ephemeral flag. The test service will exist while the container runs. It is deleted on container SIGTERM. Use a volume to fetch the created connectionstring from the container.

docker run -v "mypath:/app/out" 
    --rm servicebus-cloner:latest \
    --out=/app/out/connectionstring \
    --tenant=a2c511af-be9b-4d4f-a265-d2a3fcf3dc98 \
    --subscription=89d5e09c-47ac-4008-8b09-3f6e67c682eb \
    --clientid=5bc23718-68c1-472c-9a82-6c73f48d049d \
    --clientsecret=MySuperSecret \
    --sbFrom=MyRealServiceBusName \
    --sbTo=MyTemporaryServiceBusForTesting \
    --action=ephemeral

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.