mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
test: move NUMA platform scan out of testing global (#23289)
The `testing.go` test helpers file for the driver manager initializes the NUMA scan as a package-global variable. This causes it to be pulled in even in production builds, so even running commands like `nomad version` will cause the NUMA scan to happen. Move the scan into the test helper setup.
This commit is contained in:
@@ -21,20 +21,19 @@ import (
|
||||
)
|
||||
|
||||
type testManager struct {
|
||||
logger log.Logger
|
||||
loader loader.PluginCatalog
|
||||
logger log.Logger
|
||||
loader loader.PluginCatalog
|
||||
topology *numalib.Topology
|
||||
}
|
||||
|
||||
var (
|
||||
topology = numalib.Scan(numalib.PlatformScanners())
|
||||
)
|
||||
|
||||
func TestDriverManager(t *testing.T) Manager {
|
||||
topology := numalib.Scan(numalib.PlatformScanners())
|
||||
logger := testlog.HCLogger(t).Named("driver_mgr")
|
||||
pluginLoader := catalog.TestPluginLoader(t)
|
||||
return &testManager{
|
||||
logger: logger,
|
||||
loader: singleton.NewSingletonLoader(logger, pluginLoader),
|
||||
logger: logger,
|
||||
loader: singleton.NewSingletonLoader(logger, pluginLoader),
|
||||
topology: topology,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +44,7 @@ func (m *testManager) PluginType() string { return base.PluginTypeDriver }
|
||||
func (m *testManager) Dispense(driver string) (drivers.DriverPlugin, error) {
|
||||
baseConfig := &base.AgentConfig{
|
||||
Driver: &base.ClientDriverConfig{
|
||||
Topology: topology,
|
||||
Topology: m.topology,
|
||||
},
|
||||
}
|
||||
instance, err := m.loader.Dispense(driver, base.PluginTypeDriver, baseConfig, m.logger)
|
||||
|
||||
Reference in New Issue
Block a user