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

Function TestIngesterRollingUpdate

integration/remote_write_v2_test.go:27–134  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestIngesterRollingUpdate(t *testing.T) {
28 // Test ingester rolling update situation: when -distributor.remote-writev2-enabled is true, and ingester uses the v1.19.0 image.
29 // Expected: remote write 2.0 push success
30 const blockRangePeriod = 5 * time.Second
31 ingesterImage := "quay.io/cortexproject/cortex:v1.19.0"
32
33 s, err := e2e.NewScenario(networkName)
34 require.NoError(t, err)
35 defer s.Close()
36
37 // Start dependencies.
38 consul := e2edb.NewConsulWithName("consul")
39 require.NoError(t, s.StartAndWaitReady(consul))
40
41 flags := mergeFlags(
42 AlertmanagerLocalFlags(),
43 map[string]string{
44 "-store.engine": blocksStorageEngine,
45 "-blocks-storage.backend": "filesystem",
46 "-blocks-storage.tsdb.head-compaction-interval": "4m",
47 "-blocks-storage.bucket-store.sync-interval": "15m",
48 "-blocks-storage.bucket-store.index-cache.backend": tsdb.IndexCacheBackendInMemory,
49 "-blocks-storage.tsdb.block-ranges-period": blockRangePeriod.String(),
50 "-blocks-storage.tsdb.ship-interval": "1s",
51 "-blocks-storage.tsdb.retention-period": ((blockRangePeriod * 2) - 1).String(),
52 "-blocks-storage.tsdb.enable-native-histograms": "true",
53 // Ingester.
54 "-ring.store": "consul",
55 "-consul.hostname": consul.NetworkHTTPEndpoint(),
56 // Distributor.
57 "-distributor.replication-factor": "1",
58 // Store-gateway.
59 "-store-gateway.sharding-enabled": "false",
60 // alert manager
61 "-alertmanager.web.external-url": "http://localhost/alertmanager",
62 },
63 )
64
65 distributorFlag := mergeFlags(flags, map[string]string{
66 "-distributor.remote-writev2-enabled": "true",
67 })
68
69 // make alert manager config dir
70 require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
71
72 path := path.Join(s.SharedDir(), "cortex-1")
73
74 flags = mergeFlags(flags, map[string]string{"-blocks-storage.filesystem.dir": path})
75 // Start Cortex replicas.
76 // Start all other services.
77 ingester := e2ecortex.NewIngester("ingester", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), flags, ingesterImage)
78 distributor := e2ecortex.NewDistributor("distributor", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), distributorFlag, "")
79 storeGateway := e2ecortex.NewStoreGateway("store-gateway", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), flags, "")
80 querier := e2ecortex.NewQuerier("querier", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), mergeFlags(flags, map[string]string{
81 "-querier.store-gateway-addresses": storeGateway.NetworkGRPCEndpoint()}), "")
82
83 require.NoError(t, s.StartAndWaitReady(querier, ingester, distributor, storeGateway))
84

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
StartAndWaitReadyMethod · 0.95
SharedDirMethod · 0.95
PushV2Method · 0.95
QueryMethod · 0.95
MetadataMethod · 0.95
NewScenarioFunction · 0.92
NewIngesterFunction · 0.92
NewDistributorFunction · 0.92
NewStoreGatewayFunction · 0.92
NewQuerierFunction · 0.92
EqualsFunction · 0.92

Tested by

no test coverage detected