-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starting with ReplaceWithLocalAndThenWithRemote
- Loading branch information
Showing
11 changed files
with
223 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ainer/server/startosis_engine/startosis_packages/dependency_handler/dependency_handler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package dependency_handler | ||
|
||
import ( | ||
"github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider" | ||
"github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/startosis_packages/package_replace_options_repository" | ||
) | ||
|
||
type DependencyHandler struct { | ||
packageReplaceOptionsRepository *package_replace_options_repository.PackageReplaceOptionsRepository | ||
gitPackageContentProvider *git_package_content_provider.GitPackageContentProvider | ||
} | ||
|
||
func NewDependencyHandler(packageReplaceOptionsRepository *package_replace_options_repository.PackageReplaceOptionsRepository, gitPackageContentProvider *git_package_content_provider.GitPackageContentProvider) *DependencyHandler { | ||
return &DependencyHandler{packageReplaceOptionsRepository: packageReplaceOptionsRepository, gitPackageContentProvider: gitPackageContentProvider} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...api_container/server/startosis_engine/startosis_packages/mock_package_content_provider.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...artosis_packages/package_replace_options_repository/package_replace_options_repository.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package package_replace_options_repository | ||
|
||
type PackageReplaceOptionsRepository struct { | ||
} | ||
|
||
func NewPackageReplaceOptionsRepository() *PackageReplaceOptionsRepository { | ||
return &PackageReplaceOptionsRepository{} | ||
} | ||
|
||
func (repository *PackageReplaceOptionsRepository) Get(key string) map[string]string { | ||
panic("Implement me") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...estsuite/startosis_replace_test/startosis_replace_with_local_and_then_with_remote_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package startosis_replace_test | ||
|
||
import ( | ||
"context" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
const ( | ||
packageWithoutReplaceRelPath = "../../../starlark/packages-with-replace/without-replace" | ||
packageWithoutReplaceParams = `{ "message_origin" : "main" }` | ||
) | ||
|
||
func (suite *StartosisReplaceTestSuite) TestStartosisReplaceWithLocalAndThenWithRemote() { | ||
ctx := context.Background() | ||
runResult, _ := suite.RunPackageWithParams(ctx, packageWithLocalReplaceRelPath, packageWithLocalReplaceParams) | ||
|
||
t := suite.T() | ||
require.Nil(t, runResult.InterpretationError) | ||
require.Empty(t, runResult.ValidationErrors) | ||
require.Nil(t, runResult.ExecutionError) | ||
expectedResult := "Replace with local package loaded.\nVerification succeeded. Value is '\"msg-loaded-from-local-dependency\"'.\n" | ||
require.Equal(t, expectedResult, string(runResult.RunOutput)) | ||
|
||
runResult2, _ := suite.RunPackageWithParams(ctx, packageWithoutReplaceRelPath, packageWithoutReplaceParams) | ||
|
||
require.Nil(t, runResult.InterpretationError) | ||
require.Empty(t, runResult.ValidationErrors) | ||
require.Nil(t, runResult.ExecutionError) | ||
expectedResult2 := "Without replace package loaded.\nVerification succeeded. Value is '\"dependency-loaded-from-main\"'.\n" | ||
require.Equal(t, expectedResult2, string(runResult2.RunOutput)) | ||
} |
1 change: 1 addition & 0 deletions
1
internal_testsuites/starlark/packages-with-replace/without-replace/kurtosis.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: github.com/kurtosis-tech/sample-startosis-load/without-replace |
23 changes: 23 additions & 0 deletions
23
internal_testsuites/starlark/packages-with-replace/without-replace/main.star
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
dependency = import_module("github.com/kurtosis-tech/sample-dependency-package/main.star") | ||
|
||
EXPECTED_MSG_FROM_MAIN = "dependency-loaded-from-main" | ||
|
||
MSG_ORIGIN_MAIN = "main" | ||
|
||
def run(plan, message_origin=MSG_ORIGIN_MAIN): | ||
plan.print("Without replace package loaded.") | ||
|
||
msg_from_dependency = dependency.get_msg() | ||
|
||
if message_origin == MSG_ORIGIN_MAIN: | ||
expected_msg = EXPECTED_MSG_FROM_MAIN | ||
else: | ||
expected_msg = "" | ||
|
||
plan.verify( | ||
value = expected_msg, | ||
assertion = "==", | ||
target_value = msg_from_dependency, | ||
) | ||
|
||
return |