Skip to content

goshlanguage/cerulean

Repository files navigation

Cerulean

WIP Go Report Card Man Hours

Cerulean is a mock Azure API, designed for writing infrastructure tests so you can run tests without spending that dosh. This is great for folks who are using the azure-sdk-for-go especially. Here's a nifty example:

package test

import (
    "fmt"
    "testing"

    "github.com/azure/azure-sdk-for-go/services/resources/mgmt/2019-11-01/subscriptions"
    "github.com/goshlanguage/cerulean"
)

func TestSubscription(t *testing.T) {
    server := cerulean.New("c27e7a81-b684-4fce-91d8-fed9e9bb534a")
    client := subscriptions.NewClientWithBaseURI(server.GetBaseClientURI())
    client.Authorizer = autorest.NullAuthorizer{}

    resultPage, err := client.List(context.TODO())
    if err != nil {
	    panic(err)
    }
    // do stuff with your mocked client
}

This project is artisanally crafted, laptop to market software. Please open an issue if you find a bug or have a request. PRs are welcome.

Design

Cerulean works by creating an http server that mimics the Azure API rest endpoints and responses. You can then redirect your Azure SDK clients to use the address of this mock server, and your client will then talk to this mock. This project is inspired by moto.

Cerulean emulates the Azure API. There are two good references for the API to use in development:

  1. azure-rest-api-specs
  2. azure rest api docs

If you decide to explore the API via curl or postman with the docs above, this article may be helpful to you: https://medium.com/@mauridb/calling-azure-rest-api-via-curl-eb10a06127

If you prefer swagger, then you can load in the specs you want to reference by passing it's URL, such as:

About

Cerulean is a golang library for mocking Azure

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages