Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added the get_service instruction #2233

Merged
merged 13 commits into from
Feb 28, 2024
Prev Previous commit
Next Next commit
add a failing test case
h4ck3rk3y committed Feb 28, 2024
commit 6ece66899cea74d46c85f898fb39646656b67f3b
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ func (repository *serviceInterpretationValueRepository) GetService(name service.

// if an empty value was found we return an error
if isEmptyValue {
return stacktrace.NewError("An empty value was found for service '%v'; this is unexpected", name)
return stacktrace.NewError("An empty value was found for service '%v'; this is a bug in Kurtosis", name)
}

deserializedValue, interpretationErr := repository.starlarkValueSerde.Deserialize(serviceSerializedValueStr)
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ const (
ipAddress = starlark.String("172.23.34.44")
)

func TestAddAndGetTest(t *testing.T) {
func TestPutGet_Succeed(t *testing.T) {
repository := getServiceInterpretationTimeValueRepository(t)
require.NotNil(t, repository)

@@ -53,6 +53,15 @@ func TestAddAndGetTest(t *testing.T) {
require.Equal(t, expectedService.String(), actualService.String())
}

func TestPutGetFail_ForMissingServiceName(t *testing.T) {
repository := getServiceInterpretationTimeValueRepository(t)
require.NotNil(t, repository)

actualService, err := repository.GetService(serviceName)
require.Error(t, err)
require.Nil(t, actualService)
}

func getServiceInterpretationTimeValueRepository(t *testing.T) *serviceInterpretationValueRepository {
file, err := os.CreateTemp("/tmp", "*.db")
defer func() {