Skip to content

Commit dfea913

Browse files
Matovidloclaude
andcommitted
fix(templates): use RepositoryTypeDir in tests to avoid git clone timeout on Linux
git clone file:// forces pack-object transport on Linux (no hardlinks), causing parallel subtests to exceed the 10-second context deadline on loaded CI runners. Switch to RepositoryTypeDir which reads templates directly from the filesystem — no git involved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e299769 commit dfea913

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

  • internal/pkg/service/templates/dependencies

internal/pkg/service/templates/dependencies/mocked.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package dependencies
22

33
import (
44
"context"
5-
"fmt"
65
"net/url"
7-
"os"
86
"path"
97
"path/filepath"
108
"reflect"
@@ -13,8 +11,6 @@ import (
1311

1412
"github.com/stretchr/testify/require"
1513

16-
"github.com/keboola/keboola-as-code/internal/pkg/filesystem"
17-
"github.com/keboola/keboola-as-code/internal/pkg/filesystem/aferofs"
1814
"github.com/keboola/keboola-as-code/internal/pkg/model"
1915
"github.com/keboola/keboola-as-code/internal/pkg/service/common/configmap"
2016
"github.com/keboola/keboola-as-code/internal/pkg/service/common/dependencies"
@@ -37,14 +33,9 @@ func NewMockedAPIScope(tb testing.TB, ctx context.Context, cfg config.Config, op
3733

3834
// Prepare test repository with templates, instead of default repositories, to prevent loading of all production templates.
3935
if reflect.DeepEqual(cfg.Repositories, config.DefaultRepositories()) {
40-
tmpDir := tb.TempDir()
4136
_, filename, _, _ := runtime.Caller(0)
42-
srcFs, err := aferofs.NewLocalFs(path.Dir(filename))
43-
require.NoError(tb, err)
44-
require.NoError(tb, aferofs.CopyFs2Fs(srcFs, filesystem.Join("git_test", "repository"), nil, tmpDir))
45-
require.NoError(tb, os.Rename(filepath.Join(tmpDir, ".gittest"), filepath.Join(tmpDir, ".git"))) // nolint:forbidigo
4637
cfg.Repositories = []model.TemplateRepository{{
47-
Type: model.RepositoryTypeGit, Name: "keboola", URL: fmt.Sprintf("file://%s", tmpDir), Ref: "main",
38+
Type: model.RepositoryTypeDir, Name: "keboola", URL: filepath.Join(path.Dir(filename), "git_test", "repository"),
4839
}}
4940
}
5041

0 commit comments

Comments
 (0)