Configure ESLint and add it to CI
Test / buildenv (push) Successful in 12s Details
Test / build (push) Successful in 3m15s Details
Test / npm_lint (push) Successful in 7s Details
Test / test_cas (push) Successful in 9s Details
Test / make_test (push) Successful in 35s Details
Test / test_change_pg_count_ec (push) Successful in 28s Details
Test / test_change_pg_size (push) Successful in 9s Details
Test / test_change_pg_count (push) Successful in 35s Details
Test / test_create_nomaxid (push) Successful in 7s Details
Test / test_etcd_fail (push) Successful in 52s Details
Test / test_add_osd (push) Successful in 2m37s Details
Test / test_interrupted_rebalance (push) Successful in 2m52s Details
Test / test_interrupted_rebalance_imm (push) Successful in 2m57s Details
Test / test_failure_domain (push) Successful in 11s Details
Test / test_interrupted_rebalance_ec (push) Successful in 2m12s Details
Test / test_minsize_1 (push) Successful in 15s Details
Test / test_snapshot (push) Successful in 29s Details
Test / test_snapshot_ec (push) Successful in 29s Details
Test / test_interrupted_rebalance_ec_imm (push) Successful in 1m46s Details
Test / test_rm (push) Successful in 14s Details
Test / test_move_reappear (push) Successful in 30s Details
Test / test_snapshot_down (push) Successful in 24s Details
Test / test_snapshot_down_ec (push) Successful in 30s Details
Test / test_splitbrain (push) Successful in 19s Details
Test / test_snapshot_chain (push) Successful in 2m19s Details
Test / test_snapshot_chain_ec (push) Successful in 3m0s Details
Test / test_rebalance_verify_imm (push) Successful in 3m20s Details
Test / test_root_node (push) Successful in 10s Details
Test / test_rebalance_verify (push) Successful in 3m50s Details
Test / test_switch_primary (push) Successful in 40s Details
Test / test_write (push) Successful in 41s Details
Test / test_write_no_same (push) Successful in 18s Details
Test / test_write_xor (push) Successful in 1m5s Details
Test / test_rebalance_verify_ec (push) Successful in 4m38s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 4m17s Details
Test / test_heal_pg_size_2 (push) Successful in 3m25s Details
Test / test_heal_ec (push) Successful in 4m46s Details
Test / test_heal_csum_32k_dmj (push) Successful in 5m38s Details
Test / test_heal_csum_32k_dj (push) Successful in 6m16s Details
Test / test_heal_csum_32k (push) Successful in 6m45s Details
Test / test_osd_tags (push) Successful in 27s Details
Test / test_heal_csum_4k_dmj (push) Successful in 7m12s Details
Test / test_enospc (push) Successful in 2m6s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m34s Details
Test / test_enospc_imm (push) Successful in 1m43s Details
Test / test_heal_csum_4k (push) Successful in 6m23s Details
Test / test_enospc_xor (push) Successful in 1m57s Details
Test / test_enospc_imm_xor (push) Successful in 1m0s Details
Test / test_scrub (push) Successful in 32s Details
Test / test_scrub_zero_osd_2 (push) Successful in 31s Details
Test / test_scrub_xor (push) Successful in 33s Details
Test / test_nfs (push) Successful in 18s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 27s Details
Test / test_scrub_ec (push) Successful in 28s Details
Test / test_scrub_pg_size_3 (push) Successful in 57s Details

master
Vitaliy Filippov 2024-04-16 02:38:32 +03:00
parent fd83fef1d9
commit 2c0801f6e4
10 changed files with 81 additions and 6 deletions

View File

@ -64,6 +64,13 @@ jobs:
# leak sanitizer sometimes crashes
- run: cd /root/vitastor/build && ASAN_OPTIONS=detect_leaks=0 make -j16 test
npm_lint:
runs-on: ubuntu-latest
needs: build
container: ${{env.TEST_IMAGE}}:${{github.sha}}
steps:
- run: cd /root/vitastor/mon && npm run lint
test_add_osd:
runs-on: ubuntu-latest
needs: build

55
mon/.eslintrc.js Normal file
View File

@ -0,0 +1,55 @@
module.exports = {
"env": {
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:node/recommended"
],
"parserOptions": {
"ecmaVersion": 2020
},
"plugins": [
],
"rules": {
"indent": [
"error",
4
],
"brace-style": [
"error",
"allman",
{ "allowSingleLine": true }
],
"linebreak-style": [
"error",
"unix"
],
"semi": [
"error",
"always"
],
"require-atomic-updates": [
"off"
],
"no-useless-escape": [
"off"
],
"no-control-regex": [
"off"
],
"no-unused-vars": [
"off"
],
"no-empty": [
"off"
],
"no-process-exit": [
"off"
],
"node/shebang": [
"off"
]
}
};

View File

@ -152,6 +152,7 @@ function parse_pg_dsl(text)
else if (rule[2] === '(')
{
rule[2] = [];
// eslint-disable-next-line no-constant-condition
while (true)
{
if (i > tokens.length-1)

View File

@ -747,6 +747,7 @@ class Mon
this.save_last_clean_running = true;
// last_clean_pgs is used to avoid extra data move when observing a series of changes in the cluster
const new_clean_pgs = { items: {} };
// eslint-disable-next-line indent
next_pool:
for (const pool_id in this.state.config.pools)
{
@ -829,6 +830,7 @@ class Mon
async become_master()
{
const state = { ...this.get_mon_state(), id: ''+this.etcd_lease_id };
// eslint-disable-next-line no-constant-condition
while (1)
{
const res = await this.etcd_call('/kv/txn', {
@ -1316,7 +1318,7 @@ class Mon
for (const k in rules)
{
if (!levels[k] || typeof rules[k] !== 'string' &&
(!rules[k] instanceof Array ||
(!(rules[k] instanceof Array) ||
rules[k].filter(s => typeof s !== 'string' && typeof s !== 'number').length > 0))
{
if (warn)

View File

@ -11,5 +11,15 @@
"dependencies": {
"sprintf-js": "^1.1.2",
"ws": "^7.2.5"
},
"devDependencies": {
"eslint": "^8.0.0",
"eslint-plugin-node": "^11.1.0"
},
"engines": {
"node": ">=12.0.0"
},
"scripts": {
"lint": "eslint *.js"
}
}

View File

@ -38,7 +38,7 @@ async function run()
const st = await fs.stat(options.device);
options.device_block_size = st.blksize;
if (st.isBlockDevice())
device_size = Number(await system("/sbin/blockdev --getsize64 "+options.device))
device_size = Number(await system("/sbin/blockdev --getsize64 "+options.device));
else
device_size = st.size;
}

View File

@ -20,7 +20,7 @@ const osd_tree = {
},
500: {
4: 3.58498,
// 8: 3.58589,
/*8: 3.58589,*/
9: 3.63869,
},
600: {

View File

@ -104,7 +104,7 @@ rm -rf $RPM_BUILD_ROOT
%make_install
. /opt/rh/rh-nodejs12/enable
cd mon
npm install
npm install --production
cd ..
mkdir -p %buildroot/usr/lib/vitastor
cp -r mon %buildroot/usr/lib/vitastor

View File

@ -101,7 +101,7 @@ Vitastor fio drivers for benchmarking.
rm -rf $RPM_BUILD_ROOT
%make_install
cd mon
npm install
npm install --production
cd ..
mkdir -p %buildroot/usr/lib/vitastor
cp -r mon %buildroot/usr/lib/vitastor

View File

@ -94,7 +94,7 @@ Vitastor fio drivers for benchmarking.
rm -rf $RPM_BUILD_ROOT
%cmake_install
cd mon
npm install
npm install --production
cd ..
mkdir -p %buildroot/usr/lib/vitastor
cp -r mon %buildroot/usr/lib/vitastor