Skip to content

Commit

Permalink
improve URI parsing for elasticsearch bindings * fix testcases #83
Browse files Browse the repository at this point in the history
  • Loading branch information
schefDev committed Dec 27, 2023
1 parent 1562003 commit e7c6f38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 3 additions & 5 deletions service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import (
"github.com/swisscom/backman/config"
)

func init() {
_ = os.Chdir("../")
}

func Test_Service_EnrichBinding(t *testing.T) {
config.SetConfigFile("_fixtures/config_without_bindings.json")

os.Unsetenv("SERVICE_BINDING_ROOT")

c := config.Get()
mergeVCAPServices()

Expand All @@ -41,7 +39,7 @@ func Test_Service_EnrichBinding(t *testing.T) {
elasticsearchServiceConfig.Binding = enrichBinding(elasticsearchServiceConfig.Binding)
assert.Equal(t, 80, elasticsearchServiceConfig.Binding.Port)

// if no port is defined in uri, it is determined by schema/protocol
// if no port is defined in uri, it is determined by schema/protocol, but only known ones
elasticsearchServiceConfig.Binding.Host = "nonehttp://0c061730-1b19-424b-8efd-349fd40957a0.yolo.elasticsearch.lyra-836.appcloud.swisscom.com"
elasticsearchServiceConfig.Binding.URI = elasticsearchServiceConfig.Binding.Host
elasticsearchServiceConfig.Binding.Port = 0
Expand Down
6 changes: 2 additions & 4 deletions service/vcap_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import (
"github.com/swisscom/backman/config"
)

func init() {
_ = os.Chdir("../")
}

func Test_Service_MergeVCAPServices(t *testing.T) {
config.SetConfigFile("_fixtures/config_without_bindings.json")

os.Unsetenv("SERVICE_BINDING_ROOT")

c := config.Get()
mergeVCAPServices()

Expand Down

0 comments on commit e7c6f38

Please sign in to comment.