isle/go/daemon/network/network_it_test.go
2024-10-07 22:41:46 +02:00

58 lines
1.2 KiB
Go

package network
import (
"testing"
)
func TestCreate(t *testing.T) {
var (
h = newIntegrationHarness(t)
network = h.createNetwork(t, "primus", nil)
)
gotCreationParams, err := LoadCreationParams(network.stateDir)
if err != nil {
t.Fatalf("calling LoadCreationParams: %v", err)
} else if network.creationParams != gotCreationParams {
t.Fatalf(
"expected CreationParams %+v, got %+v",
network.creationParams,
gotCreationParams,
)
}
}
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)
}
})
}