Skip to content

Commit

Permalink
Update missing flag in storage/posix test.
Browse files Browse the repository at this point in the history
The storageNewItrP() permissions test was running twice with the errorOnMissing flag set to false. Fix by setting to true for one test.

Also update the comments to be clearer about what the tests are doing and fix minor formatting.
  • Loading branch information
dwsteele committed Dec 7, 2022
1 parent 81d84ab commit 1345caa
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/src/module/storage/posixTest.c
Expand Up @@ -356,9 +356,12 @@ testRun(void)
TEST_RESULT_PTR(storageNewItrP(storageTest, STRDEF(BOGUS_STR), .nullOnMissing = true), NULL, "ignore missing dir");

#ifdef TEST_CONTAINER_REQUIRED
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("error on permission denied, regardless of errorOnMissing setting");

TEST_ERROR_FMT(
storageNewItrP(storageTest, pathNoPerm), PathOpenError, STORAGE_ERROR_LIST_INFO ": [13] Permission denied",
strZ(pathNoPerm));
storageNewItrP(storageTest, pathNoPerm, .errorOnMissing = true), PathOpenError,
STORAGE_ERROR_LIST_INFO ": [13] Permission denied", strZ(pathNoPerm));

// Should still error even when ignore missing
TEST_ERROR_FMT(
Expand Down Expand Up @@ -516,16 +519,16 @@ testRun(void)

#ifdef TEST_CONTAINER_REQUIRED
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("error on missing, regardless of errorOnMissing setting");
TEST_TITLE("error on permission denied, regardless of errorOnMissing setting");

TEST_ERROR_FMT(
storageListP(storageTest, pathNoPerm, .errorOnMissing = true), PathOpenError,
STORAGE_ERROR_LIST_INFO ": [13] Permission denied", strZ(pathNoPerm));

// Should still error even when ignore missing
TEST_ERROR_FMT(
storageListP(storageTest, pathNoPerm), PathOpenError,
STORAGE_ERROR_LIST_INFO ": [13] Permission denied", strZ(pathNoPerm));
storageListP(storageTest, pathNoPerm), PathOpenError, STORAGE_ERROR_LIST_INFO ": [13] Permission denied",
strZ(pathNoPerm));
#endif // TEST_CONTAINER_REQUIRED

// -------------------------------------------------------------------------------------------------------------------------
Expand Down

1 comment on commit 1345caa

@jreidthompson
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Not sure why I posted .errorOnMissing = false in the email, I have .errorOnMissing = true in my script.

Please sign in to comment.