Skip to content

Commit

Permalink
Merge pull request #1817 from grafana/qp-grpc
Browse files Browse the repository at this point in the history
Replace grpcbin.test.k6.io with QuickPizza
  • Loading branch information
federicotdn authored Dec 10, 2024
2 parents 2a84c4c + 394af07 commit ce4b291
Show file tree
Hide file tree
Showing 32 changed files with 116 additions and 128 deletions.
1 change: 0 additions & 1 deletion docs/sources/k6/next/get-started/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ These resources help you write and run k6 tests in a safe environment and explor
If you need a place to learn k6 and test your scripts, you can use these playground/demo applications:

- [test-api.k6.io](https://test-api.k6.io/). A simple REST and WebSocket web application. [grafana/test-api.k6.io](https://github.com/grafana/test-api.k6.io)
- [grpcbin.test.k6.io](https://grpcbin.test.k6.io/). A simple gRPC Request & Response Service. [grafana/k6-grpcbin](https://github.com/grafana/k6-grpcbin)
- [grafana/quickpizza](https://github.com/grafana/quickpizza). A simple demo web application.
- [grafana/httpbin](https://github.com/grafana/httpbin). A simple HTTP Request & Response Service.

Expand Down
8 changes: 4 additions & 4 deletions docs/sources/k6/next/javascript-api/k6-net-grpc/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';

const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', {
client.connect('grpc-quickpizza.grafana.com:443', {
// plaintext: false
});

const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
const data = { ingredients: ['Cheese'], dough: 'Thick' };
const response = client.invoke('quickpizza.GRPC/RatePizza', data);

check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
16 changes: 8 additions & 8 deletions docs/sources/k6/next/javascript-api/k6-net-grpc/client/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ aliases:
import grpc from 'k6/net/grpc';

const client = new grpc.Client();
// Download addsvc.proto for https://grpcbin.test.k6.io/, located at:
// https://raw.githubusercontent.com/moul/pb/master/addsvc/addsvc.proto
// Download quickpizza.proto for grpc-quickpizza.grafana.com, located at:
// https://raw.githubusercontent.com/grafana/quickpizza/refs/heads/main/proto/quickpizza.proto
// and put it in the same folder as this script.
client.load(null, 'addsvc.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', { timeout: '5s' });
client.connect('grpc-quickpizza.grafana.com:443', { timeout: '5s' });

const response = client.invoke('addsvc.Add/Sum', {
a: 1,
b: 2,
const response = client.invoke('quickpizza.GRPC/RatePizza', {
ingredients: ['Tomatoes', 'Cheese'],
dough: 'Thin'
});
console.log(response.message.v); // should print 3
console.log(response.message.starsRating); // should print a number between 1-5

client.close();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const grpcArgs = new SharedArray('grpc', () => {
// Using SharedArray here so that not every VU gets a copy of every certificate a key
return [
{
host: 'foo1.grpcbin.test.k6.io:9001',
host: 'foo1.grpc-quickpizza.grafana.com:443',
plaintext: false,
params: {
tls: {
Expand All @@ -97,7 +97,7 @@ const grpcArgs = new SharedArray('grpc', () => {
},
},
{
host: 'foo2.grpcbin.test.k6.io:9002',
host: 'foo2.grpc-quickpizza.grafana.com:443',
params: {
plaintext: false,
tls: {
Expand All @@ -111,7 +111,7 @@ const grpcArgs = new SharedArray('grpc', () => {
];
});

const client = new grpc.Client();
const client = new grpc.Client(null, 'quickpizza.proto');

export default () => {
if (__ITER === 0) {
Expand All @@ -120,9 +120,7 @@ export default () => {
client.connect(grpcArg.host, grpcArg.params);
}

const response = client.invoke('hello.HelloService/SayHello', {
greeting: 'Bert',
});
const response = client.invoke('quickpizza.GRPC/Status');

check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
8 changes: 4 additions & 4 deletions docs/sources/k6/next/javascript-api/k6-net-grpc/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';

const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', {
client.connect('grpc-quickpizza.grafana.com:443', {
// plaintext: false
});

const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
const data = { ingredients: ['Cheese'], dough: 'Thick' };
const response = client.invoke('quickpizza.GRPC/RatePizza', data);

check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
8 changes: 4 additions & 4 deletions docs/sources/k6/next/javascript-api/k6-net-grpc/response.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';

const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', {
client.connect('grpc-quickpizza.grafana.com:443', {
// plaintext: false
});

const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
const data = { ingredients: ['Cheese'], dough: 'Thick' };
const response = client.invoke('quickpizza.GRPC/RatePizza', data);

check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
8 changes: 4 additions & 4 deletions docs/sources/k6/next/testing-guides/api-load-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,13 @@ import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';
const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
client.load(null, 'quickpizza.proto');
export default () => {
client.connect('grpcbin.test.k6.io:9001');
client.connect('grpc-quickpizza.grafana.com:443');
const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
const data = { ingredients: ['Tomatoes', 'Cheese'], dough: 'Thin' };
const response = client.invoke('quickpizza.GRPC/RatePizza', data);
check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This example shows a way to use the [ServiceDisruptor](https://grafana.com/docs/

The complete [source code](#source-code) is at the end of this document. The next sections examine the code in detail.

The example uses [grpcpbin](https://grpcbin.test.k6.io), a simple request/response application that offers endpoints for testing different gRPC requests.
The example uses [grpcpbin](https://github.com/moul/grpcbin), a simple request/response application that offers endpoints for testing different gRPC requests.

The test requires `grpcpbin` to be deployed in a cluster in the namespace `grpcbin` and exposed with an external IP. The IP address is expected in the environment variable `GRPC_HOST`.

Expand Down
1 change: 0 additions & 1 deletion docs/sources/k6/v0.53.x/get-started/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ These resources help you write and run k6 tests in a safe environment and explor
If you need a place to learn k6 and test your scripts, you can use these playground/demo applications:

- [test-api.k6.io](https://test-api.k6.io/). A simple REST and WebSocket web application. [grafana/test-api.k6.io](https://github.com/grafana/test-api.k6.io)
- [grpcbin.test.k6.io](https://grpcbin.test.k6.io/). A simple gRPC Request & Response Service. [grafana/k6-grpcbin](https://github.com/grafana/k6-grpcbin)
- [grafana/quickpizza](https://github.com/grafana/quickpizza). A simple demo web application.
- [grafana/httpbin](https://github.com/grafana/httpbin). A simple HTTP Request & Response Service.

Expand Down
8 changes: 4 additions & 4 deletions docs/sources/k6/v0.53.x/javascript-api/k6-net-grpc/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';

const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', {
client.connect('grpc-quickpizza.grafana.com:443', {
// plaintext: false
});

const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
const data = { ingredients: ['Cheese'], dough: 'Thick' };
const response = client.invoke('quickpizza.GRPC/RatePizza', data);

check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ aliases:
import grpc from 'k6/net/grpc';

const client = new grpc.Client();
// Download addsvc.proto for https://grpcbin.test.k6.io/, located at:
// https://raw.githubusercontent.com/moul/pb/master/addsvc/addsvc.proto
// Download quickpizza.proto for grpc-quickpizza.grafana.com, located at:
// https://raw.githubusercontent.com/grafana/quickpizza/refs/heads/main/proto/quickpizza.proto
// and put it in the same folder as this script.
client.load(null, 'addsvc.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', { timeout: '5s' });
client.connect('grpc-quickpizza.grafana.com:443', { timeout: '5s' });

const response = client.invoke('addsvc.Add/Sum', {
a: 1,
b: 2,
const response = client.invoke('quickpizza.GRPC/RatePizza', {
ingredients: ['Tomatoes', 'Cheese'],
dough: 'Thin'
});
console.log(response.message.v); // should print 3
console.log(response.message.starsRating); // should print a number between 1-5

client.close();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const grpcArgs = new SharedArray('grpc', () => {
// Using SharedArray here so that not every VU gets a copy of every certificate a key
return [
{
host: 'foo1.grpcbin.test.k6.io:9001',
host: 'foo1.grpc-quickpizza.grafana.com:443',
plaintext: false,
params: {
tls: {
Expand All @@ -97,7 +97,7 @@ const grpcArgs = new SharedArray('grpc', () => {
},
},
{
host: 'foo2.grpcbin.test.k6.io:9002',
host: 'foo2.grpc-quickpizza.grafana.com:443',
params: {
plaintext: false,
tls: {
Expand All @@ -111,7 +111,7 @@ const grpcArgs = new SharedArray('grpc', () => {
];
});

const client = new grpc.Client();
const client = new grpc.Client(null, 'quickpizza.proto');

export default () => {
if (__ITER === 0) {
Expand All @@ -120,9 +120,7 @@ export default () => {
client.connect(grpcArg.host, grpcArg.params);
}

const response = client.invoke('hello.HelloService/SayHello', {
greeting: 'Bert',
});
const response = client.invoke('quickpizza.GRPC/Status');

check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';

const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', {
client.connect('grpc-quickpizza.grafana.com:443', {
// plaintext: false
});

const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
const data = { ingredients: ['Cheese'], dough: 'Thick' };
const response = client.invoke('quickpizza.GRPC/RatePizza', data);

check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';

const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', {
client.connect('grpc-quickpizza.grafana.com:443', {
// plaintext: false
});

const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
const data = { ingredients: ['Cheese'], dough: 'Thick' };
const response = client.invoke('quickpizza.GRPC/RatePizza', data);

check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
8 changes: 4 additions & 4 deletions docs/sources/k6/v0.53.x/testing-guides/api-load-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,13 @@ import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';
const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
client.load(null, 'quickpizza.proto');
export default () => {
client.connect('grpcbin.test.k6.io:9001');
client.connect('grpc-quickpizza.grafana.com:443');
const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
const data = { ingredients: ['Tomatoes', 'Cheese'], dough: 'Thin' };
const response = client.invoke('quickpizza.GRPC/RatePizza', data);
check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This example shows a way to use the [ServiceDisruptor](https://grafana.com/docs/

The complete [source code](#source-code) is at the end of this document. The next sections examine the code in detail.

The example uses [grpcpbin](https://grpcbin.test.k6.io), a simple request/response application that offers endpoints for testing different gRPC requests.
The example uses [grpcpbin](https://github.com/moul/grpcbin), a simple request/response application that offers endpoints for testing different gRPC requests.

The test requires `grpcpbin` to be deployed in a cluster in the namespace `grpcbin` and exposed with an external IP. The IP address is expected in the environment variable `GRPC_HOST`.

Expand Down
1 change: 0 additions & 1 deletion docs/sources/k6/v0.54.x/get-started/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ These resources help you write and run k6 tests in a safe environment and explor
If you need a place to learn k6 and test your scripts, you can use these playground/demo applications:

- [test-api.k6.io](https://test-api.k6.io/). A simple REST and WebSocket web application. [grafana/test-api.k6.io](https://github.com/grafana/test-api.k6.io)
- [grpcbin.test.k6.io](https://grpcbin.test.k6.io/). A simple gRPC Request & Response Service. [grafana/k6-grpcbin](https://github.com/grafana/k6-grpcbin)
- [grafana/quickpizza](https://github.com/grafana/quickpizza). A simple demo web application.
- [grafana/httpbin](https://github.com/grafana/httpbin). A simple HTTP Request & Response Service.

Expand Down
8 changes: 4 additions & 4 deletions docs/sources/k6/v0.54.x/javascript-api/k6-net-grpc/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';

const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', {
client.connect('grpc-quickpizza.grafana.com:443', {
// plaintext: false
});

const data = { greeting: 'Bert' };
const response = client.invoke('hello.HelloService/SayHello', data);
const data = { ingredients: ['Cheese'], dough: 'Thick' };
const response = client.invoke('quickpizza.GRPC/RatePizza', data);

check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ aliases:
import grpc from 'k6/net/grpc';

const client = new grpc.Client();
// Download addsvc.proto for https://grpcbin.test.k6.io/, located at:
// https://raw.githubusercontent.com/moul/pb/master/addsvc/addsvc.proto
// Download quickpizza.proto for grpc-quickpizza.grafana.com, located at:
// https://raw.githubusercontent.com/grafana/quickpizza/refs/heads/main/proto/quickpizza.proto
// and put it in the same folder as this script.
client.load(null, 'addsvc.proto');
client.load(null, 'quickpizza.proto');

export default () => {
client.connect('grpcbin.test.k6.io:9001', { timeout: '5s' });
client.connect('grpc-quickpizza.grafana.com:443', { timeout: '5s' });

const response = client.invoke('addsvc.Add/Sum', {
a: 1,
b: 2,
const response = client.invoke('quickpizza.GRPC/RatePizza', {
ingredients: ['Tomatoes', 'Cheese'],
dough: 'Thin'
});
console.log(response.message.v); // should print 3
console.log(response.message.starsRating); // should print a number between 1-5

client.close();
};
Expand Down
Loading

0 comments on commit ce4b291

Please sign in to comment.