示例#1
0
		})

		It("should generate 100 point", func() {
			lst := gen.GenerateList()
			Expect(lst).To(HaveLen(100))
		})

		It("should generate a timestamp key for all elements", func() {
			lst := gen.GenerateList()
			for _, el := range lst {
				Expect(el).To(HaveKey("ts"))
			}
		})

		It("should genereate time.Time elements", func() {
			ts, ok := gen.Generate(0)[0]["ts"].(time.Time)
			Expect(ok).To(BeTrue())
			Expect(ts).To(Equal(from))
		})

		It("all timestamps should be before From and To", func() {
			lst := gen.GenerateList()
			for _, el := range lst {
				ts, ok := el["ts"].(time.Time)
				Expect(ok).To(BeTrue())
				Expect(ts).To(BeTemporally(">=", from))
				Expect(ts).To(BeTemporally("<=", to))
			}
		})

		It("each timestamp should be newer than the last", func() {
示例#2
0
							},
						},
						"service": testdata.GenGenSpec{
							Fixed: &testdata.FixedOptions{
								Value: "Service 1",
							},
						},
					},
				},
			})

			Expect(err).NotTo(HaveOccurred())
		})

		It("Generate should return two values", func() {
			Expect(gen.Generate(50)).To(HaveLen(2))
		})

		It("should generate equal timestamps", func() {
			vals := gen.Generate(78)
			Expect(vals[0]["ts"]).To(Equal(vals[1]["ts"]))
		})

		It("should generate different services", func() {
			vals := gen.Generate(78)
			Expect(vals[0]["service"]).NotTo(Equal(vals[1]["service"]))
		})

		It("points should be generated in order", func() {
			vals := gen.Generate(78)
			Expect(vals[0]["service"]).To(Equal("Service 0"))