コード例 #1
0
ファイル: evacuation_test.go プロジェクト: Gerg/inigo
		cellA = ginkgomon.Invoke(grouper.NewParallel(os.Kill, grouper.Members{
			{"rep", cellARepRunner},
		}))

		cellB = ginkgomon.Invoke(grouper.NewParallel(os.Kill, grouper.Members{
			{"rep", cellBRepRunner},
		}))

		test_helper.CreateZipArchive(
			filepath.Join(fileServerStaticDir, "lrp.zip"),
			fixtures.GoServerApp(),
		)
	})

	AfterEach(func() {
		helpers.StopProcesses(runtime, cellA, cellB)
	})

	It("handles evacuation", func() {
		By("desiring an LRP")
		lrp := helpers.DefaultLRPCreateRequest(processGuid, "log-guid", 1)
		lrp.Setup = &models.DownloadAction{
			From: fmt.Sprintf("http://%s/v1/static/%s", componentMaker.Addresses.FileServer, "lrp.zip"),
			To:   "/tmp",
			User: "******",
		}
		lrp.Action = &models.RunAction{
			User: "******",
			Path: "/tmp/go-server",
			Env:  []models.EnvironmentVariable{{"PORT", "8080"}},
		}
コード例 #2
0
ファイル: task_as_user_test.go プロジェクト: Gerg/inigo
		fileServerRunner, fileServerStaticDir = componentMaker.FileServer()

		cellGroup := grouper.Members{
			{"file-server", fileServerRunner},
			{"rep", componentMaker.Rep("-memoryMB", "1024")},
			{"auctioneer", componentMaker.Auctioneer()},
			{"converger", componentMaker.Converger()},
		}
		cellProcess = ginkgomon.Invoke(grouper.NewParallel(os.Interrupt, cellGroup))

		Eventually(receptorClient.Cells).Should(HaveLen(1))
	})

	AfterEach(func() {
		helpers.StopProcesses(cellProcess)
	})

	Describe("Running a task", func() {
		var guid string

		BeforeEach(func() {
			guid = helpers.GenerateGuid()
		})

		It("runs the command as a specific user", func() {
			taskRequest := helpers.TaskCreateRequest(
				guid,
				&models.RunAction{
					User: "******",
					Path: "sh",
コード例 #3
0
ファイル: cell_suite_test.go プロジェクト: Gerg/inigo
	gardenClient = componentMaker.GardenClient()
	natsClient = componentMaker.NATSClient()
	receptorClient = componentMaker.ReceptorClient()

	helpers.UpsertInigoDomain(receptorClient)

	inigo_announcement_server.Start(componentMaker.ExternalAddress)
})

var _ = AfterEach(func() {
	inigo_announcement_server.Stop()

	destroyContainerErrors := helpers.CleanupGarden(gardenClient)

	helpers.StopProcesses(plumbing)

	Expect(destroyContainerErrors).To(
		BeEmpty(),
		"%d containers failed to be destroyed!",
		len(destroyContainerErrors),
	)
})

func TestCell(t *testing.T) {
	helpers.RegisterDefaultTimeouts()

	RegisterFailHandler(Fail)

	RunSpecsWithDefaultAndCustomReporters(t, "Cell Integration Suite", []Reporter{
		ginkgoreporter.New(GinkgoWriter),
コード例 #4
0
ファイル: task_lifecycle_test.go プロジェクト: Gerg/inigo
	var (
		auctioneerProcess ifrit.Process
		cellProcess       ifrit.Process
		convergerProcess  ifrit.Process
	)

	BeforeEach(func() {
		auctioneerProcess = nil
		cellProcess = nil
		convergerProcess = nil
	})

	AfterEach(func() {
		helpers.StopProcesses(
			auctioneerProcess,
			cellProcess,
			convergerProcess,
		)
	})

	Context("when a rep, and auctioneer are running", func() {
		BeforeEach(func() {
			cellProcess = ginkgomon.Invoke(grouper.NewParallel(os.Kill, grouper.Members{
				{"rep", componentMaker.Rep("-memoryMB", "1024")},
			}))

			auctioneerProcess = ginkgomon.Invoke(componentMaker.Auctioneer())
		})

		Context("and a standard Task is desired", func() {
			var taskGuid string
コード例 #5
0
ファイル: ssh_test.go プロジェクト: Gerg/inigo
			lrps, err := receptorClient.ActualLRPsByProcessGuid(processGuid)
			Expect(err).NotTo(HaveOccurred())
			return lrps
		}).Should(HaveLen(2))

		Eventually(
			helpers.LRPInstanceStatePoller(receptorClient, processGuid, 0, nil),
		).Should(Equal(receptor.ActualLRPStateRunning))

		Eventually(
			helpers.LRPInstanceStatePoller(receptorClient, processGuid, 1, nil),
		).Should(Equal(receptor.ActualLRPStateRunning))
	})

	AfterEach(func() {
		helpers.StopProcesses(runtime)
	})

	Context("when valid process guid and index are used in the username", func() {
		It("can ssh to appropriate app instance container", func() {
			verifySSH(address, processGuid, 0)
			verifySSH(address, processGuid, 1)
		})

		It("supports local port fowarding", func() {
			clientConfig := &ssh.ClientConfig{
				User: fmt.Sprintf("diego:%s/%d", processGuid, 0),
				Auth: []ssh.AuthMethod{ssh.Password("")},
			}

			client, err := ssh.Dial("tcp", address, clientConfig)
コード例 #6
0
ファイル: stager_test.go プロジェクト: Gerg/inigo
			{"cc", fakeCC},
			{"stager", componentMaker.Stager()},
			{"nsync-listener", componentMaker.NsyncListener()},
		}))

		u, err := url.Parse(fakeCC.Address())
		Expect(err).NotTo(HaveOccurred())
		u.User = url.UserPassword(fakeCC.Username(), fakeCC.Password())
		u.Path = urljoiner.Join("staging", "droplets", appId, "upload?async=true")
		dropletUploadUri = u.String()
		u.Path = urljoiner.Join("staging", "buildpack_cache", appId, "upload")
		buildArtifactsUploadUri = u.String()
	})

	AfterEach(func() {
		helpers.StopProcesses(cell, brain, bridge)
	})

	stageApplication := func(stagingGuid, payload string) (*http.Response, error) {
		stageURL := urljoiner.Join("http://"+componentMaker.Addresses.Stager, "v1", "staging", stagingGuid)
		request, err := http.NewRequest("PUT", stageURL, strings.NewReader(payload))
		Expect(err).NotTo(HaveOccurred())

		return http.DefaultClient.Do(request)
	}

	Context("when unable to find an appropriate compiler", func() {
		It("returns an error", func() {
			resp, err := stageApplication(fmt.Sprintf("%s-%s", appId, taskId), fmt.Sprintf(`{
					"app_id": "%s",
					"log_guid": "%s",
コード例 #7
0
ファイル: executor_suite_test.go プロジェクト: Gerg/inigo
	componentMaker = helpers.MakeComponentMaker(builtArtifacts, localIP)
})

var _ = BeforeEach(func() {
	gardenProcess = ginkgomon.Invoke(grouper.NewParallel(os.Kill, grouper.Members{
		{"garden-linux", componentMaker.GardenLinux()},
	}))

	gardenClient = componentMaker.GardenClient()
})

var _ = AfterEach(func() {
	destroyContainerErrors := helpers.CleanupGarden(gardenClient)

	helpers.StopProcesses(gardenProcess)

	Expect(destroyContainerErrors).To(
		BeEmpty(),
		"%d containers failed to be destroyed!",
		len(destroyContainerErrors),
	)
})

func TestExecutor(t *testing.T) {
	helpers.RegisterDefaultTimeouts()

	RegisterFailHandler(Fail)

	RunSpecsWithDefaultAndCustomReporters(t, "Executor Integration Suite", []Reporter{
		ginkgoreporter.New(GinkgoWriter),
コード例 #8
0
ファイル: converger_test.go プロジェクト: Gerg/inigo
		)

		appId = helpers.GenerateGuid()

		processGuid = helpers.GenerateGuid()

		runningLRPsPoller = func() []receptor.ActualLRPResponse {
			return helpers.ActiveActualLRPs(receptorClient, processGuid)
		}

		helloWorldInstancePoller = helpers.HelloWorldInstancePoller(componentMaker.Addresses.Router, helpers.DefaultHost)
	})

	AfterEach(func() {
		By("Stopping all the processes")
		helpers.StopProcesses(auctioneer, rep, converger, runtime)
	})

	Describe("Executor fault tolerance", func() {
		BeforeEach(func() {
			auctioneer = ginkgomon.Invoke(componentMaker.Auctioneer())
		})

		Context("when an rep, and converger are running", func() {
			BeforeEach(func() {
				rep = ginkgomon.Invoke(componentMaker.Rep())
				converger = ginkgomon.Invoke(componentMaker.Converger(
					"-convergeRepeatInterval", "1s",
				))
			})
コード例 #9
0
ファイル: cc_app_test.go プロジェクト: Gerg/inigo
			{"nsync-listener", componentMaker.NsyncListener()},
		}))

		archive_helper.CreateZipArchive(
			filepath.Join(fileServerStaticDir, "droplet.zip"),
			fixtures.HelloWorldIndexApp(),
		)

		helpers.Copy(
			componentMaker.Artifacts.Lifecycles[componentMaker.DefaultStack()],
			filepath.Join(fileServerStaticDir, world.LifecycleFilename),
		)
	})

	AfterEach(func() {
		helpers.StopProcesses(runtime, bridge)
	})

	Describe("Start an application", func() {
		guid := "process-guid"

		Context("when the running message contains a start_command", func() {
			It("runs the app on the executor, registers routes, and shows that they are running via the tps", func() {
				// desire the app
				resp, err := desireApp(guid, `["route-1", "route-2"]`, 2)
				Expect(err).NotTo(HaveOccurred())
				Expect(resp.StatusCode).To(Equal(http.StatusAccepted))

				// check lrp instance statuses
				Eventually(helpers.RunningLRPInstancesPoller(componentMaker.Addresses.TPSListener, guid)).Should(HaveLen(2))