Documentation ¶
Overview ¶
Package data contains integration test cases of the stream.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var VerifyFn = func(innerGm gm.Gomega, sharedContext helpers.SharedContext, args helpers.Args) { i, err := inputFS.ReadFile("input/" + args.Input + ".yaml") innerGm.Expect(err).NotTo(gm.HaveOccurred()) query := &streamv1.QueryRequest{} helpers.UnmarshalYAML(i, query) query.TimeRange = helpers.TimeRange(args, sharedContext) c := streamv1.NewStreamServiceClient(sharedContext.Connection) ctx := context.Background() resp, err := c.Query(ctx, query) if args.WantErr { if err == nil { g.Fail("expect error") } return } innerGm.Expect(err).NotTo(gm.HaveOccurred(), query.String()) if args.WantEmpty { innerGm.Expect(resp.Elements).To(gm.BeEmpty()) return } if args.Want == "" { args.Want = args.Input } ww, err := wantFS.ReadFile("want/" + args.Want + ".yaml") innerGm.Expect(err).NotTo(gm.HaveOccurred()) want := &streamv1.QueryResponse{} helpers.UnmarshalYAML(ww, want) for i := range want.Elements { want.Elements[i].ElementId = hex.EncodeToString(convert.Uint64ToBytes(convert.HashStr(query.Name + "|" + want.Elements[i].ElementId))) } if args.DisOrder { slices.SortFunc(want.Elements, func(a, b *streamv1.Element) int { return strings.Compare(a.ElementId, b.ElementId) }) slices.SortFunc(resp.Elements, func(a, b *streamv1.Element) int { return strings.Compare(a.ElementId, b.ElementId) }) } success := innerGm.Expect(cmp.Equal(resp, want, protocmp.IgnoreUnknown(), protocmp.IgnoreFields(&streamv1.Element{}, "timestamp"), protocmp.Transform())). To(gm.BeTrue(), func() string { var j []byte j, err = protojson.Marshal(resp) if err != nil { return err.Error() } var y []byte y, err = yaml.JSONToYAML(j) if err != nil { return err.Error() } return string(y) }) if !success { return } query.Trace = true resp, err = c.Query(ctx, query) innerGm.Expect(err).NotTo(gm.HaveOccurred()) innerGm.Expect(resp.Trace).NotTo(gm.BeNil()) innerGm.Expect(resp.Trace.GetSpans()).NotTo(gm.BeEmpty()) }
VerifyFn verify whether the query response matches the wanted result.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.