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), execClient.buildCommand(command, args),
options options
); );
if (response.code != 0) {
throw new Error(response);
}
driver.ctx.logger.verbose( driver.ctx.logger.verbose(
"TargetCLI response: " + JSON.stringify(response) "TargetCLI response: " + JSON.stringify(response)
); );
if (response.code != 0) {
throw response;
}
return response; return response;
} }
} }

View File

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

View File

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