Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
227 additions
and
67 deletions.
There are no files selected for viewing
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,71 @@ | ||
package longtests | ||
|
||
import ( | ||
"fmt" | ||
"github.com/FactomProject/factomd/state" | ||
. "github.com/FactomProject/factomd/testHelper" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestFastBootSaveAndRestore(t *testing.T) { | ||
var saveRate = 4 | ||
var state0 *state.State | ||
var fastBootFile string | ||
|
||
startSim := func(nodes string, maxHeight int) { | ||
state0 = SetupSim( | ||
nodes, | ||
map[string]string{"--debuglog": ".", "--fastsaverate": fmt.Sprintf("%v", saveRate) }, | ||
maxHeight, | ||
0, | ||
0, | ||
t, | ||
) | ||
} | ||
|
||
stopSim := func() { | ||
WaitForAllNodes(state0) | ||
ShutDownEverything(t) | ||
state0 = nil | ||
} | ||
|
||
t.Run("after restart node should catch up", func(t *testing.T) { | ||
if RanSimTest { | ||
return | ||
} | ||
|
||
startSim("LF", 200) | ||
StopNode(1,'F') | ||
WaitBlocks(state0, 5) | ||
StartNode(1,'F') | ||
stopSim() | ||
}) | ||
|
||
// FIXME: | ||
// this test currently fails which either means: | ||
// it can reproduce the issue w/ fastboot | ||
// or | ||
// we broke something else shoe-horning in the ability to start/stop a sim | ||
t.Run("run sim to create fastboot", func(t *testing.T) { | ||
if RanSimTest { | ||
return | ||
} | ||
|
||
startSim("LF", 20) | ||
WaitForBlock(state0, saveRate*2+2) | ||
StopNode(1, 'F') | ||
|
||
t.Run("reload follower with fastboot", func(t *testing.T) { | ||
fastBootFile = state.NetworkIDToFilename(state0.Network, state0.FastBootLocation) | ||
assert.FileExists(t, fastBootFile) | ||
|
||
s := GetNode(1).State | ||
err := s.StateSaverStruct.LoadDBStateListFromFile(s.DBStates, fastBootFile) | ||
assert.Nil(t, err) | ||
}) | ||
|
||
StartNode(1, 'F') | ||
stopSim() | ||
}) | ||
} |
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,2 @@ | ||
// Package longtests contains simulation tests that may take longer than 10 min | ||
package longtests |
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.