Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gRPC testing guide #1846

Merged
merged 9 commits into from
Jan 29, 2025
Merged

Add gRPC testing guide #1846

merged 9 commits into from
Jan 29, 2025

Conversation

heitortsergent
Copy link
Collaborator

@heitortsergent heitortsergent commented Jan 28, 2025

What?

Migrate the Performance testing gRPC services to the Testing guides section.

Checklist

  • I have used a meaningful title for the PR.
  • I have described the changes I've made in the "What?" section above.
  • I have performed a self-review of my changes.
  • I have run the npm start command locally and verified that the changes look good.
  • I have made my changes in the docs/sources/k6/next folder of the documentation.
  • I have reflected my changes in the docs/sources/k6/v{most_recent_release} folder of the documentation.
  • I have reflected my changes in the relevant folders of the two previous k6 versions of the documentation (if still applicable to previous versions).

Related PR(s)/Issue(s)

@heitortsergent heitortsergent marked this pull request as ready for review January 28, 2025 18:58
@heitortsergent heitortsergent requested a review from a team as a code owner January 28, 2025 18:58
@heitortsergent heitortsergent requested review from mstoykov and inancgumus and removed request for a team January 28, 2025 18:58
@heitortsergent heitortsergent self-assigned this Jan 28, 2025
Copy link
Member

@inancgumus inancgumus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful write-up ❤️ Added some suggestions. Feel free to skip them!

Comment on lines +203 to +204
- [k6 gRPC Module API](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/)
- [k6 QuickPizza: A demo service for gRPC](grpc-quickpizza.grafana.com:443)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With dots:

Suggested change
- [k6 gRPC Module API](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/)
- [k6 QuickPizza: A demo service for gRPC](grpc-quickpizza.grafana.com:443)
- [k6 gRPC Module API](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-net-grpc/).
- [k6 QuickPizza: A demo service for gRPC](grpc-quickpizza.grafana.com:443).


### Create the test

The gRPC module is a separate module, available from your test script as `k6/net/grpc`. Before you can use it, you first have to create an instance of the client. Instantiating the client, as well as the `.load` operation, is only available during test initialization, that is, directly in the global scope.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we say ".load operation", but below, we say ".load() function". Should we keep them consistent, like .load() function?

I also wonder if using a dot prefix is a common practice in our docs. I'd omit the dot for simplicity (i.e., load() function). Or, it can be Client.load() if we want to keep it verbose and explicit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I think we can just refer to it as load() function.

const client = new grpc.Client();
```

Next, load a `.proto` definition applicable for the system under test. For the purpose of this article, you can use [QuickPizza](grpc-quickpizza.grafana.com:443). The `.load()` function takes two arguments, the first one being an array of paths to search for proto files, and the second being the name of the file to load.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clicking on the QuickPizza link won't work for every user. Should we add a notice?

Co-authored-by: İnanç Gümüş <[email protected]>

### Create the test

The gRPC module is a separate module, available from your test script as `k6/net/grpc`. Before you can use it, you first have to create an instance of the client. Instantiating the client, as well as the `.load` operation, is only available during test initialization, that is, directly in the global scope.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I think we can just refer to it as load() function.

@heitortsergent heitortsergent merged commit ced08f0 into main Jan 29, 2025
5 checks passed
@heitortsergent heitortsergent deleted the hts/add-grpc-guide branch January 29, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants