grpc-ditto

command module
v0.5.0-pre1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 31 Imported by: 0

README

Overview

grpc-ditto is grpc mocking server that can mock any grpc services by parsing corresponding proto file.

Usage example:

grpc-ditto --proto ~/dev/master-lock-svc/types --mocks jsonmocks

this command will run a server on port 51000 by default, parse all proto files in --proto directory, load all mocks from json files in --mocks directory and also expose grpc reflection service.

Mock format
[
  {
    "request": {
      "method": "/videa.masterlock.proto.types.MasterLockService/Lock",
      "bodyPatterns": [
        {
          "matchesJsonPath": {"expression": "$.name", "equals": "lock1"}
        },
        {
          "matchesJsonPath": {"expression": "$.duration", "equals": "100"}
        }
      ]
    },
    "response": {
      "body": {"key": "key1"}
    }
  },
  {
    "request": {
      "method": "/videa.masterlock.proto.types.MasterLockService/Lock",
      "bodyPatterns": [
        {
          "equalToJson": {"name": "lock2", "duration": "200"}
        }
      ]
    },
    "response": {
      "body": {"key": "key2"}
    }
  },
  {
    "request": {
      "method": "/videa.masterlock.proto.types.MasterLockService/Lock",
      "bodyPatterns": [
        {
          "matchesJsonPath": "$.name"
        }
      ]
    },
    "response": {
      "body": {"key": "key_all_non_empty"}
    }
  }
]

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
fs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL