-
Notifications
You must be signed in to change notification settings - Fork 297
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
chore: uploads cleanup #3743
chore: uploads cleanup #3743
Conversation
d2133ce
to
6b03d1c
Compare
6b03d1c
to
5402e72
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #3743 +/- ##
==========================================
- Coverage 68.78% 68.66% -0.12%
==========================================
Files 345 346 +1
Lines 51917 51939 +22
==========================================
- Hits 35711 35666 -45
- Misses 13907 13970 +63
- Partials 2299 2303 +4
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
warehouse/upload_stats_test.go
Outdated
pool, err := dockertest.NewPool("") | ||
require.NoError(t, err) | ||
|
||
pgResource, err := resource.SetupPostgres(pool, t) | ||
require.NoError(t, err) | ||
|
||
t.Log("db:", pgResource.DBDsn) | ||
|
||
err = (&migrator.Migrator{ | ||
Handle: pgResource.DB, | ||
MigrationsTable: "wh_schema_migrations", | ||
}).Migrate("warehouse") | ||
require.NoError(t, err) | ||
|
||
sqlStatement, err := os.ReadFile("testdata/sql/stats_test.sql") | ||
require.NoError(t, err) | ||
|
||
_, err = pgResource.DB.Exec(string(sqlStatement)) | ||
require.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could remove some duplicated code in these tests by using a common setup function:
func setupUploadTest(t testing.TB, migrationsPath string) *sql.DB {
pool, err := dockertest.NewPool("")
require.NoError(t, err)
pgResource, err := resource.SetupPostgres(pool, t)
require.NoError(t, err)
t.Log("db:", pgResource.DBDsn)
err = (&migrator.Migrator{
Handle: pgResource.DB,
MigrationsTable: "wh_schema_migrations",
}).Migrate("warehouse")
require.NoError(t, err)
sqlStatement, err := os.ReadFile(migrationsPath)
require.NoError(t, err)
_, err = pgResource.DB.Exec(string(sqlStatement))
require.NoError(t, err)
return pgResource.DB
}
Description
Linear Ticket
Security