}) JustBeforeEach(func() { migration.SetStoreClient(storeClient) migration.SetCryptor(cryptor) migrationErr = migration.Up(logger) }) var validateConversionToProto = func(node *goetcd.Node, actual, expected format.Versioner) { value := node.Value Expect(value[:2]).To(BeEquivalentTo(format.BASE64[:])) payload, err := base64.StdEncoding.DecodeString(string(value[2:])) Expect(err).NotTo(HaveOccurred()) Expect(payload[0]).To(BeEquivalentTo(format.PROTO)) serializer.Unmarshal(logger, []byte(value), actual) Expect(actual).To(Equal(expected)) } It("converts all data stored in the etcd store to base 64 protobuf", func() { Expect(migrationErr).NotTo(HaveOccurred()) By("Converting DesiredLRPs to Encoded Proto") response, err := storeClient.Get(deprecations.DesiredLRPSchemaRoot, false, true) Expect(err).NotTo(HaveOccurred()) Expect(response.Node.Nodes).To(HaveLen(1)) for _, node := range response.Node.Nodes { var desiredLRP models.DesiredLRP value := node.Value err := serializer.Unmarshal(logger, []byte(value), &desiredLRP) 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)) for _, node := range response.Node.Nodes { var schedulingInfo models.DesiredLRPSchedulingInfo serializer.Unmarshal(logger, []byte(node.Value), &schedulingInfo) Expect(schedulingInfo.DesiredLRPKey).To(Equal(existingDesiredLRP.DesiredLRPKey())) Expect(schedulingInfo.DesiredLRPResource).To(Equal(existingDesiredLRP.DesiredLRPResource())) Expect(schedulingInfo.Annotation).To(Equal(existingDesiredLRP.Annotation)) Expect(schedulingInfo.Instances).To(Equal(existingDesiredLRP.Instances)) Expect(schedulingInfo.Routes).To(Equal(*existingDesiredLRP.Routes)) Expect(schedulingInfo.ModificationTag).To(Equal(*existingDesiredLRP.ModificationTag)) } }) It("creates a DesiredLRPRunInfo for all desired LRPs", func() { Expect(migrationErr).NotTo(HaveOccurred()) response, err := storeClient.Get(etcd.DesiredLRPRunInfoSchemaRoot, false, true) Expect(err).NotTo(HaveOccurred())