Example #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
}
Example #2
0
)

var _ = Describe("FetchLogsAction", func() {
	var (
		compressor  *fakecmd.FakeCompressor
		copier      *fakecmd.FakeCopier
		blobstore   *fakeblobstore.FakeBlobstore
		dirProvider boshdirs.Provider
		action      FetchLogsAction
	)

	BeforeEach(func() {
		compressor = fakecmd.NewFakeCompressor()
		blobstore = &fakeblobstore.FakeBlobstore{}
		dirProvider = boshdirs.NewProvider("/fake/dir")
		copier = fakecmd.NewFakeCopier()
		action = NewFetchLogs(compressor, copier, blobstore, dirProvider)
	})

	It("logs should be asynchronous", func() {
		Expect(action.IsAsynchronous()).To(BeTrue())
	})

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

	Describe("Run", func() {
		testLogs := func(logType string, filters []string, expectedFilters []string) {
			copier.FilteredCopyToTempTempDir = "/fake-temp-dir"
			compressor.CompressFilesInDirTarballPath = "logs_test.tar"