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

Function TestHttpCompressionSupport

dgraph/cmd/alpha/http_test.go:618–712  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

616}
617
618func TestHttpCompressionSupport(t *testing.T) {
619 require.NoError(t, dropAll())
620 require.NoError(t, alterSchema(`name: string .`))
621 require.NoError(t, alterSchema(`name: string @index(term) .`))
622
623 q1 := `
624 {
625 names(func: has(name), orderasc: name) {
626 name
627 }
628 }
629 `
630
631 q2 := `
632 query all($name: string) {
633 names(func: eq(name, $name)) {
634 name
635 }
636 }
637 `
638
639 m1 := `
640 {
641 set {
642 _:a <name> "Alice" .
643 _:b <name> "Bob" .
644 _:c <name> "Charlie" .
645 _:d <name> "David" .
646 _:e <name> "Emily" .
647 _:f <name> "Frank" .
648 _:g <name> "Gloria" .
649 _:h <name> "Hannah" .
650 _:i <name> "Ian" .
651 _:j <name> "Judy" .
652 _:k <name> "Kevin" .
653 _:l <name> "Linda" .
654 _:m <name> "Michael" .
655 }
656 }
657 `
658
659 r1 := `{"data":{"names":[{"name":"Alice"},{"name":"Bob"},{"name":"Charlie"},{"name":"David"},` +
660 `{"name":"Emily"},{"name":"Frank"},{"name":"Gloria"},{"name":"Hannah"},{"name":"Ian"},` +
661 `{"name":"Judy"},{"name":"Kevin"},{"name":"Linda"},{"name":"Michael"}]}}`
662 require.NoError(t, runMutation(m1))
663
664 data, resp, err := queryWithGz(q1, "application/dql", "false", "", false, false)
665 require.NoError(t, err)
666 require.Equal(t, r1, data)
667 require.Empty(t, resp.Header.Get("Content-Encoding"))
668
669 data, resp, err = queryWithGz(q1, "application/dql", "", "", false, true)
670 require.NoError(t, err)
671 require.Equal(t, r1, data)
672 require.Equal(t, "gzip", resp.Header.Get("Content-Encoding"))
673
674 data, resp, err = queryWithGz(q1, "application/dql", "", "", true, false)
675 require.NoError(t, err)

Callers

nothing calls this directly

Calls 6

dropAllFunction · 0.85
alterSchemaFunction · 0.85
queryWithGzFunction · 0.85
requireDeadlineFunction · 0.85
runMutationFunction · 0.70
GetMethod · 0.65

Tested by

no test coverage detected