@skyramp/skyramp 0.4.34 → 0.4.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # skyramp
2
2
 
3
- `skyramp` is an npm module that provides utility functions for leveraging [skyramp CLI](https://skyramp.dev/docs/commands/skyramp/) commands. The `skyramp` module provides functionalities to create and apply mock configurations for both gRPC and REST APIs. It also offers features for testing and asserting scenarios in various test environments. The module exports the following classes: `RestEndpoint`, `GrpcEndpoint`, `Scenario`, and `SkyrampClient`.
3
+ `skyramp` is an npm module that provides utility functions for leveraging [skyramp CLI](https://skyramp.dev/docs/reference/cli-commands/) commands. The `skyramp` module provides functionalities to create and apply mock configurations for both gRPC and REST APIs. It also offers features for testing and asserting scenarios in various test environments. The module exports the following classes: `RestEndpoint`, `GrpcEndpoint`, `Scenario`, and `SkyrampClient`.
4
4
 
5
5
  ## Installation
6
6
  To install Skyramp, simply run the following command in your terminal:
@@ -11,7 +11,7 @@ npm install @skyramp/skyramp
11
11
  ## Usage
12
12
  Once you've installed Skyramp, you can import it into your project like this:
13
13
 
14
- ```bash
14
+ ```javascript
15
15
  const { GrpcEndpoint, RestEndpoint, SkyrampClient, Scenario } = require('skyramp');
16
16
  ```
17
17
 
@@ -19,7 +19,7 @@ const { GrpcEndpoint, RestEndpoint, SkyrampClient, Scenario } = require('skyramp
19
19
  The `SkyrampClient` class is the main entry point to interact with the skyramp module. It allows you to apply configurations, start test scenarios, and deploy and delete workers. First, you must set up the `SkyrampClient` with a kubernetes cluster.
20
20
 
21
21
  **Example: Provision Local Cluster with Skyramp**
22
- ```bash
22
+ ```javascript
23
23
  const skyrampClient = new SkyrampClient();
24
24
  skyrampClient.applyLocal().then(function() {
25
25
  // Local cluster provisioned
@@ -30,7 +30,7 @@ skyrampClient.applyLocal().then(function() {
30
30
  Once you have a `SkyrampClient` instance configured with a kubernetes cluster, you can deploy the Skyramp Worker in-cluster, for applying mocks and running tests.
31
31
 
32
32
  **Example: Deploy Skyramp Worker**
33
- ```bash
33
+ ```javascript
34
34
  skyrampClient.deployWorker('my-namespace').then(function() {
35
35
  // Worker deployed successfully
36
36
  }).catch(function(error) {
@@ -42,7 +42,7 @@ skyrampClient.deployWorker('my-namespace').then(function() {
42
42
  The `RestEndpoint` class represents a REST API endpoint and provides methods to configure mock responses to apply them to the `SkyrampClient`.
43
43
 
44
44
  **Example: Create REST Mock Configuration**
45
- ```bash
45
+ ```javascript
46
46
  restEndpoint = new RestEndpoint('artists', 'artists-GET', 50050, 'api/openapi/artists.yaml');
47
47
  restEndpoint.mockMethodFromFile('artists-GET', 'files/rest-values.yaml');
48
48
  skyrampClient.mockerApply('my-namespace', '', restEndpoint).then(function() {
@@ -56,7 +56,7 @@ skyrampClient.mockerApply('my-namespace', '', restEndpoint).then(function() {
56
56
  The `GrpcEndpoint` class represents a gRPC API endpoint and provides methods to configure mock responses to apply them to the `SkyrampClient`.
57
57
 
58
58
  **Example: Create gRPC Mock Configuration**
59
- ```bash
59
+ ```javascript
60
60
  grpcEndpoint = new GrpcEndpoint('routeguide', 'RouteGuide', 50051, 'api/pb/routeguide.proto');
61
61
  grpcEndpoint.mockMethodFromFile('GetFeature', 'files/grpc-response.yaml');
62
62
  skyrampClient.mockerApply('my-namespace', '', grpcEndpoint).then(function() {
@@ -70,7 +70,7 @@ skyrampClient.mockerApply('my-namespace', '', grpcEndpoint).then(function() {
70
70
  The `Scenario` class allows you to define test scenarios by specifying a series of API requests and assertions to be made. Once a `Scenario` is created, you can start it using the `SkyrampClient` instance.
71
71
 
72
72
  **Example: Test Assert Scenario (REST)**
73
- ```bash
73
+ ```javascript
74
74
  scenario = new Scenario('rest-test')
75
75
  step1 = scenario.addRequest(restEndpoint, 'artists-GET');
76
76
  step2 = scenario.addAssertEqual(`${step1}.res.items[0].artist_name`, 'abc');
@@ -82,7 +82,7 @@ skyrampClient.testerStart('test-worker', '', scenario).then(function() {
82
82
  ```
83
83
 
84
84
  **Example: Test Assert Scenario (gRPC)**
85
- ```bash
85
+ ```javascript
86
86
  scenario = new Scenario('routeguide-assert-test')
87
87
  step1 = scenario.addRequestFromFile(grpcEndpoint, 'GetFeature', 'files/grpc-request.yaml');
88
88
  step2 = scenario.addAssertEqual(`${step1}.res.name`, 'test-feature');
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/skyramp",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "description": "module for leveraging skyramp cli functionality",
5
5
  "scripts": {
6
6
  "pack": "npm pack"
@@ -18,6 +18,6 @@
18
18
  "dependencies": {
19
19
  "fs": "^0.0.1-security",
20
20
  "js-yaml": "^4.1.0",
21
- "koffi": "^2.5.3"
21
+ "koffi": "2.5.12"
22
22
  }
23
23
  }