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

Function testMinioWorking

integration/e2e/scenario_test.go:46–76  ·  view source on GitHub ↗
(t *testing.T, m *e2e.HTTPService)

Source from the content-addressed store, hash-verified

44}
45
46func testMinioWorking(t *testing.T, m *e2e.HTTPService) {
47 ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
48 defer cancel()
49
50 b, err := yaml.Marshal(s3.Config{
51 Endpoint: m.HTTPEndpoint(),
52 Bucket: bktName,
53 AccessKey: e2edb.MinioAccessKey,
54 SecretKey: e2edb.MinioSecretKey,
55 Insecure: true, // WARNING: Our secret cheesecake recipes might leak.
56 })
57 require.NoError(t, err)
58
59 bkt, err := s3.NewBucket(log.NewNopLogger(), b, "test", nil)
60 require.NoError(t, err)
61
62 require.NoError(t, bkt.Upload(ctx, "recipe", bytes.NewReader([]byte("Just go to Pastry Shop and buy."))))
63 require.NoError(t, bkt.Upload(ctx, "mom/recipe", bytes.NewReader([]byte("https://www.bbcgoodfood.com/recipes/strawberry-cheesecake-4-easy-steps"))))
64
65 r, err := bkt.Get(ctx, "recipe")
66 require.NoError(t, err)
67 b, err = io.ReadAll(r)
68 require.NoError(t, err)
69 require.Equal(t, "Just go to Pastry Shop and buy.", string(b))
70
71 r, err = bkt.Get(ctx, "mom/recipe")
72 require.NoError(t, err)
73 b, err = io.ReadAll(r)
74 require.NoError(t, err)
75 require.Equal(t, "https://www.bbcgoodfood.com/recipes/strawberry-cheesecake-4-easy-steps", string(b))
76}
77
78func TestScenario(t *testing.T) {
79 t.Parallel()

Callers 1

TestScenarioFunction · 0.85

Calls 5

HTTPEndpointMethod · 0.80
GetMethod · 0.65
EqualMethod · 0.65
MarshalMethod · 0.45
UploadMethod · 0.45

Tested by

no test coverage detected