fix: test: TestForkPreMigration hanging when env-var is set (#11838)

* Unset env-var for TestForkPreMigration

Unset LOTUS_DISABLE_PRE_MIGRATIONS env-var for TestForkPreMigration test, so it does not hang

* Err-check to make lint happy

Err-check to make lint happy
This commit is contained in:
Phi-rjan 2024-04-05 10:37:58 +02:00 committed by GitHub
parent 37c24bba4d
commit 385fb7a054
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -375,6 +375,20 @@ func testForkRefuseCall(t *testing.T, nullsBefore, nullsAfter int) {
} }
func TestForkPreMigration(t *testing.T) { func TestForkPreMigration(t *testing.T) {
// Backup the original value of the DISABLE_PRE_MIGRATIONS environment variable
originalValue, _ := os.LookupEnv("LOTUS_DISABLE_PRE_MIGRATIONS")
// Unset the DISABLE_PRE_MIGRATIONS environment variable for the test
if err := os.Unsetenv("LOTUS_DISABLE_PRE_MIGRATIONS"); err != nil {
t.Fatalf("failed to unset LOTUS_DISABLE_PRE_MIGRATIONS: %v", err)
}
// Restore the original DISABLE_PRE_MIGRATIONS environment variable at the end of the test
defer func() {
if err := os.Setenv("LOTUS_DISABLE_PRE_MIGRATIONS", originalValue); err != nil {
t.Fatalf("failed to restore LOTUS_DISABLE_PRE_MIGRATIONS: %v", err)
}
}()
//stm: @CHAIN_GEN_NEXT_TIPSET_001, //stm: @CHAIN_GEN_NEXT_TIPSET_001,
//stm: @CHAIN_STATE_RESOLVE_TO_KEY_ADDR_001, @CHAIN_STATE_SET_VM_CONSTRUCTOR_001 //stm: @CHAIN_STATE_RESOLVE_TO_KEY_ADDR_001, @CHAIN_STATE_SET_VM_CONSTRUCTOR_001
logging.SetAllLoggers(logging.LevelInfo) logging.SetAllLoggers(logging.LevelInfo)