open-nomad/client/pluginmanager/csimanager/instance_test.go
Danielle Lancashire 1a10433b97 csi: Add VolumeManager (#6920)
This changeset is some pre-requisite boilerplate that is required for
introducing CSI volume management for client nodes.

It extracts out fingerprinting logic from the csi instance manager.
This change is to facilitate reusing the csimanager to also manage the
node-local CSI functionality, as it is the easiest place for us to
guaruntee health checking and to provide additional visibility into the
running operations through the fingerprinter mechanism and goroutine.

It also introduces the VolumeMounter interface that will be used to
manage staging/publishing unstaging/unpublishing of volumes on the host.
2020-03-23 13:58:29 -04:00

31 lines
635 B
Go

package csimanager
import (
"testing"
"github.com/hashicorp/nomad/client/dynamicplugins"
"github.com/hashicorp/nomad/helper/testlog"
"github.com/hashicorp/nomad/plugins/csi/fake"
)
func setupTestNodeInstanceManager(t *testing.T) (*fake.Client, *instanceManager) {
tp := &fake.Client{}
logger := testlog.HCLogger(t)
pinfo := &dynamicplugins.PluginInfo{
Name: "test-plugin",
}
return tp, &instanceManager{
logger: logger,
info: pinfo,
client: tp,
fp: &pluginFingerprinter{
logger: logger.Named("fingerprinter"),
info: pinfo,
client: tp,
fingerprintNode: true,
},
}
}