Introducing a new way to review your PRs.

Read the announcement

floci-io / floci-az

Light, fluffy, and always free - Local Azure Emulator

View on GitHub

27 documents · Updated Nov 23, 2026

docs / compatibility-tests

Compatibility test suite

The compatibility test suite checks that floci-az presents the Azure behavior expected by common client tools. It runs language SDKs, Azure CLI, Azure Developer CLI (azd), Terraform, and OpenTofu against a live emulator so that gaps in protocol, resource state, identity, and data flow appear before release. Use the build and configuration guide for execution setup.

Test suite model

The suite treats each client as a separate view of one emulator contract. Each CI entry uses its own test image and emulator instance, so one client cannot hide a failure in another client.

The language suites use real Azure SDKs. The infrastructure suites use the Azure Resource Manager provider through Terraform or OpenTofu. The CLI suites use normal Azure commands and the real Azure Developer CLI. All groups test the client-facing contract rather than only direct HTTP responses.

This diagram shows the shared emulator image and the independent client paths.

flowchart LR
    A[Build native emulator image] --> B[Compatibility matrix]
    B --> S[Language SDK suites]
    B --> C[Azure CLI suite]
    B --> D[Azure Developer CLI suite]
    B --> T[Terraform suite]
    B --> O[OpenTofu suite]
    S & C & D & T & O --> E[Isolated emulator instances]
    E --> R[JUnit XML and CI summary]

Emulator contract gates

The compatibility suites depend on local emulator tests that protect the same broad contracts. ARM management requests pass through one ordered gate while data-plane routes stay outside it. Identity checks cover token audience and tenant ownership. Service Bus startup checks cover broker and TLS readiness before an SDK connects. Event Grid, Key Vault, Monitor, and storage tests protect the resource and data shapes that client suites read back.

References: src/…/ArmRequestGateCoverageTest.java• L32-40 src/…/ArmRequestGateProductionTest.java• L18-39 src/…/StrictTokensTest.java• L18-21 src/…/EventGridHandlerTest.java• L29-39 src/…/KeyVaultVaultPropertiesTest.java• L11-18 src/…/ArtemisReadinessProbeTest.java• L41-61

CI orchestration

Infrastructure provider parity

The iac-drift-check job compares the top-level resource addresses in the Terraform and OpenTofu configurations. It prevents accidental drift in the shared infrastructure model before either provider runs against the emulator. Intentional one-sided resources must be recorded in a directional allowlist; the current OpenTofu-only PostgreSQL resources are such a gap.

References: .github/…/compatibility.yml• L32-55 .github/…/compat-iac-drift-check.py• L6-17 .github/…/compat-iac-allowlist-opentofu-only.txt• L5-10

Native image build

The build-native job builds one ARM native emulator image and makes it available to every compatibility leg. It checks the image version after startup. A build or health failure stops the matrix before client results can be produced.

References: .github/…/compatibility.yml• L56-145 .github/…/compatibility.yml• L225-305

Compatibility matrix

The native-compat-test job runs ten independent entries across nine suite images with fail-fast disabled. The extra entry runs the Java SDK messaging and event tests against published endpoint mode while reusing the Java suite image:

  • Python, Java, .NET, Node, and C++ SDKs
  • A second Java SDK leg for published Service Bus and Event Hubs endpoints
  • Terraform and OpenTofu
  • Azure CLI
  • Azure Developer CLI

Each entry loads the shared image, creates a private Docker network, starts a clean emulator, waits for its health state, and runs one client image. Pull requests use the default emulator behavior. Scheduled and manual runs use the Azure parity level so opt-in Azure behavior is checked as well. Draft pull requests skip runner work until they are ready for review.

The matrix passes the HTTP endpoint to every client. SDK entries that use Service Bus or Event Hubs also receive a broker host and port. Java receives extra settings for Data Lake, managed identity, mocked AKS behavior, and the published endpoint leg. The azd entry enables public Azure-shaped TLS host names because azd cannot select a custom cloud. Each entry has a minimum executed-test count so setup failures and broad skips do not look like successful test runs.

References: .github/…/compatibility.yml• L147-252 .github/…/compatibility.yml• L254-305

Result collection

Each client image writes JUnit-compatible results to /results. CI checks the number of executed cases, adds the XML files to the job summary, records timing data, uploads the reports, and prints emulator logs when a leg fails. The result view keeps client assertions and emulator responses traceable without combining all clients into one process.

References: .github/…/compatibility.yml• L329-371 compatibility-tests/…/package.json• L5-7 compatibility-tests/…/Dockerfile• L9-14

Compatibility image cache warming

The warm-compat-caches workflow builds the nine client images on the main branch and writes their BuildKit layers to shared cache scopes. Pull-request jobs read those scopes without writing new per-branch copies, so the first compatibility run can reuse dependency layers and the cache stays within the repository budget.

References: .github/…/warm-compat-caches.yml• L1-14 .github/…/warm-compat-caches.yml• L54-94 .github/…/compatibility.yml• L314-328

Published compatibility images

Nightly and release workflows publish multi-platform compatibility images beside the normal emulator image. The nightly tags use nightly-compat; release tags use the version suffix -compat and latest-compat. These images support repeatable execution outside pull-request CI. They do not replace the pull-request matrix, which runs each suite against a live emulator.

References: .github/…/nightly.yml• L141-230 .github/…/release.yml• L87-178

Language-specific SDK suites

SDK coverage

Each SDK suite uses the real Azure client library for its language. The suite therefore checks the emulator protocol together with the assumptions made by that client library.

SuiteMain coverage
JavaBroad storage, configuration, Cosmos DB, database, messaging, identity, compute, security, registry, policy, Monitor, AKS, Functions, serverless, and Azure AI Search coverage. Event Grid checks topic publishing and webhook delivery. Service Bus checks ARM provisioning, settlement, sessions, scheduling, lock behavior, metadata, expiry, and broker endpoint use.
NodeStorage, Cosmos, configuration, identity, Entra, Key Vault, Table, Service Bus, Event Hubs, Container Instances, and Azure AI Search. The Entra path covers login, refresh, scope change, Graph access, and renewed ARM access.
PythonBlob, Queue, Table, Cosmos, VM, managed identity, ACR, Redis, Key Vault, App Configuration, Container Instances, Service Bus, Azure Resource Graph, and Azure AI Search. Redis checks management resources against a real sidecar when enabled. Resource Graph checks object and table results, empty-result columns, paging, resource containers, summaries, and query errors.
.NETBlob SAS, Cosmos queries and batches, Service Bus administration and messaging metadata, Key Vault secrets, certificates and keys, SignalR, and Azure AI Search. Service Bus coverage includes drain behavior, lock expiry, redelivery, broker metadata, and message return after lock expiry.
C++Blob and Queue lifecycle behavior, status codes, and error bodies through the storage endpoint contract.

The suites also cover behavior that a direct HTTP check cannot show. They exercise SDK endpoint parsing, paging, conditional state, token handling, AMQP connections, broker reply routing, data-plane read-back, and resource cleanup. Service-specific coverage is described by the individual compatibility tests rather than repeated here.

References: compatibility-tests/…/SearchCompatibilityTest.java• L100-294 compatibility-tests/…/ServiceBusCompatibilityTest.java• L52-109 compatibility-tests/…/test_resourcegraph.py• L85-194 compatibility-tests/…/test_search.py• L107-303 compatibility-tests/…/search.test.ts• L93-258 compatibility-tests/…/SearchCompatibilityTests.cs• L25-216 compatibility-tests/…/ServiceBusMetadataCompatibilityTests.cs• L7-186

Identity and messaging compatibility

The Java identity path checks the full Entra client contract. It follows tenant-rooted discovery, validates the published RSA signing key, and acquires both app-only and delegated tokens through the real Azure identity client. The checks then verify the token signature, time window, issuer, tenant, audience, and client identity claims.

The Java Service Bus path checks the broker contract after management setup creates the entities. It covers message settlement, delivery counts, dead-lettering, properties, topic fan-out, scheduled delivery, sessions, lock renewal, lock expiry, and session expiry. A separate ARM path creates namespaces and entities through management requests, obtains connection strings from listKeys, and proves that those results work over AMQP. The .NET path adds checks for receiver drain behavior, broker metadata across redelivery and dead-lettering, and unsettled messages that return to another receiver after expiry. The Java Event Grid path checks both management provisioning and the data plane. It publishes Event Grid events and CloudEvents through the real publisher SDK. When the emulator can reach the test process, it also checks subscription validation and webhook delivery.

References: compatibility-tests/…/ServiceBusCompatibilityTest.java• L52-109 compatibility-tests/…/ServiceBusArmCompatibilityTest.java• L30-142 compatibility-tests/…/ServiceBusSessionExpiryCompatibilityTest.java• L21-115 compatibility-tests/…/ServiceBusDrainCompatibilityTests.cs• L14-49 compatibility-tests/…/ServiceBusPeekLockCompatibilityTests.cs• L15-94 compatibility-tests/…/ServiceBusMetadataCompatibilityTests.cs• L19-186 compatibility-tests/…/EventGridCompatibilityTest.java• L76-163

SDK execution contracts

The SDK images pin their client dependencies and runtime targets. This keeps an upstream library release from changing the contract under test without a deliberate compatibility change. The Node suite compiles its test sources before execution. The Python suite pins the Resource Graph API line and the broker-compatible Service Bus version.

HTTP clients receive an Azure-shaped endpoint when their SDK requires a known Azure scheme or host. The transport then routes the request to the emulator. Service Bus and Event Hubs split the contract: management requests use the emulator HTTP endpoint, while message operations use the broker address returned or supplied for that emulator namespace. Java Service Bus tests start the namespace on demand and skip broker assertions when the emulator reports mocked mode.

References: compatibility-tests/…/package.json• L5-30 compatibility-tests/…/package-lock.json• L7-31 compatibility-tests/…/requirements.txt• L1-19 compatibility-tests/…/SdkTestDotnet.csproj• L1-24 compatibility-tests/…/pom.xml• L11-18 compatibility-tests/…/EmulatorConfig.java• L403-745

Client endpoint configuration

The suites build Azure-shaped credentials and service URLs from the emulator endpoint and CI values. This preserves the host, scheme, tenant, subscription, and broker details that real clients expect while keeping traffic local.

The Azure CLI has no universal endpoint override. Its suite therefore registers or discovers a custom cloud, logs in with the seeded service principal, and uses the discovered Resource Manager and identity endpoints. Storage data-plane checks use matching Blob, Queue, and Table endpoints. Service Bus management checks use the same Azure-shaped management route and validate namespace, entity, and authorization-rule results. Azure Developer CLI has no custom-cloud support, so its container trusts the emulator certificate and routes Azure's fixed management and identity hosts to the emulator. Terraform and OpenTofu use the provider environment, a metadata host, and the same development tenant and subscription.

References: compatibility-tests/…/README.md• L3-16 compatibility-tests/…/common-setup.bash• L12-53 compatibility-tests/…/servicebus.bats• L1-79 compatibility-tests/…/run-bats-in-container.sh• L9-27 compatibility-tests/…/provider.tf• L10-36 compatibility-tests/…/provider.tf• L10-36

Infrastructure provider suites

Terraform and OpenTofu coverage

The Terraform and OpenTofu suites use the Azure Resource Manager provider to create and manage one broad resource model against the emulator. The model covers location lookup, storage, Event Grid, Key Vault, RBAC, networks, compute, Redis, registries, private endpoints, Container Instances, Azure AI Search, IoT Hub, SQL, ARM template deployment, Service Bus, and related network resource types. OpenTofu also covers PostgreSQL flexible server resources; those resources are intentionally allowlisted until they are present in Terraform.

Both main suites use the same provider version, cloud environment, metadata host, tenant, subscription, and local credentials. Their tests run initialization, validation, plan, apply, read-back, update, import, and destroy. A later plan checks that provider state matches the emulator state instead of reporting false drift. Data-plane checks continue from resource creation into storage, Key Vault, and Service Bus operations. Search, IoT Hub, and Service Bus checks carry service keys or connection strings from provider state into the management and broker paths. Deployment checks verify that a template creates a real storage resource and returns its output. The suites also check SQL settings and cleanup, including removal of the resource group and purge of deleted services.

Terraform has a separate AzureRM 4.x Service Bus suite. It keeps the main suite on the older provider line while checking the newer provider's default fields, subscription settings, and Premium namespace authorization behavior against the same emulator contract.

References: compatibility-tests/…/main.tf• L647-715 compatibility-tests/…/terraform.bats• L249-425 compatibility-tests/…/main.tf• L223-281 compatibility-tests/…/opentofu.bats• L249-425 compatibility-tests/…/main.tf• L1-89 compatibility-tests/…/azurerm4-servicebus.bats• L1-57 .github/…/compat-iac-allowlist-opentofu-only.txt• L5-10

Azure CLI coverage

The Azure CLI suite checks the control-plane and data-plane contract through normal az commands. It covers cloud discovery or custom-cloud login, resource groups, storage, Key Vault, networks, VM behavior, Container Registry, Redis, Azure AI Search, IoT Hub, policy relationships, Azure RBAC role definitions and assignments, and Service Bus namespace and entity management. VM creation remains best effort where marketplace image resolution is not available.

The RBAC path finds a built-in role by name, creates a resource-group assignment for a service principal, lists the assignment with its role name, and deletes it. The Key Vault path confirms that management operations return the vault URI, then uses the vault host route over HTTPS for secret and key operations. Search checks service state, endpoint, key, update, and delete behavior. IoT Hub checks lifecycle state, subscription-wide lookup, shared access policies, key renewal, consumer groups, and name conflicts. Service Bus checks namespace state and endpoint, name availability, queue and topic hierarchy, entity settings, and authorization-rule connection strings. ACR and Redis checks also cover resource read-back and Redis deletion through the CLI poller, including a repeat delete after the cache is gone.

References: compatibility-tests/…/README.md• L3-16 compatibility-tests/…/iothub.bats• L25-207 compatibility-tests/…/servicebus.bats• L21-79 compatibility-tests/…/search.bats• L1-85 compatibility-tests/…/common-setup.bash• L19-53 compatibility-tests/…/Dockerfile• L1-23

Azure Developer CLI suite

azd coverage

The Azure Developer CLI suite checks whether azd can authenticate, keep environment and configuration values, and manage infrastructure through the emulator. It uses the real azd and Bicep tools. The tests share state in file order so authentication and selected environments carry into later checks.

The suite covers these user flows:

  • Service-principal login and ARM tokens for both management scopes.
  • Environment value storage and configuration value round trips.
  • Terraform provisioning and teardown of a resource group.
  • Subscription-scope Bicep preview, module deployment, deployment outputs, no-change detection, and purge teardown.
  • Container App provisioning and deployment of a published service image.

The Bicep fixture creates a resource group, a storage account, managed identities, a Log Analytics workspace, and an API Management service through a module. Its outputs check that the deployment exposes created resources and calculated values rather than only the module wrapper. The Container App fixture checks that azd finds an app by its service tag, creates a new revision with the service image, keeps secret values, and removes the app group during teardown. Docker build and registry push are not covered by this flow.

References: compatibility-tests/…/README.md• L3-23 compatibility-tests/…/30-bicep.bats• L14-115 compatibility-tests/…/40-containerapp.bats• L26-77 compatibility-tests/…/main.bicep• L1-30 compatibility-tests/…/workload.bicep• L7-53 compatibility-tests/…/azure.yaml• L1-8 compatibility-tests/…/app.bicep• L8-50

azd endpoint bridge

The azd container bridges fixed Azure host names to the emulator because azd cannot use the custom-cloud mechanism used by Azure CLI. Before Bats runs, it obtains the emulator certificate, adds it to the system trust store, maps Azure management and identity hosts to loopback, and forwards HTTPS traffic to the emulator endpoint.

References: compatibility-tests/…/Dockerfile• L4-44 compatibility-tests/…/run-bats-in-container.sh• L4-41 .github/…/compatibility.yml• L246-252

Change checklist

When these files or sections are changed, remember to consider these:

  • If the matrix in .github/…/compatibility.yml changes, keep the test image, emulator settings, broker variables, result path, and minimum executed-test count aligned.
  • If the compatibility image list changes, update both the native-compat-test matrix and the matching warm-cache matrix and cache scope. The published Java leg reuses the sdk-test-java image.
  • If a suite starts to use a broker or sidecar, update both emulator startup settings and matrix environment values. HTTP setup can pass while the broker or sidecar path is wrong.
  • If azd endpoint behavior changes, keep public Azure host routing, certificate trust, the fixed-host bridge, and the azd fixture flows aligned.
  • If the Terraform or OpenTofu resource model changes, update both configurations or update the matching directional allowlist for an intentional gap. Keep the parity check and the Bats assertions consistent.
  • If the AzureRM 4.x Service Bus fixture changes, keep its provider version, API defaults, separate state directory, and dedicated Bats assertions aligned with the main Terraform suite.
  • If Search, IoT Hub, or Service Bus adds a management-to-data-plane check, keep the returned endpoint, key, or connection string aligned with the client path and the provider or CLI assertions.
  • If endpoint discovery, TLS, tenant, subscription, or cloud metadata changes, check Azure CLI, azd, Terraform, OpenTofu, and SDK endpoint setup together.
  • If Service Bus or Event Hubs startup changes, check namespace readiness, broker host and port, TLS trust, mocked-mode handling, and client skips together.
  • If a client dependency or runtime target changes, update its lockfile or project file with its image and reporter contract. Keep the Resource Graph and Service Bus pins tied to their API and frame contracts.
  • If compatibility image packaging changes, keep the nightly and release native and -compat tags aligned.

Important failure modes

TriggerConsequenceGuard
Native image build, health check, or version check failsNo matrix leg can test the intended emulator buildInspect the native build, health state, reported version, and emulator log first.
Warm-cache matrix or scope differs from the compatibility matrixClient images build cold or use a cache for the wrong architecture or suiteKeep the nine suite images, ARM runner, and OS/architecture/suite scope identical.
A suite runs below its minimum test countSetup failure or broad skips can look green from the container exit codeReview the count check and the suite setup output.
Terraform and OpenTofu resource sets drift without an allowlist entryThe parity job fails before live provider coverageAdd the resource to both suites or record a real one-sided gap in the matching allowlist.
AzureRM 4.x Service Bus defaults are tested in the main provider fixtureThe older provider leg can report false drift or hide a newer provider contract gapKeep the 4.x fixture separate and run its plan and read-back checks independently.
Service Bus or Event Hubs is mocked or not protocol-readyManagement checks can pass while broker tests cannot connectStart the required broker and wait for protocol and TLS readiness.
HTTP and broker endpoints name different namespacesManagement setup passes but message operations failTreat the HTTP namespace response and broker settings as one connection contract.
A Service Bus session expires without a broker close or delivery-count updateSession tests can pass once but fail to model redelivery and dead-letter behaviorCheck broker expiry signals, delivery count, FIFO order, and the final dead-letter result.
azd cannot trust or route an Azure fixed hostAuthentication or infrastructure commands fail before a test runsCheck the emulator certificate, host mappings, HTTPS forwarder, and public-host setting together.
Provider or CLI requests resolve an Azure domain without the emulator routeResource creation never reaches floci-azKeep Azure-shaped host routes, metadata settings, certificate trust, and port forwarding aligned.
Provider read-back omits defaults or returns non-canonical valuesApply succeeds but the next plan reports driftPreserve normalized resource state, generated endpoints, enum casing, and secret omission.
A token has the wrong audience or tenant, or its signing key is not publishedIdentity clients reject the token before an ARM handler runsKeep discovery, JWKS, token claims, signature validation, tenant ownership, and ARM request gating consistent.
A Search service key, IoT Hub key, or Service Bus connection string is not shared between management state and the data planeResource creation passes but client operations failKeep service provisioning, key lookup, endpoint shape, TLS handling, and client routing as one contract.
A client dependency changes its authentication or endpoint contractThe suite fails during setup instead of testing emulator behaviorTreat pinned package versions, lockfiles, runtime targets, and endpoint rewrites as compatibility contracts.
A suite does not write XML to /resultsCI has no usable test summary even when the container ranKeep each reporter setting and workflow mount aligned.

Key files

FileWhy to read it
.github/…/compatibility.ymlDefines parity checking, the native image build, the ten-entry matrix, emulator network, parity level, client settings, health gate, test-count gate, and result collection.
.github/…/warm-compat-caches.ymlWarms the shared ARM BuildKit layers consumed by compatibility image builds.
.github/…/compat-iac-drift-check.pyDefines how Terraform and OpenTofu resource parity is measured.
.github/…/compat-iac-allowlist-opentofu-only.txtRecords the intentional OpenTofu-only PostgreSQL resource gap.
compatibility-tests/…/README.mdSummarizes Azure CLI cloud login and service coverage.
compatibility-tests/compat-azcli/test/iothub.batsShows Azure CLI IoT Hub lifecycle, policy, key, consumer-group, and conflict coverage.
compatibility-tests/compat-azcli/test/servicebus.batsShows Azure CLI Service Bus namespace, entity, and authorization-rule coverage.
compatibility-tests/compat-azcli/test/search.batsShows Azure AI Search service state, endpoint, key, update, and delete coverage through Azure CLI.
compatibility-tests/…/common-setup.bashDefines shared Azure CLI endpoints, identities, resource names, and storage routes.
compatibility-tests/…/README.mdSummarizes azd authentication, environment, Terraform, Bicep, and Container App coverage.
compatibility-tests/…/run-bats-in-container.shShows the fixed Azure host TLS and routing bridge required by azd.
compatibility-tests/…/main.tfDefines the main Terraform resource model, including Azure AI Search, IoT Hub, and Service Bus, and its provider-facing outputs.
compatibility-tests/compat-terraform/test/terraform.batsVerifies Terraform lifecycle, state read-back, data-plane access, Search, IoT Hub, Service Bus, deployment behavior, SQL behavior, and cleanup.
compatibility-tests/…/main.tfDefines the separate AzureRM 4.x Service Bus resource model and its provider defaults.
compatibility-tests/compat-terraform/test/azurerm4-servicebus.batsVerifies the AzureRM 4.x Service Bus plan, defaults, and Premium authorization rule.
compatibility-tests/…/main.tfDefines the OpenTofu resource model, including Azure AI Search, IoT Hub, Service Bus, and the current PostgreSQL-only additions.
compatibility-tests/compat-opentofu/test/opentofu.batsVerifies OpenTofu lifecycle, state read-back, data-plane access, Search, IoT Hub, Service Bus, PostgreSQL behavior, SQL behavior, and cleanup.
compatibility-tests/…/EmulatorConfig.javaDefines Java endpoint shaping, broker startup, TLS handling, mocked-mode skips, and Service Bus management setup.
compatibility-tests/…/ServiceBusCompatibilityTest.javaShows Java Service Bus messaging, topic, scheduled delivery, session, lock, and settlement behavior through the Azure SDK.
compatibility-tests/…/ServiceBusArmCompatibilityTest.javaShows the management-to-broker path from ARM namespace creation and listKeys to SDK send and receive.
compatibility-tests/…/ServiceBusSessionExpiryCompatibilityTest.javaShows broker-owned session expiry, redelivery count, FIFO behavior, renewal, and dead-letter coverage.
compatibility-tests/…/test_resourcegraph.pyShows Azure Resource Graph query results, table format, paging, summaries, and error coverage.
compatibility-tests/…/test_search.pyShows Python Azure AI Search index, document, ETag, batch, and data-shape coverage.
compatibility-tests/…/search.test.tsShows Node Azure AI Search index, document, ETag, batch, and data-shape coverage.
compatibility-tests/…/SearchCompatibilityTests.csShows .NET Azure AI Search index, document, ETag, statistics, and error coverage.
compatibility-tests/…/ServiceBusDrainCompatibilityTests.csShows the .NET AMQP drain contract when a receiver has no credit left.
compatibility-tests/…/ServiceBusPeekLockCompatibilityTests.csShows .NET message lock, redelivery, and delivery-count behavior across queues and subscriptions.
compatibility-tests/…/ServiceBusMetadataCompatibilityTests.csShows .NET broker metadata preservation through peek, redelivery, dead-lettering, receive-and-delete, scheduling, and sessions.
compatibility-tests/…/TableCompatibilityTest.javaShows Java Table Storage lifecycle, query, paging, concurrency, and transaction coverage.
compatibility-tests/…/test_redis.pyShows Redis management-to-sidecar checks, password validation, and opt-in TLS verification.
compatibility-tests/…/package.jsonDefines Node client dependencies, the test reporter, and the App Configuration compatibility pin.
compatibility-tests/…/requirements.txtDefines the pinned Python SDK set, Resource Graph API line, and broker-compatible Service Bus version.
compatibility-tests/sdk-test-dotnet/SdkTestDotnet.csprojDefines the .NET target and Azure client packages used by the suite.