MCPcopy Index your code
hub / github.com/cortexproject/cortex / TestProtobufCodecFuzz

Function TestProtobufCodecFuzz

integration/query_fuzz_test.go:780–894  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

778}
779
780func TestProtobufCodecFuzz(t *testing.T) {
781 s, err := e2e.NewScenario(networkName)
782 require.NoError(t, err)
783 defer s.Close()
784
785 // Start dependencies.
786 consul1 := e2edb.NewConsulWithName("consul1")
787 consul2 := e2edb.NewConsulWithName("consul2")
788 require.NoError(t, s.StartAndWaitReady(consul1, consul2))
789
790 flags := mergeFlags(
791 AlertmanagerLocalFlags(),
792 map[string]string{
793 "-store.engine": blocksStorageEngine,
794 "-blocks-storage.backend": "filesystem",
795 "-blocks-storage.tsdb.head-compaction-interval": "4m",
796 "-blocks-storage.tsdb.block-ranges-period": "2h",
797 "-blocks-storage.tsdb.ship-interval": "1h",
798 "-blocks-storage.bucket-store.sync-interval": "15m",
799 "-blocks-storage.tsdb.retention-period": "2h",
800 "-blocks-storage.bucket-store.index-cache.backend": tsdb.IndexCacheBackendInMemory,
801 // Ingester.
802 "-ring.store": "consul",
803 "-consul.hostname": consul1.NetworkHTTPEndpoint(),
804 // Distributor.
805 "-distributor.replication-factor": "1",
806 // Store-gateway.
807 "-store-gateway.sharding-enabled": "false",
808 // alert manager
809 "-alertmanager.web.external-url": "http://localhost/alertmanager",
810 },
811 )
812 // make alert manager config dir
813 require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
814
815 path1 := path.Join(s.SharedDir(), "cortex-1")
816 path2 := path.Join(s.SharedDir(), "cortex-2")
817
818 flags1 := mergeFlags(flags, map[string]string{"-blocks-storage.filesystem.dir": path1})
819 // Start Cortex replicas.
820 cortex1 := e2ecortex.NewSingleBinary("cortex-1", flags1, "")
821 // Enable protobuf codec for the second Cortex instance.
822 flags2 := mergeFlags(flags, map[string]string{
823 "-api.querier-default-codec": "protobuf",
824 "-blocks-storage.filesystem.dir": path2,
825 "-consul.hostname": consul2.NetworkHTTPEndpoint(),
826 })
827 cortex2 := e2ecortex.NewSingleBinary("cortex-2", flags2, "")
828 require.NoError(t, s.StartAndWaitReady(cortex1, cortex2))
829
830 // Wait until Cortex replicas have updated the ring state.
831 require.NoError(t, cortex1.WaitSumMetrics(e2e.Equals(float64(512)), "cortex_ring_tokens_total"))
832 require.NoError(t, cortex2.WaitSumMetrics(e2e.Equals(float64(512)), "cortex_ring_tokens_total"))
833
834 c1, err := e2ecortex.NewClient(cortex1.HTTPEndpoint(), cortex1.HTTPEndpoint(), "", "", "user-1")
835 require.NoError(t, err)
836 c2, err := e2ecortex.NewClient(cortex2.HTTPEndpoint(), cortex2.HTTPEndpoint(), "", "", "user-1")
837 require.NoError(t, err)

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
StartAndWaitReadyMethod · 0.95
SharedDirMethod · 0.95
PushMethod · 0.95
NewScenarioFunction · 0.92
NewSingleBinaryFunction · 0.92
EqualsFunction · 0.92
NewClientFunction · 0.92
writeFileToSharedDirFunction · 0.85
waitUntilReadyFunction · 0.85
runQueryFuzzTestCasesFunction · 0.85

Tested by

no test coverage detected