isle/go/daemon/network/network_it_test.go

58 lines
1.2 KiB
Go
Raw Normal View History

package network
import (
"testing"
)
func TestCreate(t *testing.T) {
var (
h = newIntegrationHarness(t)
network = h.createNetwork(t, "primus", nil)
)
2024-10-07 20:41:46 +00:00
gotCreationParams, err := LoadCreationParams(network.stateDir)
if err != nil {
2024-10-07 20:41:46 +00:00
t.Fatalf("calling LoadCreationParams: %v", err)
} else if network.creationParams != gotCreationParams {
t.Fatalf(
"expected CreationParams %+v, got %+v",
network.creationParams,
gotCreationParams,
)
}
}
2024-10-07 20:41:46 +00:00
func TestLoad(t *testing.T) {
var (
h = newIntegrationHarness(t)
network = h.createNetwork(t, "primus", &createNetworkOpts{
manualShutdown: true,
})
)
t.Log("Shutting down network")
if err := network.Shutdown(); err != nil {
t.Fatal(err)
}
t.Log("Calling Load")
loadedNetwork, err := Load(
h.ctx,
h.logger.WithNamespace("loadedNetwork"),
network.networkConfig,
getEnvBinDirPath(),
network.stateDir,
h.mkDir(t, "runtime"),
network.opts,
)
if err != nil {
t.Fatalf("Load failed: %v", err)
}
t.Cleanup(func() {
t.Log("Shutting down loadedNetwork")
if err := loadedNetwork.Shutdown(); err != nil {
t.Logf("Shutting down loadedNetwork failed: %v", err)
}
})
}