-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: client flag to not announce deals (#1051) * client flag to announce deals * fix itest * apply suggestions * test: fix announce tests * refactor: remove dead code * fix: TestCancelTransferForTransferredDealFails * fix var names * fix typo * refactor test * fix double negative * change flag names * change defaults value to false Co-authored-by: Dirk McCormick <dirkmdev@gmail.com> * fix: vacuum db after log cleanup (#1059) * vacuum db * fix syntax * vacuum at startup * log error * fix: run deal filter for offline deals (#1067) * run deal filter for offline deals * move filters to common func * fix: deal status on transfer complete (#1066) * fix: sort sealing worker list by date (#1074) Co-authored-by: LexLuthr <88259624+LexLuthr@users.noreply.github.com>
- Loading branch information
Showing
28 changed files
with
494 additions
and
226 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- +goose Up | ||
-- +goose StatementBegin | ||
ALTER TABLE Deals | ||
ADD AnnounceToIPNI BOOL; | ||
-- +goose StatementEnd | ||
|
||
-- +goose Down | ||
-- +goose StatementBegin | ||
SELECT 'down SQL query'; | ||
-- +goose StatementEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package migrations | ||
|
||
import ( | ||
"database/sql" | ||
|
||
"github.com/pressly/goose/v3" | ||
) | ||
|
||
func init() { | ||
goose.AddMigration(upSetdealsAnnounceToIPNI, downSetdealsAnnounceToIPNI) | ||
} | ||
|
||
func upSetdealsAnnounceToIPNI(tx *sql.Tx) error { | ||
_, err := tx.Exec("UPDATE Deals SET AnnounceToIPNI=?;", true) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func downSetdealsAnnounceToIPNI(tx *sql.Tx) error { | ||
// This code is executed when the migration is rolled back. | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package migrations_tests | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/filecoin-project/boost/db" | ||
"github.com/filecoin-project/boost/db/migrations" | ||
"github.com/pressly/goose/v3" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDealAnnounceToIPNI(t *testing.T) { | ||
req := require.New(t) | ||
ctx := context.Background() | ||
|
||
sqldb := db.CreateTestTmpDB(t) | ||
req.NoError(db.CreateAllBoostTables(ctx, sqldb, sqldb)) | ||
|
||
// Run migrations up to the one that adds the AnnounceToIPNI field to Deals | ||
goose.SetBaseFS(migrations.EmbedMigrations) | ||
req.NoError(goose.SetDialect("sqlite3")) | ||
req.NoError(goose.UpTo(sqldb, ".", 20230104230242)) | ||
|
||
// Generate 1 deal | ||
dealsDB := db.NewDealsDB(sqldb) | ||
deals, err := db.GenerateNDeals(1) | ||
req.NoError(err) | ||
|
||
// Insert the deals in DB | ||
err = dealsDB.Insert(ctx, &deals[0]) | ||
require.NoError(t, err) | ||
|
||
// Get deal state | ||
dealState, err := dealsDB.ByID(ctx, deals[0].DealUuid) | ||
require.NoError(t, err) | ||
require.False(t, dealState.AnnounceToIPNI) | ||
|
||
//Run migration | ||
req.NoError(goose.UpByOne(sqldb, ".")) | ||
|
||
// Check the deal state again | ||
dealState, err = dealsDB.ByID(ctx, deals[0].DealUuid) | ||
require.NoError(t, err) | ||
require.True(t, dealState.AnnounceToIPNI) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.