MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestScenario

Function TestScenario

integration/e2e/scenario_test.go:78–147  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

76}
77
78func TestScenario(t *testing.T) {
79 t.Parallel()
80
81 s, m1, m2 := spinup(t, "e2e-scenario-test")
82 defer s.Close()
83
84 t.Run("minio is working", func(t *testing.T) {
85 testMinioWorking(t, m1)
86 testMinioWorking(t, m2)
87 })
88
89 t.Run("concurrent nested scenario 1 is working just fine as well", func(t *testing.T) {
90 t.Parallel()
91
92 s, m1, m2 := spinup(t, "e2e-scenario-test1")
93 defer s.Close()
94
95 testMinioWorking(t, m1)
96 testMinioWorking(t, m2)
97 })
98 t.Run("concurrent nested scenario 2 is working just fine as well", func(t *testing.T) {
99 t.Parallel()
100
101 s, m1, m2 := spinup(t, "e2e-scenario-test2")
102 defer s.Close()
103
104 testMinioWorking(t, m1)
105 testMinioWorking(t, m2)
106 })
107
108 require.NoError(t, s.Stop(m1))
109
110 // Expect m1 not working.
111 b, err := yaml.Marshal(s3.Config{
112 Endpoint: m1.Name(),
113 Bucket: "cheescake",
114 AccessKey: e2edb.MinioAccessKey,
115 SecretKey: e2edb.MinioSecretKey,
116 })
117 require.NoError(t, err)
118 bkt, err := s3.NewBucket(log.NewNopLogger(), b, "test", nil)
119 require.NoError(t, err)
120
121 _, err = bkt.Get(context.Background(), "recipe")
122 require.Error(t, err)
123
124 testMinioWorking(t, m2)
125
126 require.Error(t, s.Stop(m1))
127 // Should be noop.
128 require.NoError(t, m1.Stop())
129 // I can run closes as many times I want.
130 s.Close()
131 s.Close()
132 s.Close()
133
134 // Expect m2 not working.
135 b, err = yaml.Marshal(s3.Config{

Callers

nothing calls this directly

Calls 9

spinupFunction · 0.85
testMinioWorkingFunction · 0.85
CloseMethod · 0.65
RunMethod · 0.65
StopMethod · 0.65
NameMethod · 0.65
GetMethod · 0.65
MarshalMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected