}) Describe("Up", func() { var ( expectedDesiredLRP *models.DesiredLRP expectedActualLRP, expectedEvacuatingActualLRP *models.ActualLRP expectedTask *models.Task migrationErr error ) BeforeEach(func() { // DesiredLRP expectedDesiredLRP = model_helpers.NewValidDesiredLRP("process-guid") jsonValue, err := json.Marshal(expectedDesiredLRP) Expect(err).NotTo(HaveOccurred()) _, err = storeClient.Set(deprecations.DesiredLRPSchemaPath(expectedDesiredLRP), jsonValue, 0) Expect(err).NotTo(HaveOccurred()) // ActualLRP expectedActualLRP = model_helpers.NewValidActualLRP("process-guid", 1) jsonValue, err = json.Marshal(expectedActualLRP) Expect(err).NotTo(HaveOccurred()) _, err = storeClient.Set(etcd.ActualLRPSchemaPath(expectedActualLRP.ProcessGuid, 1), jsonValue, 0) Expect(err).NotTo(HaveOccurred()) // Evacuating ActualLRP expectedEvacuatingActualLRP = model_helpers.NewValidActualLRP("process-guid", 4) jsonValue, err = json.Marshal(expectedEvacuatingActualLRP) Expect(err).NotTo(HaveOccurred()) _, err = storeClient.Set( etcd.EvacuatingActualLRPSchemaPath(expectedEvacuatingActualLRP.ProcessGuid, 1),
Expect(err).NotTo(HaveOccurred()) return desiredLRP } Describe("Up", func() { var ( existingDesiredLRP *models.DesiredLRP migrationErr error ) BeforeEach(func() { existingDesiredLRP = newValidDesiredLRP("process-guid") payload, err := serializer.Marshal(logger, format.ENCRYPTED_PROTO, existingDesiredLRP) Expect(err).NotTo(HaveOccurred()) _, err = storeClient.Set(deprecations.DesiredLRPSchemaPath(existingDesiredLRP), payload, 0) Expect(err).NotTo(HaveOccurred()) }) JustBeforeEach(func() { migration.SetStoreClient(storeClient) migration.SetCryptor(cryptor) migrationErr = migration.Up(logger) }) It("creates a DesiredLRPSchedulingInfo for all desired LRPs", func() { Expect(migrationErr).NotTo(HaveOccurred()) response, err := storeClient.Get(etcd.DesiredLRPSchedulingInfoSchemaRoot, false, true) Expect(err).NotTo(HaveOccurred()) Expect(response.Node.Nodes).To(HaveLen(1))