From 1a324dc5fe65377f26bc93ddbe159bdacc0a585f Mon Sep 17 00:00:00 2001 From: leovct Date: Fri, 29 Nov 2024 12:18:38 +0100 Subject: [PATCH] test: import package with same prefix name --- .../git_package_content_provider_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider_test.go b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider_test.go index a5ac4cceca..98e3470ede 100644 --- a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider_test.go +++ b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider_test.go @@ -600,6 +600,17 @@ func TestGetAbsoluteLocator_AbsoluteLocatorIsInRootPackageButSourceIsNotShouldNo require.Nil(t, err) } +func TestGetAbsoluteLocator_RepositoriesWithSamePrefixNameShouldNotBeBlocked(t *testing.T) { + provider := NewGitPackageContentProvider("", "", NewGitHubPackageAuthProvider(""), nil) + + packageId := "github.com/package" + locatorOfModuleInWhichThisBuiltInIsBeingCalled := "github.com/package-2/main.star" + maybeRelativeLocator := "github.com/package/file.star" + + _, err := provider.GetAbsoluteLocator(packageId, locatorOfModuleInWhichThisBuiltInIsBeingCalled, maybeRelativeLocator, noPackageReplaceOptions) + require.Nil(t, err) +} + func Test_isSamePackageLocalAbsoluteLocator_TestDetectionInSubpath(t *testing.T) { result := shouldBlockAbsoluteLocatorBecauseIsInTheSameSourceModuleLocatorPackage("github.com/author/package/bang/lib.star", "github.com/author/package/main.star", "github.com/author/package/") require.True(t, result)