diff --git a/core/server/api_container/server/startosis_engine/interpretation_time_value_store/interpretation_time_value_store.go b/core/server/api_container/server/startosis_engine/interpretation_time_value_store/interpretation_time_value_store.go index 087cc344d7..6a99504faf 100644 --- a/core/server/api_container/server/startosis_engine/interpretation_time_value_store/interpretation_time_value_store.go +++ b/core/server/api_container/server/startosis_engine/interpretation_time_value_store/interpretation_time_value_store.go @@ -15,14 +15,14 @@ type InterpretationTimeValueStore struct { func CreateInterpretationTimeValueStore(enclaveDb *enclave_db.EnclaveDB, serde *kurtosis_types.StarlarkValueSerde) (*InterpretationTimeValueStore, error) { serviceValuesRepository, err := getOrCreateNewServiceInterpretationTimeValueRepository(enclaveDb, serde) if err != nil { - return nil, stacktrace.Propagate(err, "an error occurred creating interpretation time service value repository") + return nil, stacktrace.Propagate(err, "An error occurred creating interpretation time value store") } return &InterpretationTimeValueStore{serviceValues: serviceValuesRepository, serde: serde}, nil } func (itvs *InterpretationTimeValueStore) AddService(name service.ServiceName, service *kurtosis_types.Service) error { if err := itvs.serviceValues.AddService(name, service); err != nil { - return stacktrace.Propagate(err, "an error occurred while adding '%v' for service '%v' to db", service, name) + return stacktrace.Propagate(err, "An error occurred while adding value '%v' for service '%v' to db", service, name) } return nil } @@ -30,7 +30,7 @@ func (itvs *InterpretationTimeValueStore) AddService(name service.ServiceName, s func (itvs *InterpretationTimeValueStore) GetService(name service.ServiceName) (*kurtosis_types.Service, error) { serviceStarlark, err := itvs.serviceValues.GetService(name) if err != nil { - return nil, stacktrace.Propagate(err, "an error occurred fetching interpretation time value for '%v' from db", name) + return nil, stacktrace.Propagate(err, "An error occurred fetching interpretation time value for '%v' from db", name) } return serviceStarlark, nil } diff --git a/core/server/api_container/server/startosis_engine/interpretation_time_value_store/service_value_repository.go b/core/server/api_container/server/startosis_engine/interpretation_time_value_store/service_value_repository.go index 3a46a7a5fb..655621898b 100644 --- a/core/server/api_container/server/startosis_engine/interpretation_time_value_store/service_value_repository.go +++ b/core/server/api_container/server/startosis_engine/interpretation_time_value_store/service_value_repository.go @@ -19,7 +19,6 @@ type serviceInterpretationValueRepository struct { starlarkValueSerde *kurtosis_types.StarlarkValueSerde } -// TODO add tests for this module func getOrCreateNewServiceInterpretationTimeValueRepository( enclaveDb *enclave_db.EnclaveDB, starlarkValueSerde *kurtosis_types.StarlarkValueSerde, @@ -27,13 +26,13 @@ func getOrCreateNewServiceInterpretationTimeValueRepository( if err := enclaveDb.Update(func(tx *bolt.Tx) error { bucket, err := tx.CreateBucketIfNotExists(serviceInterpretationValueBucketName) if err != nil { - return stacktrace.Propagate(err, "An error occurred while creating the recipe result database bucket") + return stacktrace.Propagate(err, "An error occurred while creating the bucket for the service interpretation time value repository") } logrus.Debugf("Recipe result bucket: '%+v'", bucket) return nil }); err != nil { - return nil, stacktrace.Propagate(err, "An error occurred while building the recipe result repository") + return nil, stacktrace.Propagate(err, "An error occurred while building service interpretation time value repository") } repository := &serviceInterpretationValueRepository{ diff --git a/core/server/api_container/server/startosis_engine/interpretation_time_value_store/service_value_repository_test.go b/core/server/api_container/server/startosis_engine/interpretation_time_value_store/service_value_repository_test.go index 8b59d4d118..a92a97126a 100644 --- a/core/server/api_container/server/startosis_engine/interpretation_time_value_store/service_value_repository_test.go +++ b/core/server/api_container/server/startosis_engine/interpretation_time_value_store/service_value_repository_test.go @@ -30,7 +30,7 @@ func TestAddAndGetTest(t *testing.T) { maybeUrl := "" port, interpretationErr := port_spec.CreatePortSpecUsingGoValues( - "my-test-service", + string(serviceName), uint16(443), port_spec_core.TransportProtocol_TCP, &applicationProtocol, diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service.go index df99cce293..8eb3e9a624 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_service.go @@ -143,7 +143,7 @@ func (builtin *AddServiceCapabilities) Interpret(locatorOfModuleInWhichThisBuilt err = builtin.interpretationTimeValueStore.AddService(builtin.serviceName, returnValue) if err != nil { - return nil, startosis_errors.WrapWithInterpretationError(err, "an error occurred while persisting return value for service '%v'", serviceName) + return nil, startosis_errors.WrapWithInterpretationError(err, "An error occurred while persisting return value for service '%v'", serviceName) } return returnValue, nil } diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_services.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_services.go index 85a79005a5..ca50444f52 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_services.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/add_service/add_services.go @@ -116,7 +116,7 @@ func (builtin *AddServicesCapabilities) Interpret(locatorOfModuleInWhichThisBuil builtin.serviceConfigs = serviceConfigs builtin.readyConditions = readyConditions - resultUuids, returnValue, interpretationErr := makeAddServicesInterpretationReturnValue(builtin.serviceConfigs, builtin.runtimeValueStore, builtin.interpretationTimeValueStore) + resultUuids, returnValue, interpretationErr := makeAndPersistAddServicesInterpretationReturnValue(builtin.serviceConfigs, builtin.runtimeValueStore, builtin.interpretationTimeValueStore) if interpretationErr != nil { return nil, interpretationErr } @@ -206,7 +206,7 @@ func (builtin *AddServicesCapabilities) Execute(ctx context.Context, _ *builtin_ serviceMsg := fmt.Sprintf("Service '%v' error:\n%v\n", serviceName, serviceErr) allServiceChecksErrMsg = allServiceChecksErrMsg + serviceMsg } - return "", stacktrace.NewError("An error occurred while checking al service, these are the errors by service:\n%s", allServiceChecksErrMsg) + return "", stacktrace.NewError("An error occurred while checking all service, these are the errors by service:\n%s", allServiceChecksErrMsg) } defer func() { if shouldDeleteAllStartedServices { @@ -454,7 +454,7 @@ func validateAndConvertConfigsAndReadyConditions( return convertedServiceConfigs, readyConditionsByServiceName, nil } -func makeAddServicesInterpretationReturnValue(serviceConfigs map[service.ServiceName]*service.ServiceConfig, runtimeValueStore *runtime_value_store.RuntimeValueStore, interpretationTimeValueStore *interpretation_time_value_store.InterpretationTimeValueStore) (map[service.ServiceName]string, *starlark.Dict, *startosis_errors.InterpretationError) { +func makeAndPersistAddServicesInterpretationReturnValue(serviceConfigs map[service.ServiceName]*service.ServiceConfig, runtimeValueStore *runtime_value_store.RuntimeValueStore, interpretationTimeValueStore *interpretation_time_value_store.InterpretationTimeValueStore) (map[service.ServiceName]string, *starlark.Dict, *startosis_errors.InterpretationError) { servicesObjectDict := starlark.NewDict(len(serviceConfigs)) resultUuids := map[service.ServiceName]string{} var err error @@ -472,7 +472,7 @@ func makeAddServicesInterpretationReturnValue(serviceConfigs map[service.Service return nil, nil, startosis_errors.WrapWithInterpretationError(err, "Unable to generate the object that should be returned by the '%s' builtin", AddServicesBuiltinName) } if err = interpretationTimeValueStore.AddService(serviceName, serviceObject); err != nil { - return nil, nil, startosis_errors.WrapWithInterpretationError(err, "an error occurred while persisting the return value for service with name '%v'", serviceName) + return nil, nil, startosis_errors.WrapWithInterpretationError(err, "An error occurred while persisting the return value for service with name '%v'", serviceName) } } return resultUuids, servicesObjectDict, nil diff --git a/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_service/get_service.go b/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_service/get_service.go index 9b3048c0a0..e35c097d75 100644 --- a/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_service/get_service.go +++ b/core/server/api_container/server/startosis_engine/kurtosis_instruction/get_service/get_service.go @@ -59,7 +59,7 @@ func (builtin *GetServiceCapabilities) Interpret(_ string, arguments *builtin_ar serviceStarlarkValue, err := builtin.interpretationTimeStore.GetService(serviceName) if err != nil { - return nil, startosis_errors.WrapWithInterpretationError(err, "an error occurred while fetching service '%v' from the store", serviceName) + return nil, startosis_errors.WrapWithInterpretationError(err, "An error occurred while fetching service '%v' from the store", serviceName) } return serviceStarlarkValue, nil diff --git a/internal_testsuites/golang/testsuite/startosis_add_service_test/startosis_add_service_test.go b/internal_testsuites/golang/testsuite/startosis_add_service_test/startosis_add_service_test.go index 3ea4f6a6e7..cbd8fad27b 100644 --- a/internal_testsuites/golang/testsuite/startosis_add_service_test/startosis_add_service_test.go +++ b/internal_testsuites/golang/testsuite/startosis_add_service_test/startosis_add_service_test.go @@ -70,7 +70,7 @@ func (suite *StartosisAddServiceTestSuite) TestAddTwoServicesAndTestConnection() expectedScriptOutput := `Adding services ` + serviceName + ` and ` + serviceName2 + ` Service '` + serviceName + `' added with service UUID '[a-z-0-9]+' Service '` + serviceName2 + `' added with service UUID '[a-z-0-9]+' -Fetched service '` + "" + `' +Fetched service '` + serviceName + `' Service\(name="datastore-1", hostname="datastore-1", ip_address="[0-9\.]+", ports=\{"grpc": PortSpec\(number=1323, transport_protocol="TCP", wait="2m0s"\)\}\) Command returned with exit code '0' and the following output: --------------------