further effort to make test runs more robust

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2022-05-07 22:55:39 -06:00
parent 888556aa5e
commit 9a17db5f21
3 changed files with 23 additions and 8 deletions

View File

@ -519,12 +519,12 @@ delete ${iscsiName}
execClient.buildCommand(command, args),
options
);
if (response.code != 0) {
throw new Error(response);
}
driver.ctx.logger.verbose(
"TargetCLI response: " + JSON.stringify(response)
);
if (response.code != 0) {
throw response;
}
return response;
}
}

View File

@ -2203,7 +2203,7 @@ class CsiBaseDriver {
result = await filesystem.pathExists(block_path);
if (result) {
result = await GeneralUtils.retry(
10,
30,
0,
async () => {
return await filesystem.rm(block_path);
@ -2223,7 +2223,7 @@ class CsiBaseDriver {
result = await filesystem.pathExists(staging_target_path);
if (result) {
result = await GeneralUtils.retry(
10,
30,
0,
async () => {
return await filesystem.rmdir(staging_target_path);
@ -2865,7 +2865,7 @@ class CsiBaseDriver {
if (result) {
if (fs.lstatSync(target_path).isDirectory()) {
result = await GeneralUtils.retry(
10,
30,
0,
async () => {
return await filesystem.rmdir(target_path);
@ -2881,7 +2881,7 @@ class CsiBaseDriver {
);
} else {
result = await GeneralUtils.retry(
10,
30,
0,
async () => {
return await filesystem.rm([target_path]);

View File

@ -1,5 +1,6 @@
const cp = require("child_process");
const fs = require("fs");
const GeneralUtils = require("./general");
const path = require("path");
const DEFAULT_TIMEOUT = process.env.FILESYSTEM_DEFAULT_TIMEOUT || 30000;
@ -835,7 +836,21 @@ class Filesystem {
async pathExists(path) {
let result = false;
try {
fs.statSync(path);
await GeneralUtils.retry(
10,
200,
() => {
fs.statSync(path);
},
{
retryCondition: (err) => {
if (err.code == "UNKNOWN") {
return true;
}
return false;
},
}
);
result = true;
} catch (err) {
if (err.code !== "ENOENT") {