Removed log file related steps and implementation

This commit is contained in:
Prarup Gurung
2023-03-14 15:05:53 +05:45
parent 5533a7382e
commit 0f9ff603bd

View File

@@ -43,197 +43,6 @@ class LoggingContext implements Context {
private $oldLogBackend = null;
private $oldLogTimezone = null;
/**
* checks for specific rows in the log file.
* order of the table has to be the same as in the log file
* empty cells in the table will not be checked!
*
* @Then /^the last lines of the log file should contain log-entries (with|containing|matching) these attributes:$/
*
* @param string $comparingMode
* @param int $ignoredLines
* @param TableNode|null $expectedLogEntries table with headings that correspond
* to the json keys in the log entry
* e.g.
* |user|app|method|message|
*
* @return void
* @throws Exception
*/
public function theLastLinesOfTheLogFileShouldContainEntriesWithTheseAttributes(
string $comparingMode,
int $ignoredLines = 0,
?TableNode $expectedLogEntries = null
):void {
// Currently we don't interact with the log file on reva or OCIS
// So skip processing this test step.
return;
}
/**
* alternative wording theLastLinesOfTheLogFileShouldContainEntriesWithTheseAttributes()
*
* @Then /^the last lines of the log file, ignoring the last (\d+) lines, should contain log-entries (with|containing|matching) these attributes:$/
*
* @param int $ignoredLines
* @param string $comparingMode
* @param TableNode $expectedLogEntries
*
* @return void
* @throws Exception
*/
public function theLastLinesOfTheLogFileIgnoringSomeShouldContainEntries(
int $ignoredLines,
string $comparingMode,
TableNode $expectedLogEntries
):void {
$this->theLastLinesOfTheLogFileShouldContainEntriesWithTheseAttributes(
$comparingMode,
$ignoredLines,
$expectedLogEntries
);
}
/**
* alternative wording theLastLinesOfTheLogFileShouldContainEntriesWithTheseAttributes()
*
* @Then /^the last lines of the log file, ignoring the last line, should contain log-entries (with|containing|matching) these attributes:$/
*
* @param string $comparingMode
* @param TableNode $expectedLogEntries
*
* @return void
* @throws Exception
*/
public function theLastLinesOfTheLogFileIgnoringLastShouldContainEntries(
string $comparingMode,
TableNode $expectedLogEntries
):void {
$this->theLastLinesOfTheLogFileShouldContainEntriesWithTheseAttributes(
$comparingMode,
1,
$expectedLogEntries
);
}
/**
* wrapper around assertLogFileContainsAtLeastOneEntryMatchingTable()
*
* @Then the log file should contain at least one entry matching each of these lines:
*
* @param TableNode $expectedLogEntries table with headings that correspond
* to the json keys in the log entry
* e.g.
* |user|app|method|message|
*
* @return void
* @throws Exception
* @see assertLogFileContainsAtLeastOneEntryMatchingTable()
*/
public function logFileShouldContainEntriesMatching(
TableNode $expectedLogEntries
):void {
$this->assertLogFileContainsAtLeastOneEntryMatchingTable(
true,
$expectedLogEntries
);
}
/**
* wrapper around assertLogFileContainsAtLeastOneEntryMatchingTable()
*
* @Then the log file should contain at least one entry matching the regular expressions in each of these lines:
*
* @param TableNode $expectedLogEntries
*
* @return void
* @throws Exception
* @see assertLogFileContainsAtLeastOneEntryMatchingTable()
*/
public function logFileShouldContainEntriesMatchingRegularExpression(
TableNode $expectedLogEntries
):void {
$this->assertLogFileContainsAtLeastOneEntryMatchingTable(
true,
$expectedLogEntries,
true
);
}
/**
* @Then the log file should not contain any entry matching the regular expressions in each of these lines:
*
* @param TableNode $expectedLogEntries
*
* @return void
* @throws Exception
*/
public function logFileShouldNotContainAnyTheEntriesMatchingTheRegularExpression(
TableNode $expectedLogEntries
):void {
$this->assertLogFileContainsAtLeastOneEntryMatchingTable(
false,
$expectedLogEntries,
true
);
}
/**
* checks that every line in the table has at least one
* corresponding line in the log file
* empty cells in the table will not be checked!
*
* @param boolean $shouldOrNot if true the table entries are expected to match
* at least one entry in the log
* if false the table entries are expected not
* to match any log in the log file
* @param TableNode $expectedLogEntries table with headings that correspond
* to the json keys in the log entry
* e.g.
* |user|app|method|message|
* @param boolean $regexCompare if true the table entries are expected
* to be regular expressions
*
* @return void
* @throws Exception
*/
private function assertLogFileContainsAtLeastOneEntryMatchingTable(
bool $shouldOrNot,
TableNode $expectedLogEntries,
bool $regexCompare = false
):void {
// Currently we don't interact with the log file on reva or OCIS
// So skip processing this test step.
return;
}
/**
* fails if there is at least one line in the log file that matches all
* given attributes
* attributes in the table that are empty will match any value in the
* corresponding attribute in the log file
*
* @Then /^the log file should not contain any log-entries (with|containing) these attributes:$/
*
* @param string $withOrContaining
* @param TableNode $logEntriesExpectedNotToExist table with headings that
* correspond to the json
* keys in the log entry
* e.g.
* |user|app|method|message|
*
* @return void
* @throws Exception
*/
public function theLogFileShouldNotContainAnyLogEntriesWithTheseAttributes(
$withOrContaining,
TableNode $logEntriesExpectedNotToExist
):void {
// Currently we don't interact with the log file on reva or OCIS
// So skip processing this test step.
return;
}
/**
* @When the owncloud log level is set to :logLevel
*