main 1fb2421

integration_test.go RawHistoryFolder

1// SPDX-License-Identifier: AGPL-3.0-or-later
2package blobs3_test
3
4import (
5	"context"
6	"crypto/rand"
7	"encoding/hex"
8	"os"
9	"testing"
10
11	"bnema.dev/ermite/internal/adapters/blobs3"
12	"bnema.dev/ermite/internal/adapters/blobtest"
13	"bnema.dev/ermite/internal/ports"
14	"github.com/stretchr/testify/require"
15)
16
17func TestIntegration_Contract(t *testing.T) {
18	get := func(k string) string { return os.Getenv("ERMITE_TEST_S3_" + k) }
19	if get("BUCKET") == "" || get("ACCESS_KEY_ID") == "" || get("SECRET_ACCESS_KEY") == "" {
20		t.Skip("set ERMITE_TEST_S3_* to run")
21	}
22	region := get("REGION")
23	if region == "" {
24		region = "us-east-1"
25	}
26	var opts []blobtest.Option
27	// MinIO lists unfinished uploads by whole key only.
28	if get("EXACT_KEY_UPLOAD_LIST") == "1" {
29		opts = append(opts, blobtest.ExactKeyUploadList())
30	}
31	blobtest.Run(t, func(t *testing.T) ports.BlobStore {
32		b := make([]byte, 16)
33		_, e := rand.Read(b)
34		require.NoError(t, e)
35		s, e := blobs3.New(context.Background(), blobs3.Config{Bucket: get("BUCKET"), Endpoint: get("ENDPOINT"), Region: region, AccessKeyID: get("ACCESS_KEY_ID"), SecretAccessKey: get("SECRET_ACCESS_KEY"), ForcePathStyle: get("FORCE_PATH_STYLE") == "1", Prefix: "ermite-test/" + hex.EncodeToString(b) + "/"})
36		require.NoError(t, e)
37		t.Cleanup(func() {
38			ctx := context.Background()
39			require.NoError(t, s.List(ctx, "", func(i ports.BlobInfo) error { return s.Delete(ctx, i.Key) }))
40			require.NoError(t, s.ListMultipart(ctx, "", func(i ports.MultipartInfo) error { return s.AbortMultipart(ctx, i.Key, i.ID) }))
41		})
42		return s
43	}, opts...)
44}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 4

Tags 45

↑↓ moveenter openesc close