Revert changes to testenv and fix bmc tests
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -28,6 +28,7 @@ nodes:
|
|||||||
- default
|
- default
|
||||||
ipmi:
|
ipmi:
|
||||||
ipaddr: 10.10.10.10`)
|
ipaddr: 10.10.10.10`)
|
||||||
|
env.ImportFile(t, "share/warewulf/bmc/ipmitool.tmpl", "../../../../../lib/warewulf/bmc/ipmitool.tmpl")
|
||||||
|
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
args []string
|
args []string
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ nodes:
|
|||||||
- default
|
- default
|
||||||
ipmi:
|
ipmi:
|
||||||
ipaddr: 10.10.10.10`)
|
ipaddr: 10.10.10.10`)
|
||||||
|
env.ImportFile(t, "share/warewulf/bmc/ipmitool.tmpl", "../../../../../lib/warewulf/bmc/ipmitool.tmpl")
|
||||||
|
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
args []string
|
args []string
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ nodes:
|
|||||||
- default
|
- default
|
||||||
ipmi:
|
ipmi:
|
||||||
ipaddr: 10.10.10.10`)
|
ipaddr: 10.10.10.10`)
|
||||||
|
env.ImportFile(t, "share/warewulf/bmc/ipmitool.tmpl", "../../../../../lib/warewulf/bmc/ipmitool.tmpl")
|
||||||
|
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
args []string
|
args []string
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ nodes:
|
|||||||
- default
|
- default
|
||||||
ipmi:
|
ipmi:
|
||||||
ipaddr: 10.10.10.10`)
|
ipaddr: 10.10.10.10`)
|
||||||
|
env.ImportFile(t, "share/warewulf/bmc/ipmitool.tmpl", "../../../../../lib/warewulf/bmc/ipmitool.tmpl")
|
||||||
|
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
args []string
|
args []string
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ nodes:
|
|||||||
- default
|
- default
|
||||||
ipmi:
|
ipmi:
|
||||||
ipaddr: 10.10.10.10`)
|
ipaddr: 10.10.10.10`)
|
||||||
|
env.ImportFile(t, "share/warewulf/bmc/ipmitool.tmpl", "../../../../../lib/warewulf/bmc/ipmitool.tmpl")
|
||||||
|
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
args []string
|
args []string
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ nodes:
|
|||||||
- default
|
- default
|
||||||
ipmi:
|
ipmi:
|
||||||
ipaddr: 10.10.10.10`)
|
ipaddr: 10.10.10.10`)
|
||||||
|
env.ImportFile(t, "share/warewulf/bmc/ipmitool.tmpl", "../../../../../lib/warewulf/bmc/ipmitool.tmpl")
|
||||||
|
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
args []string
|
args []string
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ nodes:
|
|||||||
- default
|
- default
|
||||||
ipmi:
|
ipmi:
|
||||||
ipaddr: 10.10.10.10`)
|
ipaddr: 10.10.10.10`)
|
||||||
|
env.ImportFile(t, "share/warewulf/bmc/ipmitool.tmpl", "../../../../../lib/warewulf/bmc/ipmitool.tmpl")
|
||||||
|
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
args []string
|
args []string
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -17,7 +16,6 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/warewulf/warewulf/internal/pkg/node"
|
"github.com/warewulf/warewulf/internal/pkg/node"
|
||||||
"github.com/warewulf/warewulf/internal/pkg/util"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const initWarewulfConf = `WW_INTERNAL: 0`
|
const initWarewulfConf = `WW_INTERNAL: 0`
|
||||||
@@ -95,15 +93,9 @@ func New(t *testing.T) (env *TestEnv) {
|
|||||||
conf.Paths.WWChrootdir,
|
conf.Paths.WWChrootdir,
|
||||||
conf.Paths.WWProvisiondir,
|
conf.Paths.WWProvisiondir,
|
||||||
} {
|
} {
|
||||||
env.MkdirAllAbs(t, confPath)
|
env.MkdirAll(t, confPath)
|
||||||
}
|
}
|
||||||
// copy templates
|
|
||||||
_, b, _, _ := runtime.Caller(0)
|
|
||||||
basepath := filepath.Dir(b)
|
|
||||||
env.MkdirAllAbs(t, path.Join(conf.Warewulf.DataStore, "warewulf/bmc"))
|
|
||||||
assert.DirExists(t, path.Join(conf.Warewulf.DataStore, "warewulf/bmc"))
|
|
||||||
err = util.CopyFile(path.Join(basepath, "../../../lib/warewulf/bmc/ipmitool.tmpl"), path.Join(conf.Warewulf.DataStore, "warewulf/bmc/ipmitool.tmpl"))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
// node.init() has already run, so set the config path again
|
// node.init() has already run, so set the config path again
|
||||||
node.ConfigFile = env.GetPath(path.Join(Sysconfdir, "warewulf/nodes.conf"))
|
node.ConfigFile = env.GetPath(path.Join(Sysconfdir, "warewulf/nodes.conf"))
|
||||||
|
|
||||||
@@ -118,19 +110,13 @@ func (env *TestEnv) GetPath(fileName string) string {
|
|||||||
|
|
||||||
// MkdirAll creates dirName and any intermediate directories relative
|
// MkdirAll creates dirName and any intermediate directories relative
|
||||||
// to the test environment.
|
// to the test environment.
|
||||||
|
//
|
||||||
// Asserts no errors occur.
|
// Asserts no errors occur.
|
||||||
func (env *TestEnv) MkdirAll(t *testing.T, dirName string) {
|
func (env *TestEnv) MkdirAll(t *testing.T, dirName string) {
|
||||||
err := os.MkdirAll(env.GetPath(dirName), 0755)
|
err := os.MkdirAll(env.GetPath(dirName), 0755)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MkdirAllAbs creates absolute dirName and any intermediate directories
|
|
||||||
// Asserts no errors occur.
|
|
||||||
func (env *TestEnv) MkdirAllAbs(t *testing.T, dirName string) {
|
|
||||||
err := os.MkdirAll(dirName, 0755)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// WriteFile writes content to fileName, creating any necessary
|
// WriteFile writes content to fileName, creating any necessary
|
||||||
// intermediate directories relative to the test environment.
|
// intermediate directories relative to the test environment.
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user