1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Add storage tests for files beginning with dots.

Prevent a regression of the issue fixed in f88012ce by adding some tests.
This commit is contained in:
David Steele 2019-08-26 11:37:21 -04:00
parent 8c9df8c290
commit 22aa532be1
2 changed files with 18 additions and 8 deletions

View File

@ -194,9 +194,13 @@ sub run
utime(1111111112, 1111111112, $self->testPath() . '/sub1/test-sub1.txt');
executeTest('chmod 0640 ' . $self->testPath() . '/sub1/test-sub1.txt');
executeTest("echo 'TESTDATA_' > ". $self->testPath() . '/sub1/.test-sub1.txt');
utime(1111111112, 1111111112, $self->testPath() . '/sub1/.test-sub1.txt');
executeTest('chmod 0640 ' . $self->testPath() . '/sub1/.test-sub1.txt');
executeTest("echo 'TESTDATA__' > " . $self->testPath() . '/sub1/sub2/test-sub2.txt');
utime(1111111113, 1111111113, $self->testPath() . '/sub1/sub2/test-sub2.txt');
executeTest('chmod 0646 ' . $self->testPath() . '/sub1/test-sub1.txt');
executeTest('chmod 0646 ' . $self->testPath() . '/sub1/sub2/test-sub2.txt');
executeTest('mkfifo -m 606 ' . $self->testPath() . '/sub1/apipe');
@ -214,6 +218,9 @@ sub run
sub {$self->storageLocal()->manifest($self->testPath())},
'{. => {group => ' . $self->group() . ', mode => 0770, type => d, user => ' . $self->pgUser() . '}, ' .
'sub1 => {group => ' . $self->group() . ', mode => 0750, type => d, user => ' . $self->pgUser() . '}, ' .
'sub1/.test-sub1.txt => ' .
'{group => ' . $self->group() . ', mode => 0640, modification_time => 1111111112, size => 10, type => f, user => ' .
$self->pgUser() . '}, ' .
'sub1/apipe => {group => ' . $self->group() . ', mode => 0606, type => s, user => ' . $self->pgUser() . '}, ' .
'sub1/sub2 => {group => ' . $self->group() . ', mode => 0750, type => d, user => ' . $self->pgUser() . '}, ' .
'sub1/sub2/test => {group => ' . $self->group() . ', link_destination => ../.., type => l, user => ' .
@ -222,14 +229,14 @@ sub run
'{group => ' . $self->group() . ', mode => 0640, modification_time => 1111111111, size => 9, type => f, user => ' .
$self->pgUser() . '}, ' .
'sub1/sub2/test-sub2.txt => ' .
'{group => ' . $self->group() . ', mode => 0666, modification_time => 1111111113, size => 11, type => f, user => ' .
'{group => ' . $self->group() . ', mode => 0646, modification_time => 1111111113, size => 11, type => f, user => ' .
$self->pgUser() . '}, ' .
'sub1/test => {group => ' . $self->group() . ', link_destination => .., type => l, user => ' . $self->pgUser() . '}, ' .
'sub1/test-hardlink.txt => ' .
'{group => ' . $self->group() . ', mode => 0640, modification_time => 1111111111, size => 9, type => f, user => ' .
$self->pgUser() . '}, ' .
'sub1/test-sub1.txt => ' .
'{group => ' . $self->group() . ', mode => 0646, modification_time => 1111111112, size => 10, type => f, user => ' .
'{group => ' . $self->group() . ', mode => 0640, modification_time => 1111111112, size => 10, type => f, user => ' .
$self->pgUser() . '}, ' .
'sub2 => {group => ' . $self->group() . ', mode => 0750, type => d, user => ' . $self->pgUser() . '}, ' .
'test.txt => ' .

View File

@ -289,13 +289,16 @@ testRun(void)
TEST_RESULT_UINT(testStorageInfoListSize, 0, " no file found");
// -------------------------------------------------------------------------------------------------------------------------
storagePathCreateP(storageTest, strNew("pg"), .mode = 0766);
storagePathCreateP(storageTest, strNew("pg/.include"), .mode = 0766);
TEST_RESULT_VOID(
storageInfoListNP(storageTest, strNew("pg"), testStorageInfoListCallback, (void *)memContextCurrent()),
"empty directory");
TEST_RESULT_UINT(testStorageInfoListSize, 1, " only path returned");
TEST_RESULT_STR(strPtr(testStorageInfoList[0].name), ".", " check name");
TEST_RESULT_UINT(testStorageInfoListSize, 2, " two paths returned");
TEST_RESULT_STR(
strPtr(testStorageInfoList[0].name), strEqZ(testStorageInfoList[1].name, ".") ? ".include" : ".", " check name");
TEST_RESULT_STR(
strPtr(testStorageInfoList[1].name), strEqZ(testStorageInfoList[0].name, ".") ? ".include" : ".", " check name");
}
// *****************************************************************************************************************************
@ -323,9 +326,9 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_VOID(
storagePutNP(storageNewWriteNP(storageTest, strNew("aaa.txt")), BUFSTRDEF("aaa")), "write aaa.text");
storagePutNP(storageNewWriteNP(storageTest, strNew(".aaa.txt")), BUFSTRDEF("aaa")), "write aaa.text");
TEST_RESULT_STR(
strPtr(strLstJoin(storageListNP(storageTest, NULL), ", ")), "aaa.txt, noperm",
strPtr(strLstJoin(strLstSort(storageListNP(storageTest, NULL), sortOrderAsc), ", ")), ".aaa.txt, noperm",
"dir list");
TEST_RESULT_VOID(