-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(CI): improve the stability of
e2e_test
workflow (#1572)
* refactor: remove useless code in tests/e2e/config * chore(CI): refactor `e2e_test` workflow * chore(CI): rm `sleep 10` in workflows/axon-start-test * Update .github/workflows/e2e_test.yml
- Loading branch information
Showing
9 changed files
with
73 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,18 @@ | ||
import configSetting from "./config.json"; | ||
|
||
function makeRequest(method, url) { | ||
return new Promise((resolve, reject) => { | ||
const XMLHttpRequest = require("xhr2");// eslint-disable-line global-require | ||
const xhr = new XMLHttpRequest(); | ||
xhr.open(method, url); | ||
xhr.setRequestHeader("Content-type", "application/json"); | ||
xhr.send(JSON.stringify( | ||
{ | ||
id: 1, | ||
jsonrpc: "2.0", | ||
method: "eth_chainId", | ||
params: [ | ||
|
||
], | ||
}, | ||
)); | ||
xhr.onload = function load_() { | ||
if (this.status >= 200 && this.status < 300) { | ||
resolve(xhr.response); | ||
} else { | ||
reject(new Error("makeRequest fail")); | ||
} | ||
}; | ||
xhr.onerror = function error_() { | ||
// reject({ | ||
// status: this.status, | ||
// statusText: xhr.statusText, | ||
// }); | ||
reject(new Error("makeRequest fail")); | ||
}; | ||
// xhr.send(); | ||
}); | ||
} | ||
|
||
async function doAjaxThings() { | ||
const result = await makeRequest("POST", configSetting.axonRpc.url); | ||
|
||
return new Promise((resolve) => { | ||
resolve(parseInt(JSON.parse(result).result, 16)); | ||
}); | ||
} | ||
|
||
export default class Config { | ||
constructor() { | ||
this.axonRpc = { url: "", netWorkName: "", chainId: "" }; | ||
this.acount1 = ""; | ||
this.acount2 = ""; | ||
this.httpServer = ""; | ||
this.hexPrivateKey = ""; | ||
try { | ||
// eslint-disable-next-line no-console | ||
console.log(configSetting.axonRpc); | ||
this.axonRpc = configSetting.axonRpc; | ||
this.httpServer = configSetting.httpServer; | ||
this.hexPrivateKey = configSetting.hexPrivateKey; | ||
this.acount1 = configSetting.acount1; | ||
this.acount2 = configSetting.acount2; | ||
} catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.log(err); | ||
throw err; | ||
} | ||
} | ||
|
||
async initialize() { | ||
this.axonRpc.chainId = await doAjaxThings(); | ||
this.axonRpc = configSetting.axonRpc; | ||
this.httpServer = configSetting.httpServer; | ||
this.hexPrivateKey = configSetting.hexPrivateKey; | ||
this.account1 = configSetting.account1; | ||
this.account2 = configSetting.account2; | ||
} | ||
|
||
static getIns() { | ||
if (!Config.ins) { | ||
Config.ins = new Config(); | ||
} | ||
(async function init_() { | ||
await Config.ins.initialize(); | ||
}()); | ||
return Config.ins; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.