8000 disable auto switch for monero connection test by woodser · Pull Request #320 · haveno-dex/haveno-ts · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

disable auto switch for monero connection test #320

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

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/HavenoClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,10 @@ test("Can manage Monero daemon connections (CI)", async () => {
// start user3
user3 = await initHaveno();

// disable auto switch for tests
assert.equal(true, await user3.getAutoSwitch());
await user3.setAutoSwitch(false);

// test default connections
const monerodUrl1 = "http://127.0.0.1:" + getNetworkStartPort() + "8081"; // TODO: (woodser): move to config
let connections: UrlConnection[] = await user3.getMoneroConnections();
Expand Down Expand Up @@ -894,7 +898,7 @@ test("Can manage Monero daemon connections (CI)", async () => {
// - user1-daemon-local must be running and own its monerod process (so it can be stopped)
test("Can start and stop a local Monero node (CI)", async() => {

// expect error stopping local node
// expect error stopping stopped local node
try {
await user1.stopMoneroNode();
HavenoUtils.log(1, "Running local Monero node stopped");
Expand All @@ -907,8 +911,7 @@ test("Can start and stop a local Monero node (CI)", async() => {
}
}

let isMoneroNodeOnline = await user1.isMoneroNodeOnline();
if (isMoneroNodeOnline) {
if (await user1.isMoneroNodeOnline()) {
HavenoUtils.log(0, "Warning: local Monero node is already running, skipping start and stop local Monero node tests");

// expect error due to existing running node
Expand Down Expand Up @@ -940,8 +943,7 @@ test("Can start and stop a local Monero node (CI)", async() => {
settings.setBlockchainPath(dataDir);
settings.setStartupFlagsList(["--log-file", logFile, "--no-zmq"]);
await user1.startMoneroNode(settings);
isMoneroNodeOnline = await user1.isMoneroNodeOnline();
assert(isMoneroNodeOnline);
assert(await user1.isMoneroNodeOnline());

// expect settings are updated
const settingsAfter = await user1.getMoneroNodeSettings();
Expand All @@ -963,16 +965,19 @@ test("Can start and stop a local Monero node (CI)", async() => {

// expect stopped node
await user1.stopMoneroNode();
isMoneroNodeOnline = await user1.isMoneroNodeOnline();
assert(!isMoneroNodeOnline);
assert(!(await user1.isMoneroNodeOnline()));
try {
daemon = await moneroTs.connectToDaemonRpc(TestConfig.monerod.url);
height = await daemon.getHeight();
console.log("GOT HEIGHT: " + height);
throw new Error("should have thrown");
} catch (err: any) {
if (err.message !== "RequestError: Error: connect ECONNREFUSED 127.0.0.1:28081") throw new Error("Unexpected error: " + err.message);
if (err.message.indexOf("connect ECONNREFUSED 127.0.0.1:28081") <= 0) throw new Error("Unexpected error: " + err.message);
}

// start local node again
await user1.startMoneroNode(settings);
assert(await user1.isMoneroNodeOnline());
}
});

Expand Down
Loading
0