Skip to content

ktestify/ktestify-plugin-azureblob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ktestify-plugin-azureblob

build passing license java 25 version


ktestify-plugin-azureblob is a ktestify plugin that adds Azure Blob Storage transport support. It implements the KtestifyPlugin SPI from ktestify-core and ships ready-to-use Cucumber step definitions for uploading and asserting blobs inside your Kafka integration test scenarios.

Drop the JAR into your ktestify-cucumber setup and the steps are automatically discovered — no code changes required.


Installation

<dependency>
  <groupId>io.github.ktestify</groupId>
  <artifactId>ktestify-plugin-azureblob</artifactId>
  <version>1.0-SNAPSHOT</version>
  <scope>test</scope>
</dependency>

With ktestify-cucumber (fat JAR / Docker)

Drop the plugin JAR into the /workspace/plugins mount and ktestify-cucumber will load it automatically via ServiceLoader at startup:

docker run --rm \
  -v $(pwd)/features:/workspace/features \
  -v $(pwd)/assets:/workspace/assets \
  -v $(pwd)/plugins:/workspace/plugins \   # ← drop ktestify-plugin-azureblob-*.jar here
  -e AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=..." \
  ghcr.io/ktestify/ktestify-cucumber:latest \
  /workspace/features

What It Adds

Step Definitions

# Upload a blob before the Kafka action
Given blob container
  | containerName  | containerAlias |
  | my-container   | blobs          |

When blob from file is uploaded
  | containerAlias | file           | blobName         |
  | blobs          | payload.json   | orders/input.json|

# Assert a blob was written by the system under test
Then expected blob from file
  | containerAlias | blobName             | file                |
  | blobs          | orders/output.json   | expected-order.json |

And blob should not exist
  | containerAlias | blobName         |
  | blobs          | orders/error.json|

Full Scenario Example

Feature: Order pipeline writes result blob

  Background:
    Given namespace
      | namespace |
      | my-org    |
    Given input topic
      | topicName | topicAlias |
      | orders    | orders-in  |
    Given blob container
      | containerName | containerAlias |
      | results       | results-blob   |
    Given assets directory
      | absolutePath                    |
      | src/test/resources/data/orders  |

  Scenario: Processed order is stored in Azure Blob
    When record from file is sent
      | topicName | file       | recordKey |
      | orders    | order.json | ORD-001   |
    And wait for 5 seconds
    Then expected blob from file
      | containerAlias | blobName              | file                  |
      | results-blob   | ORD-001/result.json   | expected-result.json  |

Configuration

The plugin reads its settings from the ktestify.plugins.azure-blob HOCON block. All values can be overridden via environment variables.

ktestify.plugins.azure-blob {
  # Storage account connection string (takes precedence over SAS / account-key)
  connection-string = ""
  connection-string = ${?AZURE_STORAGE_CONNECTION_STRING}

  # SAS token — used when connection-string is not set
  sas-token = ""
  sas-token = ${?AZURE_STORAGE_SAS_TOKEN}

  # Storage account endpoint (required when using SAS or managed identity)
  endpoint = ""
  endpoint = ${?AZURE_STORAGE_ENDPOINT}

  # Default request timeout for blob operations
  request-timeout = 30s

  # Create containers automatically if they do not exist
  auto-create-containers = true
}

Local development with Azurite

Use the Azurite emulator for local and CI testing — no real Azure account needed:

docker run -p 10000:10000 mcr.microsoft.com/azure-storage/azurite azurite-blob --loose
ktestify.plugins.azure-blob {
  connection-string = "UseDevelopmentStorage=true"
}

Architecture

This plugin implements the KtestifyPlugin SPI:

public class AzureBlobPlugin implements KtestifyPlugin {
    @Override public String getId()          { return "azure-blob"; }
    @Override public String getGluePackage() { return "io.github.ktestify.plugin.azureblob.steps"; }

    @Override
    public void initialize(PluginContext ctx) {
        // reads ktestify.plugins.azure-blob from ctx.getConfig()
    }
}

It is discovered automatically by ServiceLoader — the META-INF/services/io.github.ktestify.plugin.KtestifyPlugin descriptor is included in the JAR.


Related


Contributing

Contributions are welcome. Please read the contributing guide before opening a pull request.

  1. Fork the repository
  2. Create a feature branch — git checkout -b feat/my-feature
  3. Commit with Conventional Commitsgit commit -m "feat: add my feature"
  4. Push and open a Pull Request against main

License

ktestify-plugin-azureblob is licensed under the Apache License 2.0.


KTestify
Assert the stream. Own the pipeline.

About

A KTestify plugin to interact with Azure Blob Storage

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages