Giter Site home page Giter Site logo

fluent-ci-templates / microcks-pipeline Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 165 KB

Import API specifications into Microcks and run Microcks tests

License: MIT License

TypeScript 99.56% Nix 0.21% Rust 0.23%
api continuous-integration contract-testing deno docker microcks testing typescript api-testing mocking

microcks-pipeline's Introduction

Microcks Pipeline

fluentci pipeline deno compatibility dagger-min-version ci

A ready-to-use CI/CD Pipeline for importing API specifications into Microcks and running Microcks tests.

๐Ÿš€ Usage

Run the following command:

fluentci run microcks_pipeline

Or, if you want to use it as a template:

fluentci init -t microcks

This will create a .fluentci folder in your project.

Now you can run the pipeline with:

fluentci run .

๐Ÿงฉ Dagger Module

Use as a Dagger module:

dagger install github.com/fluent-ci-templates/microcks-pipeline@main

Call a function from the module:

# Import API specifications into Microcks
dagger call import-api-specs --src . \
          --specification-files $SPECIFICATION_FILES \
          --microcks-url $MICROCKS_URL \
          --keycloak-client-id $KEYCLOAK_CLIENT_ID \
          --keycloak-client-secret KEYCLOAK_CLIENT_SECRET

# Run Microcks tests
dagger call run-tests --api-name-and-version "$API_NAME_AND_VERSION" \
--test-endpoint $TEST_ENDPOINT \
--runner $RUNNER \
--microcks-url $MICROCKS_URL \
--keycloak-client-id $KEYCLOAK_CLIENT_ID \
--keycloak-client-secret KEYCLOAK_CLIENT_SECRET

๐Ÿ› ๏ธ Environment variables

Variable Description Default
SPECIFICATION_FILES The path to the API specifications
MICROCKS_URL Microcks instance API endpoint
KEYCLOAK_CLIENT_ID Keycloak Realm Service Account ClientId
KEYCLOAK_CLIENT_SECRET Keycloak Realm Service Account ClientSecret
API_NAME_AND_VERSION The name and version of the API to test
TEST_ENDPOINT The endpoint to test
RUNNER Test strategy (one of: HTTP, SOAP, SOAP_UI, POSTMAN, OPEN_API_SCHEMA, ASYNC_API_SCHEMA, GRPC_PROTOBUF, GRAPHQL_SCHEMA) HTTP
WAIT_FOR Time to wait for test to finish (int + one of: milli, sec, min) 5sec
SECRET_NAME The name of a Secret to use for connecting test endpoint
FILTERED_OPERATIONS JSON that allows to filter a list of operations to launch a test for

โœจ Jobs

Job Description
import-api-specs Import API specifications into Microcks
run-tests Launch a Microcks test on an API endpoint
importApiSpecs(
  src: string | Directory,
  specificationFiles: string,
  microcksURL: string,
  keycloakClientId: string,
  keycloakClientSecret: string | Secret
): Promise<string>;

runTests(
  apiNameAndVersion: string,
  testEndpoint: string,
  microcksURL: string,
  keycloakClientId: string,
  keycloakClientSecret: string | Secret,
  runner = "HTTP",
  waitFor = "5sec",
  secretName?: string,
  filteredOperations?: string,
  operationsHeaders?: string
): Promise<string>;

๐Ÿ‘จโ€๐Ÿ’ป Programmatic usage

You can also use this pipeline programmatically:

import { importApiSpecs, runTests } from "jsr:@fluentci/microcks";

await importApiSpecs(
    ".",
    Deno.env.get("SPECIFICATION_FILES")!,
    Deno.env.get("MICROCKS_URL")!,
    Deno.env.get("KEYCLOAK_CLIENT_ID")!,
    Deno.env.get("KEYCLOAK_CLIENT_SECRET")!
);

await runTests(
    Deno.env.get("API_NAME_AND_VERSION")!,
    Deno.env.get("TEST_ENDPOINT")!,
    Deno.env.get("MICROCKS_URL")!,
    Deno.env.get("KEYCLOAK_CLIENT_ID")!,
    Deno.env.get("KEYCLOAK_CLIENT_SECRET")!,
    Deno.env.get("RUNNER")!,
    Deno.env.get("WAIT_FOR"),
    Deno.env.get("SECRET_NAME"),
    Deno.env.get("FILTERED_OPERATIONS")
);

microcks-pipeline's People

Contributors

tsirysndr avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

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.