本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/platform/fakes.FakePlatform类的典型用法代码示例。如果您正苦于以下问题:Golang FakePlatform类的具体用法?Golang FakePlatform怎么用?Golang FakePlatform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakePlatform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
Describe("ReleaseApplySpec", func() {
var (
platform *fakeplatform.FakePlatform
action ReleaseApplySpecAction
)
BeforeEach(func() {
platform = fakeplatform.NewFakePlatform()
action = NewReleaseApplySpec(platform)
})
It("is synchronous", func() {
Expect(action.IsAsynchronous()).To(BeFalse())
})
It("is not persistent", func() {
Expect(action.IsPersistent()).To(BeFalse())
})
It("run", func() {
err := platform.GetFs().WriteFileString("/var/vcap/micro/apply_spec.json", `{"json":["objects"]}`)
Expect(err).ToNot(HaveOccurred())
value, err := action.Run()
Expect(err).ToNot(HaveOccurred())
Expect(value).To(Equal(map[string]interface{}{"json": []interface{}{"objects"}}))
})
})
}
示例2: init
func init() {
Describe("ListDisk", func() {
var (
settingsService *fakesettings.FakeSettingsService
platform *fakeplatform.FakePlatform
logger boshlog.Logger
action ListDiskAction
)
BeforeEach(func() {
settingsService = &fakesettings.FakeSettingsService{}
platform = fakeplatform.NewFakePlatform()
logger = boshlog.NewLogger(boshlog.LevelNone)
action = NewListDisk(settingsService, platform, logger)
})
It("list disk should be synchronous", func() {
Expect(action.IsAsynchronous()).To(BeFalse())
})
It("is not persistent", func() {
Expect(action.IsPersistent()).To(BeFalse())
})
It("list disk run", func() {
platform.MountedDevicePaths = []string{"/dev/sdb", "/dev/sdc"}
settingsService.Settings.Disks = boshsettings.Disks{
Persistent: map[string]interface{}{
"volume-1": "/dev/sda",
"volume-2": "/dev/sdb",
"volume-3": "/dev/sdc",
},
}
value, err := action.Run()
Expect(err).ToNot(HaveOccurred())
values, ok := value.([]string)
Expect(ok).To(BeTrue())
Expect(values).To(ContainElement("volume-2"))
Expect(values).To(ContainElement("volume-3"))
Expect(len(values)).To(Equal(2))
})
})
}
示例3: init
func init() {
Describe("Stop", func() {
var (
jobSupervisor *fakejobsuper.FakeJobSupervisor
platform *fakeplatform.FakePlatform
settingsService *fakesettings.FakeSettingsService
logger boshlog.Logger
specService *fakeas.FakeV1Service
dualDCSupport *nimbus.DualDCSupport
action StopAction
)
BeforeEach(func() {
jobSupervisor = fakejobsuper.NewFakeJobSupervisor()
platform = fakeplatform.NewFakePlatform()
logger = boshlog.NewLogger(boshlog.LevelNone)
specService = fakeas.NewFakeV1Service()
settingsService = &fakesettings.FakeSettingsService{}
dualDCSupport = nimbus.NewDualDCSupport(
platform.GetRunner(),
platform.GetFs(),
platform.GetDirProvider(),
specService,
settingsService,
logger,
)
action = NewStop(jobSupervisor, dualDCSupport, platform)
})
It("is asynchronous", func() {
Expect(action.IsAsynchronous()).To(BeTrue())
})
It("is not persistent", func() {
Expect(action.IsPersistent()).To(BeFalse())
})
It("returns stopped", func() {
stopped, err := action.Run()
Expect(err).ToNot(HaveOccurred())
Expect(stopped).To(Equal("stopped"))
})
It("stops job supervisor services", func() {
_, err := action.Run()
Expect(err).ToNot(HaveOccurred())
Expect(jobSupervisor.Stopped).To(BeTrue())
})
})
}
示例4: init
func init() {
Describe("ApplyAction", func() {
var (
applier *fakeappl.FakeApplier
specService *fakeas.FakeV1Service
settingsService *fakesettings.FakeSettingsService
platform *fakeplatform.FakePlatform
dualDCSupport *nimbus.DualDCSupport
logger boshlog.Logger
action ApplyAction
)
BeforeEach(func() {
applier = fakeappl.NewFakeApplier()
specService = fakeas.NewFakeV1Service()
settingsService = &fakesettings.FakeSettingsService{}
platform = fakeplatform.NewFakePlatform()
logger = boshlog.NewLogger(boshlog.LevelNone)
dualDCSupport = nimbus.NewDualDCSupport(
platform.GetRunner(),
platform.GetFs(),
platform.GetDirProvider(),
specService,
settingsService,
logger,
)
action = NewApply(applier, specService, settingsService, dualDCSupport, platform)
})
It("apply should be asynchronous", func() {
Expect(action.IsAsynchronous()).To(BeTrue())
})
It("is not persistent", func() {
Expect(action.IsPersistent()).To(BeFalse())
})
Describe("Run", func() {
settings := boshsettings.Settings{AgentID: "fake-agent-id"}
BeforeEach(func() {
settingsService.Settings = settings
})
Context("when desired spec has configuration hash", func() {
currentApplySpec := boshas.V1ApplySpec{ConfigurationHash: "fake-current-config-hash"}
desiredApplySpec := boshas.V1ApplySpec{ConfigurationHash: "fake-desired-config-hash"}
populatedDesiredApplySpec := boshas.V1ApplySpec{
ConfigurationHash: "fake-populated-desired-config-hash",
}
Context("when current spec can be retrieved", func() {
BeforeEach(func() {
specService.Spec = currentApplySpec
})
It("populates dynamic networks in desired spec", func() {
_, err := action.Run(desiredApplySpec)
Expect(err).ToNot(HaveOccurred())
Expect(specService.PopulateDHCPNetworksSpec).To(Equal(desiredApplySpec))
Expect(specService.PopulateDHCPNetworksSettings).To(Equal(settings))
})
Context("when resolving dynamic networks succeeds", func() {
BeforeEach(func() {
specService.PopulateDHCPNetworksResultSpec = populatedDesiredApplySpec
})
It("runs applier with populated desired spec", func() {
_, err := action.Run(desiredApplySpec)
Expect(err).ToNot(HaveOccurred())
Expect(applier.Applied).To(BeTrue())
Expect(applier.ApplyCurrentApplySpec).To(Equal(currentApplySpec))
Expect(applier.ApplyDesiredApplySpec).To(Equal(populatedDesiredApplySpec))
})
Context("when applier succeeds applying desired spec", func() {
Context("when saving desires spec as current spec succeeds", func() {
It("returns 'applied' after setting populated desired spec as current spec", func() {
value, err := action.Run(desiredApplySpec)
Expect(err).ToNot(HaveOccurred())
Expect(value).To(Equal("applied"))
Expect(specService.Spec).To(Equal(populatedDesiredApplySpec))
})
})
Context("when saving populated desires spec as current spec fails", func() {
It("returns error because agent was not able to remember that is converged to desired spec", func() {
specService.SetErr = errors.New("fake-set-error")
_, err := action.Run(desiredApplySpec)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-set-error"))
})
})
})
Context("when applier fails applying desired spec", func() {
//.........这里部分代码省略.........
示例5:
import (
"encoding/json"
"errors"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/infrastructure"
boshlog "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/logger"
fakeplatform "github.com/cloudfoundry/bosh-agent/platform/fakes"
)
var _ = Describe("ConfigDriveSettingsSource", func() {
var (
platform *fakeplatform.FakePlatform
source *ConfigDriveSettingsSource
)
BeforeEach(func() {
diskPaths := []string{"/fake-disk-path-1", "/fake-disk-path-2"}
metadataPath := "fake-metadata-path"
settingsPath := "fake-settings-path"
platform = fakeplatform.NewFakePlatform()
logger := boshlog.NewLogger(boshlog.LevelNone)
source = NewConfigDriveSettingsSource(diskPaths, metadataPath, settingsPath, platform, logger)
})
BeforeEach(func() {
// Set up default settings and metadata
platform.SetGetFilesContentsFromDisk("/fake-disk-path-1/fake-metadata-path", []byte(`{}`), nil)
platform.SetGetFilesContentsFromDisk("/fake-disk-path-1/fake-settings-path", []byte(`{}`), nil)
示例6: init
func init() {
Describe("natsHandler", func() {
var (
settingsService *fakesettings.FakeSettingsService
client *fakeyagnats.FakeYagnats
logger boshlog.Logger
handler boshhandler.Handler
platform *fakeplatform.FakePlatform
loggerOutBuf *bytes.Buffer
loggerErrBuf *bytes.Buffer
)
BeforeEach(func() {
settingsService = &fakesettings.FakeSettingsService{
Settings: boshsettings.Settings{
AgentID: "my-agent-id",
Mbus: "nats://fake-username:[email protected]:1234",
},
}
loggerOutBuf = bytes.NewBufferString("")
loggerErrBuf = bytes.NewBufferString("")
logger = boshlog.NewWriterLogger(boshlog.LevelError, loggerOutBuf, loggerErrBuf)
client = fakeyagnats.New()
platform = fakeplatform.NewFakePlatform()
handler = NewNatsHandler(settingsService, client, logger, platform)
})
Describe("Start", func() {
It("starts", func() {
var receivedRequest boshhandler.Request
handler.Start(func(req boshhandler.Request) (resp boshhandler.Response) {
receivedRequest = req
return boshhandler.NewValueResponse("expected value")
})
defer handler.Stop()
Expect(client.ConnectedConnectionProvider()).ToNot(BeNil())
Expect(client.SubscriptionCount()).To(Equal(1))
subscriptions := client.Subscriptions("agent.my-agent-id")
Expect(len(subscriptions)).To(Equal(1))
expectedPayload := []byte(`{"method":"ping","arguments":["foo","bar"], "reply_to": "reply to me!"}`)
subscription := subscriptions[0]
subscription.Callback(&yagnats.Message{
Subject: "agent.my-agent-id",
Payload: expectedPayload,
})
Expect(receivedRequest).To(Equal(boshhandler.Request{
ReplyTo: "reply to me!",
Method: "ping",
Payload: expectedPayload,
}))
Expect(client.PublishedMessageCount()).To(Equal(1))
messages := client.PublishedMessages("reply to me!")
Expect(len(messages)).To(Equal(1))
Expect(messages[0].Payload).To(Equal([]byte(`{"value":"expected value"}`)))
})
It("cleans up ip-mac address cache for nats configured with ip address", func() {
handler.Start(func(req boshhandler.Request) (resp boshhandler.Response) {
return nil
})
defer handler.Stop()
Expect(platform.CleanedIPMacAddressCache).To(Equal("127.0.0.1"))
Expect(client.ConnectedConnectionProvider()).ToNot(BeNil())
})
It("does not try to clean up ip-mac address cache for nats configured with hostname", func() {
settingsService.Settings.Mbus = "nats://fake-username:[email protected]:1234"
handler.Start(func(req boshhandler.Request) (resp boshhandler.Response) {
return nil
})
defer handler.Stop()
Expect(platform.CleanedIPMacAddressCache).To(BeEmpty())
Expect(client.ConnectedConnectionProvider()).ToNot(BeNil())
})
It("logs error and proceeds if it fails to clean up ip-mac address cache for nats", func() {
platform.CleanIPMacAddressCacheErr = errors.New("failed to run")
handler.Start(func(req boshhandler.Request) (resp boshhandler.Response) {
return nil
})
defer handler.Stop()
Expect(platform.CleanedIPMacAddressCache).To(Equal("127.0.0.1"))
Expect(loggerErrBuf).To(ContainSubstring("ERROR - Cleaning ip-mac address cache for: 127.0.0.1"))
Expect(client.ConnectedConnectionProvider()).ToNot(BeNil())
})
It("does not respond if the response is nil", func() {
err := handler.Start(func(req boshhandler.Request) (resp boshhandler.Response) {
return nil
//.........这里部分代码省略.........
示例7:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/mbus"
"github.com/cloudfoundry/bosh-agent/micro"
fakeplatform "github.com/cloudfoundry/bosh-agent/platform/fakes"
boshdir "github.com/cloudfoundry/bosh-agent/settings/directories"
fakesettings "github.com/cloudfoundry/bosh-agent/settings/fakes"
boshlog "github.com/cloudfoundry/bosh-utils/logger"
)
var _ = Describe("HandlerProvider", func() {
var (
settingsService *fakesettings.FakeSettingsService
platform *fakeplatform.FakePlatform
dirProvider boshdir.Provider
logger boshlog.Logger
provider HandlerProvider
)
BeforeEach(func() {
settingsService = &fakesettings.FakeSettingsService{}
logger = boshlog.NewLogger(boshlog.LevelNone)
platform = fakeplatform.NewFakePlatform()
dirProvider = boshdir.NewProvider("/var/vcap")
provider = NewHandlerProvider(settingsService, logger)
})
Describe("Get", func() {
It("returns nats handler", func() {
settingsService.Settings.Mbus = "nats://lol"
示例8:
import (
fakeplatform "github.com/cloudfoundry/bosh-agent/platform/fakes"
boshsettings "github.com/cloudfoundry/bosh-agent/settings"
fakesettings "github.com/cloudfoundry/bosh-agent/settings/fakes"
boshassert "github.com/cloudfoundry/bosh-utils/assert"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/agent/action"
)
var _ = Describe("UnmountDiskAction", func() {
var (
platform *fakeplatform.FakePlatform
action UnmountDiskAction
expectedDiskSettings boshsettings.DiskSettings
)
BeforeEach(func() {
platform = fakeplatform.NewFakePlatform()
settingsService := &fakesettings.FakeSettingsService{
Settings: boshsettings.Settings{
Disks: boshsettings.Disks{
Persistent: map[string]interface{}{
"vol-123": map[string]interface{}{
"volume_id": "2",
"path": "/dev/sdf",
},
},
示例9: buildSSHAction
))
Expect(platform.SetupSSHPublicKeys["fake-user"]).To(Equal("fake-public-key"))
}
func buildSSHAction(settingsService boshsettings.Service) (*fakeplatform.FakePlatform, SSHAction) {
platform := fakeplatform.NewFakePlatform()
dirProvider := boshdirs.NewProvider("/foo")
logger := boshlog.NewLogger(boshlog.LevelNone)
action := NewSSH(settingsService, platform, dirProvider, logger)
return platform, action
}
var _ = Describe("SSHAction", func() {
var (
platform *fakeplatform.FakePlatform
settingsService boshsettings.Service
action SSHAction
)
Context("Action setup", func() {
BeforeEach(func() {
settingsService = &fakesettings.FakeSettingsService{}
platform, action = buildSSHAction(settingsService)
})
It("ssh should be synchronous", func() {
Expect(action.IsAsynchronous()).To(BeFalse())
})
It("is not persistent", func() {
Expect(action.IsPersistent()).To(BeFalse())
示例10:
"errors"
. "github.com/cloudfoundry/bosh-agent/agent/action"
"github.com/cloudfoundry/bosh-agent/platform/cert/fakes"
fakeplatform "github.com/cloudfoundry/bosh-agent/platform/fakes"
boshsettings "github.com/cloudfoundry/bosh-agent/settings"
fakesettings "github.com/cloudfoundry/bosh-agent/settings/fakes"
"github.com/cloudfoundry/bosh-utils/logger"
"path/filepath"
)
var _ = Describe("UpdateSettings", func() {
var (
action UpdateSettingsAction
certManager *fakes.FakeManager
settingsService *fakesettings.FakeSettingsService
log logger.Logger
platform *fakeplatform.FakePlatform
newUpdateSettings boshsettings.UpdateSettings
)
BeforeEach(func() {
log = logger.NewLogger(logger.LevelNone)
certManager = new(fakes.FakeManager)
settingsService = &fakesettings.FakeSettingsService{}
platform = fakeplatform.NewFakePlatform()
action = NewUpdateSettings(settingsService, platform, certManager, log)
newUpdateSettings = boshsettings.UpdateSettings{}
})
AssertActionIsAsynchronous(action)
AssertActionIsNotPersistent(action)
示例11:
"errors"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/agent/action"
fakeplatform "github.com/cloudfoundry/bosh-agent/platform/fakes"
boshsettings "github.com/cloudfoundry/bosh-agent/settings"
boshdirs "github.com/cloudfoundry/bosh-agent/settings/directories"
fakesettings "github.com/cloudfoundry/bosh-agent/settings/fakes"
)
var _ = Describe("MountDiskAction", func() {
var (
settingsService *fakesettings.FakeSettingsService
platform *fakeplatform.FakePlatform
action MountDiskAction
)
BeforeEach(func() {
settingsService = &fakesettings.FakeSettingsService{}
platform = fakeplatform.NewFakePlatform()
dirProvider := boshdirs.NewProvider("/fake-base-dir")
action = NewMountDisk(settingsService, platform, platform, dirProvider)
})
It("is asynchronous", func() {
Expect(action.IsAsynchronous()).To(BeTrue())
})
It("is not persistent", func() {
示例12:
boshsettings "github.com/cloudfoundry/bosh-agent/settings"
boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
fakelogger "github.com/cloudfoundry/bosh-agent/logger/fakes"
fakeplatform "github.com/cloudfoundry/bosh-agent/platform/fakes"
fakesettings "github.com/cloudfoundry/bosh-agent/settings/fakes"
fakeblobstore "github.com/cloudfoundry/bosh-utils/blobstore/fakes"
fakesys "github.com/cloudfoundry/bosh-utils/system/fakes"
)
var _ = Describe("SyncDNS", func() {
var (
action SyncDNS
fakeBlobstore *fakeblobstore.FakeBlobstore
fakeSettingsService *fakesettings.FakeSettingsService
fakePlatform *fakeplatform.FakePlatform
fakeFileSystem *fakesys.FakeFileSystem
logger *fakelogger.FakeLogger
)
BeforeEach(func() {
logger = &fakelogger.FakeLogger{}
fakeBlobstore = fakeblobstore.NewFakeBlobstore()
fakeSettingsService = &fakesettings.FakeSettingsService{}
fakePlatform = fakeplatform.NewFakePlatform()
fakeFileSystem = fakePlatform.GetFs().(*fakesys.FakeFileSystem)
action = NewSyncDNS(fakeBlobstore, fakeSettingsService, fakePlatform, logger)
})
AssertActionIsNotAsynchronous(action)
示例13: init
func init() {
Describe("Start", func() {
var (
jobSupervisor *fakejobsuper.FakeJobSupervisor
applier *fakeappl.FakeApplier
specService *fakeas.FakeV1Service
platform *fakeplatform.FakePlatform
settingsService *fakesettings.FakeSettingsService
logger boshlog.Logger
dualDCSupport *nimbus.DualDCSupport
action StartAction
)
BeforeEach(func() {
jobSupervisor = fakejobsuper.NewFakeJobSupervisor()
applier = fakeappl.NewFakeApplier()
specService = fakeas.NewFakeV1Service()
action = NewStart(jobSupervisor, applier, specService, dualDCSupport, platform)
platform = fakeplatform.NewFakePlatform()
logger = boshlog.NewLogger(boshlog.LevelNone)
settingsService = &fakesettings.FakeSettingsService{}
dualDCSupport = nimbus.NewDualDCSupport(
platform.GetRunner(),
platform.GetFs(),
platform.GetDirProvider(),
specService,
settingsService,
logger,
)
action = NewStart(jobSupervisor, applier, specService, dualDCSupport, platform)
})
It("is synchronous", func() {
Expect(action.IsAsynchronous()).To(BeFalse())
})
It("is not persistent", func() {
Expect(action.IsPersistent()).To(BeFalse())
})
It("returns started", func() {
started, err := action.Run()
Expect(err).ToNot(HaveOccurred())
Expect(started).To(Equal("started"))
})
It("starts monitor services", func() {
_, err := action.Run()
Expect(err).ToNot(HaveOccurred())
Expect(jobSupervisor.Started).To(BeTrue())
})
It("configures jobs", func() {
_, err := action.Run()
Expect(err).ToNot(HaveOccurred())
Expect(applier.Configured).To(BeTrue())
})
It("apply errs if a job fails configuring", func() {
applier.ConfiguredError = errors.New("fake error")
_, err := action.Run()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("Configuring jobs"))
})
})
}
示例14: describeHTTPMetadataService
func describeHTTPMetadataService() {
var (
metadataHeaders map[string]string
dnsResolver *fakeinf.FakeDNSResolver
platform *fakeplat.FakePlatform
logger boshlog.Logger
metadataService MetadataService
)
BeforeEach(func() {
metadataHeaders = make(map[string]string)
metadataHeaders["key"] = "value"
dnsResolver = &fakeinf.FakeDNSResolver{}
platform = fakeplat.NewFakePlatform()
logger = boshlog.NewLogger(boshlog.LevelNone)
metadataService = NewHTTPMetadataService("fake-metadata-host", metadataHeaders, "/user-data", "/instanceid", "/ssh-keys", dnsResolver, platform, logger)
})
ItEnsuresMinimalNetworkSetup := func(subject func() (string, error)) {
Context("when no networks are configured", func() {
BeforeEach(func() {
platform.GetConfiguredNetworkInterfacesInterfaces = []string{}
})
It("sets up DHCP network", func() {
_, err := subject()
Expect(err).ToNot(HaveOccurred())
Expect(platform.SetupNetworkingCalled).To(BeTrue())
Expect(platform.SetupNetworkingNetworks).To(Equal(boshsettings.Networks{
"eth0": boshsettings.Network{
Type: "dynamic",
},
}))
})
Context("when setting up DHCP fails", func() {
BeforeEach(func() {
platform.SetupNetworkingErr = errors.New("fake-network-error")
})
It("returns an error", func() {
_, err := subject()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("fake-network-error"))
})
})
})
}
Describe("IsAvailable", func() {
It("returns true", func() {
Expect(metadataService.IsAvailable()).To(BeTrue())
})
})
Describe("GetPublicKey", func() {
var (
ts *httptest.Server
sshKeysPath string
)
BeforeEach(func() {
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
defer GinkgoRecover()
Expect(r.Method).To(Equal("GET"))
Expect(r.URL.Path).To(Equal("/ssh-keys"))
Expect(r.Header.Get("key")).To(Equal("value"))
w.Write([]byte("fake-public-key"))
})
ts = httptest.NewServer(handler)
})
AfterEach(func() {
ts.Close()
})
Context("when the ssh keys path is present", func() {
BeforeEach(func() {
sshKeysPath = "/ssh-keys"
metadataService = NewHTTPMetadataService(ts.URL, metadataHeaders, "/user-data", "/instanceid", sshKeysPath, dnsResolver, platform, logger)
})
It("returns fetched public key", func() {
publicKey, err := metadataService.GetPublicKey()
Expect(err).NotTo(HaveOccurred())
Expect(publicKey).To(Equal("fake-public-key"))
})
ItEnsuresMinimalNetworkSetup(func() (string, error) {
return metadataService.GetPublicKey()
})
})
Context("when the ssh keys path is not present", func() {
BeforeEach(func() {
sshKeysPath = ""
metadataService = NewHTTPMetadataService(ts.URL, metadataHeaders, "/user-data", "/instanceid", sshKeysPath, dnsResolver, platform, logger)
//.........这里部分代码省略.........
示例15:
package infrastructure_test
import (
"errors"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/infrastructure"
fakeplatform "github.com/cloudfoundry/bosh-agent/platform/fakes"
boshlog "github.com/cloudfoundry/bosh-utils/logger"
)
var _ = Describe("ConfigDriveSettingsSource", func() {
var (
platform *fakeplatform.FakePlatform
source *CDROMSettingsSource
)
BeforeEach(func() {
settingsFileName := "fake-settings-file-name"
platform = fakeplatform.NewFakePlatform()
logger := boshlog.NewLogger(boshlog.LevelNone)
source = NewCDROMSettingsSource(settingsFileName, platform, logger)
})
Describe("PublicSSHKeyForUsername", func() {
It("returns an empty string", func() {
publicKey, err := source.PublicSSHKeyForUsername("fake-username")
Expect(err).ToNot(HaveOccurred())
Expect(publicKey).To(Equal(""))
})