Exemple #1
0
func NewFakePlatform() (platform *FakePlatform) {
	platform = new(FakePlatform)
	platform.Fs = fakesys.NewFakeFileSystem()
	platform.Runner = fakesys.NewFakeCmdRunner()
	platform.FakeCompressor = fakecmd.NewFakeCompressor()
	platform.FakeCopier = fakecmd.NewFakeCopier()
	platform.FakeVitalsService = fakevitals.NewFakeService()
	platform.DevicePathResolver = fakedpresolv.NewFakeDevicePathResolver()
	platform.AddUserToGroupsGroups = make(map[string][]string)
	platform.SetupSSHPublicKeys = make(map[string][]string)
	platform.UserPasswords = make(map[string]string)
	platform.ScsiDiskMap = make(map[string]string)
	platform.GetFileContentsFromDiskDiskPaths = []string{}
	platform.GetFileContentsFromDiskFileNames = [][]string{}
	platform.GetFileContentsFromDiskContents = map[string][]byte{}
	platform.GetFileContentsFromDiskErrs = map[string]error{}
	platform.certManager = new(fakecert.FakeManager)
	platform.SetupRawEphemeralDisksCallCount = 0
	platform.SetupRawEphemeralDisksDevices = nil
	platform.SetupRawEphemeralDisksErr = nil
	platform.GetHostPublicKeyError = nil
	platform.SetupRootDiskCalledTimes = 0
	platform.SetupRootDiskError = nil
	platform.IsPersistentDiskMountableErr = nil
	return
}
func NewFakePlatform() (platform *FakePlatform) {
	platform = new(FakePlatform)
	platform.Fs = fakesys.NewFakeFileSystem()
	platform.Runner = fakesys.NewFakeCmdRunner()
	platform.FakeCompressor = fakecmd.NewFakeCompressor()
	platform.FakeCopier = fakecmd.NewFakeCopier()
	platform.FakeVitalsService = fakevitals.NewFakeService()
	platform.DevicePathResolver = fakedpresolv.NewFakeDevicePathResolver()
	platform.AddUserToGroupsGroups = make(map[string][]string)
	platform.SetupSSHPublicKeys = make(map[string]string)
	platform.UserPasswords = make(map[string]string)
	platform.ScsiDiskMap = make(map[string]string)
	return
}
Exemple #3
0
func NewFakePlatform() (platform *FakePlatform) {
	platform = new(FakePlatform)
	platform.Fs = fakesys.NewFakeFileSystem()
	platform.Runner = fakesys.NewFakeCmdRunner()
	platform.FakeCompressor = fakecmd.NewFakeCompressor()
	platform.FakeCopier = fakecmd.NewFakeCopier()
	platform.FakeVitalsService = fakevitals.NewFakeService()
	platform.DevicePathResolver = fakedpresolv.NewFakeDevicePathResolver()
	platform.AddUserToGroupsGroups = make(map[string][]string)
	platform.SetupSSHPublicKeys = make(map[string]string)
	platform.UserPasswords = make(map[string]string)
	platform.ScsiDiskMap = make(map[string]string)
	platform.GetFileContentsFromDiskDiskPaths = []string{}
	platform.GetFileContentsFromDiskFileNames = [][]string{}
	platform.GetFileContentsFromDiskContents = map[string][]byte{}
	platform.GetFileContentsFromDiskErrs = map[string]error{}
	platform.certManager = new(fakecert.FakeManager)
	return
}
)

var _ = Describe("GetState", func() {
	var (
		settingsService *fakesettings.FakeSettingsService
		specService     *fakeas.FakeV1Service
		jobSupervisor   *fakejobsuper.FakeJobSupervisor
		vitalsService   *fakevitals.FakeService
		action          GetStateAction
	)

	BeforeEach(func() {
		settingsService = &fakesettings.FakeSettingsService{}
		jobSupervisor = fakejobsuper.NewFakeJobSupervisor()
		specService = fakeas.NewFakeV1Service()
		vitalsService = fakevitals.NewFakeService()
		ntpService := &fakentp.FakeService{
			GetOffsetNTPOffset: boshntp.NTPInfo{
				Offset:    "0.34958",
				Timestamp: "12 Oct 17:37:58",
			},
		}
		action = NewGetState(settingsService, specService, jobSupervisor, vitalsService, ntpService)
	})

	It("get state should be synchronous", func() {
		Expect(action.IsAsynchronous()).To(BeFalse())
	})

	It("is not persistent", func() {
		Expect(action.IsPersistent()).To(BeFalse())