mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-06 19:08:06 +03:00
Remove ZED_CLIENT_SECRET_TOKEN
This commit is contained in:
parent
ff60d886f6
commit
b5ee7f8f2e
1
.github/workflows/randomized_tests.yml
vendored
1
.github/workflows/randomized_tests.yml
vendored
@ -14,7 +14,6 @@ env:
|
|||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
ZED_SERVER_URL: https://zed.dev
|
ZED_SERVER_URL: https://zed.dev
|
||||||
ZED_CLIENT_SECRET_TOKEN: ${{ secrets.ZED_CLIENT_SECRET_TOKEN }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
|
@ -1,67 +1,70 @@
|
|||||||
#!/usr/bin/env node --redirect-warnings=/dev/null
|
#!/usr/bin/env node --redirect-warnings=/dev/null
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require("fs");
|
||||||
const {randomBytes} = require('crypto')
|
const { randomBytes } = require("crypto");
|
||||||
const {execFileSync} = require('child_process')
|
const { execFileSync } = require("child_process");
|
||||||
const {minimizeTestPlan, buildTests, runTests} = require('./randomized-test-minimize');
|
const {
|
||||||
|
minimizeTestPlan,
|
||||||
|
buildTests,
|
||||||
|
runTests,
|
||||||
|
} = require("./randomized-test-minimize");
|
||||||
|
|
||||||
const {ZED_SERVER_URL, ZED_CLIENT_SECRET_TOKEN} = process.env
|
const { ZED_SERVER_URL } = process.env;
|
||||||
if (!ZED_SERVER_URL) throw new Error('Missing env var `ZED_SERVER_URL`')
|
if (!ZED_SERVER_URL) throw new Error("Missing env var `ZED_SERVER_URL`");
|
||||||
if (!ZED_CLIENT_SECRET_TOKEN) throw new Error('Missing env var `ZED_CLIENT_SECRET_TOKEN`')
|
|
||||||
|
|
||||||
main()
|
main();
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
buildTests()
|
buildTests();
|
||||||
|
|
||||||
const seed = randomU64();
|
const seed = randomU64();
|
||||||
const commit = execFileSync(
|
const commit = execFileSync("git", ["rev-parse", "HEAD"], {
|
||||||
'git',
|
encoding: "utf8",
|
||||||
['rev-parse', 'HEAD'],
|
}).trim();
|
||||||
{encoding: 'utf8'}
|
|
||||||
).trim()
|
|
||||||
|
|
||||||
console.log("commit:", commit)
|
console.log("commit:", commit);
|
||||||
console.log("starting seed:", seed)
|
console.log("starting seed:", seed);
|
||||||
|
|
||||||
const planPath = 'target/test-plan.json'
|
const planPath = "target/test-plan.json";
|
||||||
const minPlanPath = 'target/test-plan.min.json'
|
const minPlanPath = "target/test-plan.min.json";
|
||||||
const failingSeed = runTests({
|
const failingSeed = runTests({
|
||||||
SEED: seed,
|
SEED: seed,
|
||||||
SAVE_PLAN: planPath,
|
SAVE_PLAN: planPath,
|
||||||
ITERATIONS: 50000,
|
ITERATIONS: 50000,
|
||||||
OPERATIONS: 200,
|
OPERATIONS: 200,
|
||||||
})
|
});
|
||||||
|
|
||||||
if (!failingSeed) {
|
if (!failingSeed) {
|
||||||
console.log("tests passed")
|
console.log("tests passed");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("found failure at seed", failingSeed)
|
console.log("found failure at seed", failingSeed);
|
||||||
const minimizedSeed = minimizeTestPlan(planPath, minPlanPath)
|
const minimizedSeed = minimizeTestPlan(planPath, minPlanPath);
|
||||||
const minimizedPlan = fs.readFileSync(minPlanPath, 'utf8')
|
const minimizedPlan = fs.readFileSync(minPlanPath, "utf8");
|
||||||
|
|
||||||
console.log("minimized plan:\n", minimizedPlan)
|
console.log("minimized plan:\n", minimizedPlan);
|
||||||
|
|
||||||
const url = `${ZED_SERVER_URL}/api/randomized_test_failure`
|
const url = `${ZED_SERVER_URL}/api/randomized_test_failure`;
|
||||||
const body = {
|
const body = {
|
||||||
seed: minimizedSeed,
|
seed: minimizedSeed,
|
||||||
token: ZED_CLIENT_SECRET_TOKEN,
|
|
||||||
plan: JSON.parse(minimizedPlan),
|
plan: JSON.parse(minimizedPlan),
|
||||||
commit: commit,
|
commit: commit,
|
||||||
}
|
};
|
||||||
await fetch(url, {
|
await fetch(url, {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {"Content-Type": "application/json"},
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify(body)
|
body: JSON.stringify(body),
|
||||||
})
|
});
|
||||||
|
|
||||||
process.exit(1)
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function randomU64() {
|
function randomU64() {
|
||||||
const bytes = randomBytes(8)
|
const bytes = randomBytes(8);
|
||||||
const hexString = bytes.reduce(((string, byte) => string + byte.toString(16)), '')
|
const hexString = bytes.reduce(
|
||||||
return BigInt('0x' + hexString).toString(10)
|
(string, byte) => string + byte.toString(16),
|
||||||
|
"",
|
||||||
|
);
|
||||||
|
return BigInt("0x" + hexString).toString(10);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user