SettingsStore: Change feature_rust_crypto to default true (#12203)
* Set default crypto stack to rust * Update test for default to rust crypto * Fix labs settings tests * Fix test not working with rust crypto
This commit is contained in:
parent
f36b6035f4
commit
cb7fd5118e
6 changed files with 225 additions and 68 deletions
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
import { test, expect } from "../../element-web-test";
|
||||
import { logIntoElement } from "./utils";
|
||||
|
||||
test.describe("Migration of existing logins", () => {
|
||||
test.describe("Adoption of rust stack", () => {
|
||||
test("Test migration of existing logins when rollout is 100%", async ({
|
||||
page,
|
||||
context,
|
||||
|
@ -25,23 +25,36 @@ test.describe("Migration of existing logins", () => {
|
|||
credentials,
|
||||
homeserver,
|
||||
}, workerInfo) => {
|
||||
test.skip(workerInfo.project.name === "Rust Crypto", "This test only works with Rust crypto.");
|
||||
test.skip(
|
||||
workerInfo.project.name === "Rust Crypto",
|
||||
"No need to test this on Rust Crypto as we override the config manually",
|
||||
);
|
||||
await page.goto("/#/login");
|
||||
|
||||
let featureRustCrypto = false;
|
||||
let stagedRolloutPercent = 0;
|
||||
|
||||
await context.route(`http://localhost:8080/config.json*`, async (route) => {
|
||||
const json = {};
|
||||
const json = {
|
||||
default_server_config: {
|
||||
"m.homeserver": {
|
||||
base_url: "https://server.invalid",
|
||||
},
|
||||
},
|
||||
};
|
||||
json["features"] = {
|
||||
feature_rust_crypto: featureRustCrypto,
|
||||
};
|
||||
json["setting_defaults"] = {
|
||||
"language": "en-GB",
|
||||
"RustCrypto.staged_rollout_percent": stagedRolloutPercent,
|
||||
};
|
||||
await route.fulfill({ json });
|
||||
});
|
||||
|
||||
// reload to ensure we read the config
|
||||
await page.reload();
|
||||
|
||||
await logIntoElement(page, homeserver, credentials);
|
||||
|
||||
await app.settings.openUserSettings("Help & About");
|
||||
|
@ -61,4 +74,80 @@ test.describe("Migration of existing logins", () => {
|
|||
await app.settings.openUserSettings("Help & About");
|
||||
await expect(page.getByText("Crypto version: Rust SDK")).toBeVisible();
|
||||
});
|
||||
|
||||
test("Test new logins by default on rust stack", async ({
|
||||
page,
|
||||
context,
|
||||
app,
|
||||
credentials,
|
||||
homeserver,
|
||||
}, workerInfo) => {
|
||||
test.skip(
|
||||
workerInfo.project.name === "Rust Crypto",
|
||||
"No need to test this on Rust Crypto as we override the config manually",
|
||||
);
|
||||
await page.goto("/#/login");
|
||||
|
||||
await context.route(`http://localhost:8080/config.json*`, async (route) => {
|
||||
const json = {
|
||||
default_server_config: {
|
||||
"m.homeserver": {
|
||||
base_url: "https://server.invalid",
|
||||
},
|
||||
},
|
||||
};
|
||||
// we only want to test the default
|
||||
json["features"] = {};
|
||||
json["setting_defaults"] = {
|
||||
language: "en-GB",
|
||||
};
|
||||
await route.fulfill({ json });
|
||||
});
|
||||
|
||||
// reload to get the new config
|
||||
await page.reload();
|
||||
await logIntoElement(page, homeserver, credentials);
|
||||
|
||||
await app.settings.openUserSettings("Help & About");
|
||||
await expect(page.getByText("Crypto version: Rust SDK")).toBeVisible();
|
||||
});
|
||||
|
||||
test("Test default is to not rollout existing logins", async ({
|
||||
page,
|
||||
context,
|
||||
app,
|
||||
credentials,
|
||||
homeserver,
|
||||
}, workerInfo) => {
|
||||
test.skip(
|
||||
workerInfo.project.name === "Rust Crypto",
|
||||
"No need to test this on Rust Crypto as we override the config manually",
|
||||
);
|
||||
|
||||
await page.goto("/#/login");
|
||||
|
||||
// In the project.name = "Legacy crypto" it will be olm crypto
|
||||
await logIntoElement(page, homeserver, credentials);
|
||||
|
||||
await app.settings.openUserSettings("Help & About");
|
||||
await expect(page.getByText("Crypto version: Olm")).toBeVisible();
|
||||
|
||||
// Now simulate a refresh with `feature_rust_crypto` enabled but ensure we use the default rollout
|
||||
await context.route(`http://localhost:8080/config.json*`, async (route) => {
|
||||
const json = {};
|
||||
json["features"] = {
|
||||
feature_rust_crypto: true,
|
||||
};
|
||||
json["setting_defaults"] = {
|
||||
// We want to test the default so we don't set this
|
||||
// "RustCrypto.staged_rollout_percent": 0,
|
||||
};
|
||||
await route.fulfill({ json });
|
||||
});
|
||||
|
||||
await page.reload();
|
||||
|
||||
await app.settings.openUserSettings("Help & About");
|
||||
await expect(page.getByText("Crypto version: Olm")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -111,8 +111,9 @@ export const test = base.extend<
|
|||
return obj;
|
||||
}, {}),
|
||||
};
|
||||
if (cryptoBackend === "rust") {
|
||||
json.features.feature_rust_crypto = true;
|
||||
// the default is to use rust now, so set to `false` if on legacy backend
|
||||
if (cryptoBackend === "legacy") {
|
||||
json.features.feature_rust_crypto = false;
|
||||
}
|
||||
await route.fulfill({ json });
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue