Add Gist code search (#194)

This commit is contained in:
Thomas Miceli
2024-01-04 03:38:15 +01:00
parent 4cb7dc2d30
commit 87a6113cc7
25 changed files with 734 additions and 87 deletions

View File

@ -1,11 +1,10 @@
package test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/thomiceli/opengist/internal/db"
"github.com/thomiceli/opengist/internal/git"
"testing"
)
func TestGists(t *testing.T) {

View File

@ -133,14 +133,13 @@ func setup(t *testing.T) {
git.ReposDirectory = path.Join("tests")
config.C.IndexEnabled = false
config.C.LogLevel = "debug"
config.InitLog()
homePath := config.GetHomeDir()
log.Info().Msg("Data directory: " + homePath)
err = os.MkdirAll(filepath.Join(homePath, "repos"), 0755)
require.NoError(t, err, "Could not create repos directory")
err = os.MkdirAll(filepath.Join(homePath, "tmp", "repos"), 0755)
require.NoError(t, err, "Could not create tmp repos directory")
@ -149,6 +148,9 @@ func setup(t *testing.T) {
err = memdb.Setup()
require.NoError(t, err, "Could not initialize in memory database")
// err = index.Open(filepath.Join(homePath, "testsindex", "opengist.index"))
// require.NoError(t, err, "Could not open index")
}
func teardown(t *testing.T, s *testServer) {
@ -159,4 +161,10 @@ func teardown(t *testing.T, s *testServer) {
err = os.RemoveAll(path.Join(config.C.OpengistHome, "tests"))
require.NoError(t, err, "Could not remove repos directory")
// err = os.RemoveAll(path.Join(config.C.OpengistHome, "testsindex"))
// require.NoError(t, err, "Could not remove repos directory")
// err = index.Close()
// require.NoError(t, err, "Could not close index")
}