client: Remove test dependency on client/driver
This commit is contained in:
parent
d582ea1d8b
commit
dbd82e1af4
|
@ -12,7 +12,6 @@ import (
|
|||
memdb "github.com/hashicorp/go-memdb"
|
||||
"github.com/hashicorp/nomad/client/config"
|
||||
consulApi "github.com/hashicorp/nomad/client/consul"
|
||||
"github.com/hashicorp/nomad/client/driver"
|
||||
cstructs "github.com/hashicorp/nomad/client/structs"
|
||||
"github.com/hashicorp/nomad/command/agent/consul"
|
||||
"github.com/hashicorp/nomad/helper/testlog"
|
||||
|
@ -170,8 +169,8 @@ func TestClient_Fingerprint_Periodic(t *testing.T) {
|
|||
|
||||
c1, cleanup := TestClient(t, func(c *config.Config) {
|
||||
c.Options = map[string]string{
|
||||
driver.ShutdownPeriodicAfter: "true",
|
||||
driver.ShutdownPeriodicDuration: "1",
|
||||
"test.shutdown_periodic_after": "true",
|
||||
"test.shutdown_periodic_duration": "1",
|
||||
}
|
||||
})
|
||||
defer cleanup()
|
||||
|
|
|
@ -22,15 +22,15 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// ShutdownPeriodicAfter is a config key that can be used during tests to
|
||||
// shutdownPeriodicAfter is a config key that can be used during tests to
|
||||
// "stop" a previously-functioning driver, allowing for testing of periodic
|
||||
// drivers and fingerprinters
|
||||
ShutdownPeriodicAfter = "test.shutdown_periodic_after"
|
||||
shutdownPeriodicAfter = "test.shutdown_periodic_after"
|
||||
|
||||
// ShutdownPeriodicDuration is a config option that can be used during tests
|
||||
// shutdownPeriodicDuration is a config option that can be used during tests
|
||||
// to "stop" a previously functioning driver after the specified duration
|
||||
// (specified in seconds) for testing of periodic drivers and fingerprinters.
|
||||
ShutdownPeriodicDuration = "test.shutdown_periodic_duration"
|
||||
shutdownPeriodicDuration = "test.shutdown_periodic_duration"
|
||||
|
||||
mockDriverName = "driver.mock_driver"
|
||||
)
|
||||
|
@ -109,8 +109,8 @@ func NewMockDriver(ctx *DriverContext) Driver {
|
|||
|
||||
// if the shutdown configuration options are set, start the timer here.
|
||||
// This config option defaults to false
|
||||
if ctx.config != nil && ctx.config.ReadBoolDefault(ShutdownPeriodicAfter, false) {
|
||||
duration, err := ctx.config.ReadInt(ShutdownPeriodicDuration)
|
||||
if ctx.config != nil && ctx.config.ReadBoolDefault(shutdownPeriodicAfter, false) {
|
||||
duration, err := ctx.config.ReadInt(shutdownPeriodicDuration)
|
||||
if err != nil {
|
||||
errMsg := fmt.Sprintf("unable to read config option for shutdown_periodic_duration %v, got err %s", duration, err.Error())
|
||||
panic(errMsg)
|
||||
|
|
Loading…
Reference in a new issue