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

chore: Update module go.k6.io/k6 to v0.56.0 #1152

Closed
wants to merge 1 commit into from

Conversation

grafanarenovatebot[bot]
Copy link
Contributor

This PR contains the following updates:

Package Type Update Change
go.k6.io/k6 require minor v0.54.0 -> v0.56.0

Warning

Some dependencies could not be looked up. Check the warning logs for more information.


Release Notes

grafana/k6 (go.k6.io/k6)

v0.56.0

Compare Source

k6 v0.56.0 is here 🎉! This release includes:

  • We've merged xk6-browser into k6.
  • Many small improvements, bug fixes and internal refactors.

Breaking changes

  • browser#1541 Removes accessibility-events from a test, which is no longer a valid permission that can be granted by the latest version of Chromium/Chrome.
  • #​4093 Unexports lib/consts.FullVersion from the k6's Golang API.

New features

Merge browser code in k6 codebase #​4056

While the browser module has been stabilized, the codebase was not moved inside of k6.

As part of the stabilization this is now also merged in the k6 codebase. In the following months we would move issues from the xk6-browser repo and then archive it.

UX improvements and enhancements

  • browser#1536 Removes Headless from the user agent to prevent test traffic from being blocked.
  • browser#1553 Reduces logging noise produced by the browser module.
  • #​4093 Introduces a --json flag to a k6 version sub-command, which switches an output to a JSON format.
  • #​4140 Tags browser module metrics with a resource_type tag which can be one of these values: "Document", "Stylesheet", "Image", "Media", "Font", "Script", "TextTrack", "XHR", "Fetch", "Prefetch", "EventSource", "WebSocket", "Manifest", "SignedExchange", "Ping", "CSPViolationReport", "Preflight", "Other", or "Unknown".
  • #​4092 Populates __ENV.K6_CLOUDRUN_TEST_RUN_ID with the corresponding value for local executions streaming results to the Cloud: k6 cloud run --local-execution.

Bug fixes

  • browser#1507 Fixes the Geolocation.Accuracy field.
  • browser#1515 Fixes Sobek Object.Get(key) by returning *[]any instead of []any.
  • browser#1534 Fixes locator APIs to wait during a navigation without erroring out.
  • browser#1538 Fixes frame.title.
  • browser#1542 Fixes a panic which can occur when a frame navigates.
  • browser#1547 Fixes a panic due to events associated to stale frames.
  • browser#1552 Fixes a panic for locator.selectOption when value is an object.
  • browser#1559 Fixes a panic for page.screenshot.
  • browser#1544 Fixes a nil pointer dereference when calling evaluate or evaluateHandle with an invalid page function.
  • #​4058 Fixes the namespaced object export when default is the only one available.
  • #​4132 Returns an error when a page is null during the creation of a page.

Maintenance and internal improvements

Roadmap

Removal of deprecated k6/experimental/browser module

Since v0.52.0 we have had a non experimental version of the browser module (k6/browser). We urge you to migrate your scripts over to the non experimental browser module as we will be removing the experimental version of it in the next release (v0.57.0).

v0.55.2

Compare Source

k6 v0.55.2 is a patch release that fixes packaging issue.

There are no functional changes in k6 compared to v0.55.1.

v0.55.1

Compare Source

k6 v0.55.1 is here 🎉! This release includes:

  • Dependency updates for golang.org/x/net.

Maintenance and internal improvements

v0.55.0

Compare Source

k6 v0.55.0 is here 🎉! This release includes:

  • ⚠️ The deprecated StatsD output has been removed.
  • ⚠️ The experimental k6/experimental/tracing module has been removed.
  • 🆕 URL grouping support in the browser module.
  • 🆕 Top-level await support.
  • 🔐 Complete RSA support for k6/experimental/webcrypto.

Breaking changes

k6/experimental/tracing module removed #3855

The experimental k6/experimental/tracing module has been removed, in favor of a replacement jslib polyfill, please consult our guide on how to migrate, #3855.

StatsD output removed #3849

The StatsD output was deprecated in k6 v0.47.0 and is now removed. You could still output results to StatsD using the community xk6 extension LeonAdato/xk6-output-statsd. Thanks, @​LeonAdato for taking over the extension!

open will have a breaking change in the future.

Currently, open opens relative files based on an unusual root, similar to how require behaved before it was updated for ESM compatibility. To make k6 more consistent, open and other functions like it will start handling relative paths in the same way as imports and require.
For a more in-depth explanation, please refer to the related issue.

With this version, k6 will start emitting warnings when it detects that in the future, this will break. We recommend using import.meta.resolve() as a way to make your scripts future proof.

http.file#data now truly has the same type as the provided data #4009

Previously http.file#data was always a slice of byte ([]byte) - which was very likely a bug and a leftover from years past.

The original aim (also documented) was to have the same type as the data provided when creating the http.file object, and it is now effectively the case.

New features

Top-level await support 4007

After the initial native support for ECMAScript modules, k6 can now load those modules asynchronously which also allows await to be used in the top-level of a module. That is you can write await someFunc() directly in the top most level of a module instead of having to make an async function that you call that can than use await.

Until now, you had to wrap your code in an async function to use await in the top-level of a module. For example, the following code:

import { open } from 'k6/experimental/fs'
import csv from 'k6/experimental/csv'

let file;
let parser;
(async function () {
	file = await open('data.csv');
	parser = new csv.Parser(file);
})();

Can now be written as:

import { open } from 'k6/experimental/fs'
import csv from 'k6/experimental/csv'

const file = await open('data.csv');
const parser = new csv.Parser(file);

This should make using the increasing number of async APIs in k6 easier in the init context.

This is not allowed in case of using the CommonJS modules, only ECMAScript modules, as CommonJS modules are synchronous by definition.

Complete[^1] RSA support for k6/experimental/webcrypto #4025

This update includes support for the RSA family of algorithms, including RSA-OAEP, RSA-PSS and RSASSA-PKCS1-v1_5. You can use these algorithms with the crypto.subtle API in the same way as the other algorithms, precisely for generateKey, importKey, exportKey, encrypt, decrypt, sign, and verify operations.

By implementing RSA support, we make our WebCrypto API implementation more complete and useful for a broader range of use cases.

[^1]: Since under the hood we do fully rely on the Golang's SDK, our implementation doesn't support zero salt lengths for the RSA-PSS sign/verify operations.

Example usage
Expand to see an example of generation RSA-PSS key pair.
import { crypto } from "k6/experimental/webcrypto";

export default async function () {
  const keyPair = await crypto.subtle.generateKey(
    {
      name: "RSA-PSS",
      modulusLength: 2048,
      publicExponent: new Uint8Array([1, 0, 1]),
      hash: { name: "SHA-1" },
    },
    true,
    ["sign", "verify"]
  );

  console.log(JSON.stringify(keyPair));
}
page.on('metric) to group urls browser#371, browser#1487

Modern websites are complex and make a high number of requests to function as intended by their developers. These requests no longer serve only content for display to the end user but also retrieve insights, analytics, advertisements, and for cache-busting purposes. Such requests are usually generated dynamically and may contain frequently changing IDs, posing challenges when correlating and analyzing your k6 test results.

When load testing a website using the k6 browser module, these dynamic requests can result in a high number of similar-looking requests, making it difficult to correlate them and extract valuable insights. This can also lead to test errors, such as a "too-many-metrics" error, due to high cardinality from metrics tagged with similar but dynamically changing URLs.

This issue also affects synthetic tests. While you may not encounter the "too-many-metrics" error, you may end up with a large amount of uncorrelated metric data that cannot be tracked effectively over time.

To address this in the browser module, we have implemented page.on('metric'), which allows you to define URL patterns using regex for matching. When a match is found, the URL and name tags for the metric are replaced with the new name.

Example usage
Expand to see an example of working with `page.on('metric')`.
import { browser } from 'k6/browser';

export const options = {
  scenarios: {
    ui: {
      executor: 'shared-iterations',
      options: {
        browser: {
            type: 'chromium',
        },
      },
    },
  },
}

export default async function() {
  const page = await browser.newPage();

  // Here, we set up an event listener using page.on('metric').
  // You can call page.on('metric') multiple times, and each callback function
  // will be executed in the order that page.on was called.
  page.on('metric', (metric) => {
    // Currently, metric.tag is the only available method on the metric object.
    // It enables matching on the URL tag using a specified regex pattern.
    // You can call metric.tag multiple times within the callback function.
    metric.tag({
      // This is the new name assigned to any metric that matches the defined
      // URL pattern below.
      name: 'test',
      // Provide one or more match patterns here. Any metrics that match a pattern
      // will use the new name specified above.
      matches: [
        // Each match pattern can include a URL and an optional method.
        // When a method is specified, the metric must match both the URL pattern
        // and the method. If no method is provided, the pattern will match all
        // HTTP methods.
        {url: /^https:\/\/test\.k6\.io\/\?q=[0-9a-z]+$/, method: 'GET'},
      ]
    });
  });

  try {
    // The following lines are for demonstration purposes.
    // Visiting URLs with different query parameters (q) to illustrate matching.
    await page.goto('https://test.k6.io/?q=abc123');
    await page.goto('https://test.k6.io/?q=def456');
  } finally {
    // Ensure the page is closed after testing.
    await page.close();
  }
}
ControlOrMeta support in the keyboard browser#1457

This approach enables tests to be written for all platforms, accommodating either Control or Meta for keyboard actions. For example, Control+click on Windows and Meta+clickon Mac to open a link in a new window.

Example usage
Expand to see an example usage of `ControlOrMeta`
  await page.keyboard.down('ControlOrMeta');

  // Open the link in a new tab.
  // Wait for the new page to be created.
  const browserContext = browser.context();
  const [newTab] = await Promise.all([
    browserContext.waitForEvent('page'),
    await page.locator('a[href="/my_messages.php"]').click()
  ]);

  await page.keyboard.up('ControlOrMeta');

UX improvements and enhancements

  • browser#1462 Enhances waitForSelector error message to better reflect why a selector doesn't resolve to an element.
  • #​4028 Adds support of SigV4 signing for the experimental-prometheus-rw output. This allows users to authenticate with AWS services that require SigV4 signing. Thanks, @​obanby for the contribution!
  • #​4026 Allows setting of service.name from the OTEL_SERVICE_NAME environment variable for the experimental-opentelemetry output. This aligns better with standard OTEL practices. Thanks, @​TimotejKovacka for the contribution!
  • browser#1426 Instruments page.waitForTimeout with tracing which will allow it to be displayed in the timeline.

Bug fixes

  • browser#1452 Fixes a possible deadlock when working with page.on.
  • browser#1469 Fixes locator.waitFor so it waits between navigations and doesn't throw an error.
  • browser#1488, browser#1493 Fixes memory leaks.
  • #​4017 Fixes a bug where k6 would not stop when a test was aborted right after an await statement.

Maintenance and internal improvements


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

@grafanarenovatebot grafanarenovatebot bot requested a review from a team as a code owner January 21, 2025 16:22
@grafanarenovatebot
Copy link
Contributor Author

ℹ Artifact update notice

File name: xk6/sm/go.mod

In order to perform the update(s) described in the table above, Renovate ran the go get command, which resulted in the following additional change(s):

  • 5 additional dependencies were updated

Details:

Package Change
github.com/fatih/color v1.17.0 -> v1.18.0
github.com/grafana/sobek v0.0.0-20240829081756-447e8c611945 -> v0.0.0-20241024150027-d91f02b05e9b
golang.org/x/time v0.6.0 -> v0.8.0
google.golang.org/grpc v1.65.0 -> v1.67.1
google.golang.org/protobuf v1.34.2 -> v1.35.1

@grafanarenovatebot grafanarenovatebot bot force-pushed the grafanarenovatebot/go.k6.io-k6-0.x branch 9 times, most recently from f3a7330 to b6e34c6 Compare January 29, 2025 00:34
@grafanarenovatebot grafanarenovatebot bot force-pushed the grafanarenovatebot/go.k6.io-k6-0.x branch from b6e34c6 to acad777 Compare January 29, 2025 04:21
@grafanarenovatebot grafanarenovatebot bot deleted the grafanarenovatebot/go.k6.io-k6-0.x branch January 29, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants