Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: cache mongoutil in test (#4007)

Danny Xu12f4fce7484a
diff --git a/resources/mongoutil/mongoutil_test.go b/resources/mongoutil/mongoutil_test.go
deleted file mode 100644
index cb19a99c2b..0000000000
--- a/resources/mongoutil/mongoutil_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package mongoutil
-
-import (
- "os/exec"
- "strings"
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-// TestRunBinary tests whether all binarys can be started on the target platform.
-func TestRunBinary(t *testing.T) {
- t.Parallel()
-
- a := require.New(t)
- tmpDir := t.TempDir()
- binDir, err := Install(tmpDir)
- a.NoError(err)
- expectedVersion := `1.6.1`
- cmd := exec.Command(GetMongoshPath(binDir), "--version")
- out, err := cmd.CombinedOutput()
- a.NoError(err)
- a.Equal(strings.TrimSuffix(string(out), "\n"), expectedVersion)
-}
diff --git a/server/server.go b/server/server.go
index 8b1b339f46..77049fcbb6 100644
--- a/server/server.go
+++ b/server/server.go
@@ -5,7 +5,6 @@ import (
"context"
"fmt"
"net/http"
- "runtime"
"strings"
"sync"
"time"
@@ -219,7 +218,6 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
// Installs the Postgres and utility binaries and creates the 'activeProfile.pgUser' user/database
// to store Bytebase's own metadata.
- log.Info(fmt.Sprintf("Installing Postgres OS %q Arch %q", runtime.GOOS, runtime.GOARCH))
s.pgBinDir, err = postgres.Install(resourceDir)
if err != nil {
return nil, err
diff --git a/tests/start_test.go b/tests/start_test.go
index 01e833a06e..27580ae047 100644
--- a/tests/start_test.go
+++ b/tests/start_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
+ "github.com/bytebase/bytebase/resources/mongoutil"
resourcemysql "github.com/bytebase/bytebase/resources/mysql"
"github.com/bytebase/bytebase/resources/mysqlutil"
@@ -60,6 +61,9 @@ func TestMain(m *testing.M) {
if _, err := mysqlutil.Install(resourceDirOverride); err != nil {
log.Fatal(err)
}
+ if _, err := mongoutil.Install(resourceDirOverride); err != nil {
+ log.Fatal(err)
+ }
dir, err = resourcemysql.Install(resourceDirOverride)
if err != nil {
log.Fatal(err)