Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/service/repository/bundle/create_test.go')
-rw-r--r--internal/service/repository/bundle/create_test.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/internal/service/repository/bundle/create_test.go b/internal/service/repository/bundle/create_test.go
new file mode 100644
index 000000000..59ef3247a
--- /dev/null
+++ b/internal/service/repository/bundle/create_test.go
@@ -0,0 +1,60 @@
+package bundle
+
+import (
+ "os"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/testhelper"
+)
+
+func TestCreateFull(t *testing.T) {
+ testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ defer cleanup()
+
+ ctx, cancel := testhelper.Context()
+ defer cancel()
+
+ _, bundleRefWriter, err := Create(ctx, testRepo)
+ require.NoError(t, err)
+ require.NoError(t, bundleRefWriter.Commit())
+}
+
+func TestCreateIncremental(t *testing.T) {
+ testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ defer cleanup()
+
+ ctx, cancel := testhelper.Context()
+ defer cancel()
+
+ _, bundleRefWriter, err := Create(ctx, testRepo)
+ require.NoError(t, err)
+ require.NoError(t, bundleRefWriter.Commit())
+
+ b, _, err := Create(ctx, testRepo)
+ require.NoError(t, err)
+
+ require.Nil(t, b)
+}
+
+func TestUnpack(t *testing.T) {
+ testRepo, _, cleanup := testhelper.NewTestRepo(t)
+ defer cleanup()
+
+ ctx, cancel := testhelper.Context()
+ defer cancel()
+
+ b, bundleRefWriter, err := Create(ctx, testRepo)
+ require.NoError(t, err)
+ require.NoError(t, bundleRefWriter.Commit())
+
+ emptyRepo, _, cleanup := testhelper.InitBareRepo(t)
+ defer cleanup()
+
+ require.NoError(t, Unpack(ctx, emptyRepo, b))
+}
+
+func TestMain(m *testing.M) {
+ testhelper.Configure()
+ os.Exit(m.Run())
+}