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

Remote Runner / PostMessge api #456

Merged
merged 67 commits into from
Dec 17, 2024

Conversation

flashdesignory
Copy link
Contributor

@flashdesignory flashdesignory commented Nov 19, 2024

This pr introduces Remote Runner workloads.
Workloads that are local OR that point to a remote url (when running Speedometer locally), can communicate and run their own tests via PostMessage.

Basic flow:

  1. SuiteRunner loads the iframe of the local or remote workload.
  2. SuiteRunner waits for the "app-ready" message from the workload.
  3. Workload sends "app-ready" message, once its able to listen and receive a command to start the tests.
  4. SuiteRunner sends the "benchmark-suite" command to start the testing (with an optional suite name).
  5. Workload runs through the test suite and collects performance metrics.
  6. After each completed test step it sends a "step-complete" message, to update progress in speedometer.
  7. With the "suite-complete" message, the workload sends the metrics along.
  8. Speedometer receives metrics.

image

Notes

  • TestRunner and TestInvoker files are installed as dependencies in the news-site-next workload, to ensure they stay synced with updates.

@camillobruni
Copy link
Contributor

Still looking good from my side.

resources/shared/params.mjs Outdated Show resolved Hide resolved
*
* A collection of test suites for a single workload.
*/
export class BenchmarkSuitesManager {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this? It doesn't seem like we're gonna have more than one suite per document?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a reason for this.
Each workload has a 'default' suite, the one that runs by default in Speedometer.

This setup allows for one workload to have multiple suites. one default and let's say an experimental one.

It lets us reuse the same workload, with different suites to run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as discussed, using a 'suites' object now.

import { HashRouter as Router, Routes, Route } from "react-router-dom";
import Page from "@/partials/page/page";
import Head from "next/head";
import { DataContextProvider } from "@/context/data-context";
import { connectToBenchmark } from "speedometer-utils/workload-testing-utils.mjs";
import { getBenchmarkSuitesManager } from "@/workload-test.mjs";
Copy link
Member

Choose a reason for hiding this comment

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

So a bunch of tests are all going to have their own getBenchmarkSuitesManager?
That would make grep'ing harder. Why not name this after each suite?
e.g. import { NewsNextSuite } from "@/workload-test.mjs";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A workload can have multiple suites, but we could name it after the workload.
What's the benefit of renaming it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with the mentioned suites object, which is exported as default, we could easily rename the import if that's desired.

resources/suite-runner.mjs Outdated Show resolved Hide resolved
resources/suite-runner.mjs Outdated Show resolved Hide resolved
resources/tests.mjs Outdated Show resolved Hide resolved
@flashdesignory flashdesignory requested a review from rniwa December 17, 2024 14:54

async runAndRecord(params, suite, test, callback) {
const testRunner = new TestRunner(null, null, params, suite, test, callback);
const result = await testRunner.runTest();
Copy link
Member

Choose a reason for hiding this comment

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

Do we need an explicit await here? Can't we just return the result of testRunner.runTest()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, since the RAFTestInvoker has this line:

const result = await this._reportCallback();

@flashdesignory flashdesignory merged commit f7c3a70 into WebKit:main Dec 17, 2024
4 checks passed
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.

5 participants