Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrewslotin/k6-moonphase
https://github.com/andrewslotin/k6-moonphase
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/andrewslotin/k6-moonphase
- Owner: andrewslotin
- License: mit
- Created: 2022-07-07T14:34:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-08T08:16:23.000Z (over 2 years ago)
- Last Synced: 2024-06-21T13:03:23.457Z (5 months ago)
- Language: Go
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
k6-moonphase
============An extension for [k6](https://k6.io) that provides current moon phase to your test scripts.
**This project has been created in educational purposes and you should not use it in production.**
Installation
------------Use `xk6 build --with github.com/andrewslotin/k6-moonphase` to build a version of `k6` with this extension enabled.
Usage
-----`k6-moonphase` uses [Stormglass API](https://stormglass.io/) to fetch the current moon phase in the given location. To access it, you need an API key that can be obtained from Stormglass upon registration. This key has to be provided to `k6` via the `STORMGLASS_API_KEY=` environment variable.
Here is an example of how to obtain the moon phase inside of your test script:
```javascript
import moonphase from 'k6/x/moonphase';export default function () {
const moonPhase = moonphase.current(52.52437, 13.41053);
console.info(`Current moon phase is ${moonPhase.name}`)// ...
}
```Here `52.52437, 13.41053` are the latitude and the longitude of the place.