Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Test Improvements #52139

Merged
merged 3 commits into from
Jul 16, 2024
Merged

[11.x] Test Improvements #52139

merged 3 commits into from
Jul 16, 2024

Conversation

crynobone
Copy link
Member

@crynobone crynobone commented Jul 16, 2024

While GitHub Actions can install sqlite3 it still need to be added to Window PATH before we can run schema:dump on Windows environment:

 1) Illuminate\Tests\Integration\Database\Sqlite\SchemaStateTest::testSchemaDumpOnSqlite
Symfony\Component\Process\Exception\ProcessFailedException: The command "sqlite3 "${:LARAVEL_LOAD_DATABASE}" .schema" failed.

Exit Code: 1(General error)

Working directory: D:\a\framework\framework

Output:
================


Error Output:
================
'sqlite3' is not recognized as an internal or external command,
operable program or batch file.

Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
@crynobone crynobone marked this pull request as ready for review July 16, 2024 02:41
@taylorotwell taylorotwell merged commit a575fcf into 11.x Jul 16, 2024
29 checks passed
@taylorotwell taylorotwell deleted the test-improvements branch July 16, 2024 02:47
public function testSchemaDumpOnSqlite()
{
if ($this->driver !== 'sqlite') {
$this->markTestSkipped('Test requires a SQLite connection.');
}

$connection = DB::connection('sqlite');
$connection->getSchemaBuilder()->createDatabase($connection->getConfig('database'));
UserFactory::new()->create();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not equivalent to the database statements I had here previously, so now the sqlite_stat* tables aren't actually created and this test will always pass even if those tables aren't being removed from dumps correctly. I'll fix it in a new PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Our GitHub Actions doesn't test using persistent SQLite and only using :in-memory:. so DB::connection('sqlite') is not the correct usage.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know, this test specifically needs a real database file. The dump file created by the test with your changes is empty, so it's not testing anything anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants