Skip to content

Commit

Permalink
chore: 🚨 run pnpm fmt:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TDemeco committed Oct 4, 2024
1 parent 22cf3ab commit a44a169
Show file tree
Hide file tree
Showing 11 changed files with 3,340 additions and 3,340 deletions.
172 changes: 86 additions & 86 deletions test/scripts/fullNetBootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
import {
BspNetTestApi,
registerToxics,
type BspNetConfig,
type EnrichedBspApi,
type ToxicInfo
} from "../util";
import * as ShConsts from "../util/bspNet/consts";
import { runFullNet } from "../util/fullNet/helpers";

let api: EnrichedBspApi | undefined;
const fullNetConfig: BspNetConfig = {
noisy: process.env.NOISY === "1",
rocksdb: process.env.ROCKSDB === "1"
};

const CONFIG = {
bucketName: "nothingmuch-0",
localPath: "res/whatsup.jpg",
remotePath: "cat/whatsup.jpg"
};

async function bootStrapNetwork() {
await runFullNet(fullNetConfig);

if (fullNetConfig.noisy) {
// For more info on the kind of toxics you can register,
// see: https://github.com/Shopify/toxiproxy?tab=readme-ov-file#toxics
const reqToxics = [
{
type: "latency",
name: "lag-down",
stream: "upstream",
toxicity: 0.8,
attributes: {
latency: 25,
jitter: 7
}
},
{
type: "bandwidth",
name: "low-band",
// Setting as upstream simulates slow user connection
stream: "upstream",
// 50% of the time, the toxic will be applied
toxicity: 0.5,
attributes: {
// 10kbps
rate: 10
}
}
] satisfies ToxicInfo[];

await registerToxics(reqToxics);
}

api = await BspNetTestApi.create(`ws://127.0.0.1:${ShConsts.NODE_INFOS.user.port}`);

await api.file.newStorageRequest(
CONFIG.localPath,
CONFIG.remotePath,
CONFIG.bucketName,
ShConsts.DUMMY_MSP_ID
);

await api.wait.bspVolunteer();
await api.wait.bspStored();

if (fullNetConfig.noisy) {
console.log("✅ NoisyNet Bootstrap success");
} else {
console.log("✅ BSPNet Bootstrap success");
}
}

bootStrapNetwork()
.catch((e) => {
console.error("Error running bootstrap script:", e);
if (fullNetConfig.noisy) {
console.log("❌ NoisyNet Bootstrap failure");
} else {
console.log("❌ BSPNet Bootstrap failure");
}
process.exitCode = 1;
})
.finally(async () => await api?.disconnect());
import {
BspNetTestApi,
registerToxics,
type BspNetConfig,
type EnrichedBspApi,
type ToxicInfo
} from "../util";
import * as ShConsts from "../util/bspNet/consts";
import { runFullNet } from "../util/fullNet/helpers";

let api: EnrichedBspApi | undefined;
const fullNetConfig: BspNetConfig = {
noisy: process.env.NOISY === "1",
rocksdb: process.env.ROCKSDB === "1"
};

const CONFIG = {
bucketName: "nothingmuch-0",
localPath: "res/whatsup.jpg",
remotePath: "cat/whatsup.jpg"
};

async function bootStrapNetwork() {
await runFullNet(fullNetConfig);

if (fullNetConfig.noisy) {
// For more info on the kind of toxics you can register,
// see: https://github.com/Shopify/toxiproxy?tab=readme-ov-file#toxics
const reqToxics = [
{
type: "latency",
name: "lag-down",
stream: "upstream",
toxicity: 0.8,
attributes: {
latency: 25,
jitter: 7
}
},
{
type: "bandwidth",
name: "low-band",
// Setting as upstream simulates slow user connection
stream: "upstream",
// 50% of the time, the toxic will be applied
toxicity: 0.5,
attributes: {
// 10kbps
rate: 10
}
}
] satisfies ToxicInfo[];

await registerToxics(reqToxics);
}

api = await BspNetTestApi.create(`ws://127.0.0.1:${ShConsts.NODE_INFOS.user.port}`);

await api.file.newStorageRequest(
CONFIG.localPath,
CONFIG.remotePath,
CONFIG.bucketName,
ShConsts.DUMMY_MSP_ID
);

await api.wait.bspVolunteer();
await api.wait.bspStored();

if (fullNetConfig.noisy) {
console.log("✅ NoisyNet Bootstrap success");
} else {
console.log("✅ BSPNet Bootstrap success");
}
}

bootStrapNetwork()
.catch((e) => {
console.error("Error running bootstrap script:", e);
if (fullNetConfig.noisy) {
console.log("❌ NoisyNet Bootstrap failure");
} else {
console.log("❌ BSPNet Bootstrap failure");
}
process.exitCode = 1;
})
.finally(async () => await api?.disconnect());
Loading

0 comments on commit a44a169

Please sign in to comment.