fakeReceptorClient.GetVersionReturns(receptor.VersionResponse{
				CFRelease:           "v219",
				CFRoutingRelease:    "v220",
				DiegoRelease:        "v221",
				GardenLinuxRelease:  "v222",
				LatticeRelease:      "v223",
				LatticeReleaseImage: "v224",
				LTC:                 "v225",
				Receptor:            "v226",
			}, nil)
		})

		Context("when the local lattice version matches the server's expected version", func() {
			It("should return true", func() {
				versionManager := version.NewVersionManager(fakeReceptorClientCreator, fakeFileSwapper, "v223")
				Expect(versionManager.LtcMatchesServer("some-target")).To(BeTrue())
				Expect(fakeReceptorClientCreator.CreateReceptorClientCallCount()).To(Equal(1))
				Expect(fakeReceptorClientCreator.CreateReceptorClientArgsForCall(0)).To(Equal("some-target"))
			})
		})

		Context("when the local lattice version does not match the server's expected version", func() {
			It("should return false", func() {
				versionManager := version.NewVersionManager(fakeReceptorClientCreator, fakeFileSwapper, "mismatched-version")
				Expect(versionManager.LtcMatchesServer("some-target")).To(BeFalse())
				Expect(fakeReceptorClientCreator.CreateReceptorClientCallCount()).To(Equal(1))
				Expect(fakeReceptorClientCreator.CreateReceptorClientArgsForCall(0)).To(Equal("some-target"))
			})
		})
	})
})
Ejemplo n.º 2
0
	Describe("#LtcMatchesServer", func() {
		BeforeEach(func() {
			fakeReceptorClient.GetVersionReturns(receptor.VersionResponse{
				CfRelease:           "v219",
				CfRoutingRelease:    "v220",
				DiegoRelease:        "v221",
				GardenLinuxRelease:  "v222",
				LatticeRelease:      "v223",
				LatticeReleaseImage: "v224",
				Ltc:                 "v225",
				Receptor:            "v226",
			}, nil)
		})

		Context("when the local ltc version matches the server's expected version", func() {
			It("should return true", func() {
				versionManager := version.NewVersionManager(fakeReceptorClient, fakeFileSwapper, "v225")
				Expect(versionManager.LtcMatchesServer()).To(BeTrue())
			})
		})

		Context("when the local ltc version does not match the server's expected version", func() {
			It("should return false", func() {
				versionManager := version.NewVersionManager(fakeReceptorClient, fakeFileSwapper, "mismatched-version")
				Expect(versionManager.LtcMatchesServer()).To(BeFalse())
			})
		})
	})
})