MCPcopy
hub / github.com/dgraph-io/dgraph / read

Function read

dgraph/cmd/increment/increment_test.go:79–105  ·  view source on GitHub ↗
(t *testing.T, dg *dgo.Dgraph, expected int)

Source from the content-addressed store, hash-verified

77}
78
79func read(t *testing.T, dg *dgo.Dgraph, expected int) {
80 conf := viper.New()
81 conf.Set("pred", "counter.val")
82 conf.Set("ro", true)
83 cnt, err := process(dg, conf)
84 require.NoError(t, err)
85 ts := cnt.startTs
86 t.Logf("Readonly stage counter: %+v\n", cnt)
87
88 var wg sync.WaitGroup
89 for i := 0; i < N; i++ {
90 wg.Add(1)
91 go func() {
92 defer wg.Done()
93 for i := 0; i < N; i++ {
94 cnt, err := process(dg, conf)
95 if err != nil {
96 t.Logf("Error while reading: %v\n", err)
97 } else {
98 require.Equal(t, expected, cnt.Val)
99 require.True(t, cnt.startTs >= ts, "the timestamp should never decrease")
100 }
101 }
102 }()
103 }
104 wg.Wait()
105}
106
107func readBestEffort(t *testing.T, dg *dgo.Dgraph, pred string, M int) {
108 conf := viper.New()

Callers 1

TestIncrementFunction · 0.70

Calls 5

processFunction · 0.85
WaitMethod · 0.80
SetMethod · 0.65
AddMethod · 0.45
DoneMethod · 0.45

Tested by

no test coverage detected