Skip to content

Commit

Permalink
review: add log message and use -1 in absence of port
Browse files Browse the repository at this point in the history
  • Loading branch information
aureamunoz committed Feb 20, 2023
1 parent cda37e4 commit 50b1fe4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ private List<ServiceInstance> toStorkServiceInstances(List<Service> knServices,
}
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.error(e.getMessage() + " for service: " + application);
}

serviceInstances
.add(new DefaultServiceInstance(ServiceInstanceIds.next(), host, 0, secure,
.add(new DefaultServiceInstance(ServiceInstanceIds.next(), host, -1, secure,
labels,
knativeMetadata
.with(KnativeMetadataKey.META_KNATIVE_SERVICE_ID, knService.getFullResourceName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void shouldDiscoverNamespacedKnativeServices() {

assertThat(instances.get()).hasSize(1);
assertThat(instances.get().get(0).getHost()).isEqualTo("hello.test.127.0.0.1.sslip.io");
assertThat(instances.get().get(0).getPort()).isEqualTo(0);
assertThat(instances.get().get(0).getPort()).isEqualTo(-1);
Map<String, String> labels = instances.get().get(0).getLabels();
assertThat(labels).contains(entry("serving.knative.dev/creator", "kubernetes-admin"),
entry("serving.knative.dev/lastModifier", "kubernetes-admin"));
Expand Down Expand Up @@ -149,7 +149,7 @@ void shouldGetServiceFromK8sDefaultNamespaceUsingProgrammaticAPI() {

assertThat(instances.get()).hasSize(1);
assertThat(instances.get().get(0).getHost()).isEqualTo("hello.test.127.0.0.1.sslip.io");
assertThat(instances.get().get(0).getPort()).isEqualTo(0);
assertThat(instances.get().get(0).getPort()).isEqualTo(-1);
Map<String, String> labels = instances.get().get(0).getLabels();
assertThat(labels).contains(entry("serving.knative.dev/creator", "kubernetes-admin"),
entry("serving.knative.dev/lastModifier", "kubernetes-admin"));
Expand Down Expand Up @@ -179,7 +179,7 @@ void shouldHandleSecureAttribute() {

assertThat(instances.get()).hasSize(1);
assertThat(instances.get().get(0).getHost()).isEqualTo("hello.test.127.0.0.1.sslip.io");
assertThat(instances.get().get(0).getPort()).isEqualTo(0);
assertThat(instances.get().get(0).getPort()).isEqualTo(-1);
Map<String, String> labels = instances.get().get(0).getLabels();
assertThat(labels).contains(entry("serving.knative.dev/creator", "kubernetes-admin"),
entry("serving.knative.dev/lastModifier", "kubernetes-admin"));
Expand Down Expand Up @@ -218,7 +218,7 @@ void shouldFetchInstancesFromTheClusterWhenCacheIsInvalidated() {

assertThat(instances.get()).hasSize(1);
assertThat(instances.get().get(0).getHost()).isEqualTo("hello.test.127.0.0.1.sslip.io");
assertThat(instances.get().get(0).getPort()).isEqualTo(0);
assertThat(instances.get().get(0).getPort()).isEqualTo(-1);
Map<String, String> labels = instances.get().get(0).getLabels();
assertThat(labels).contains(entry("serving.knative.dev/creator", "kubernetes-admin"),
entry("serving.knative.dev/lastModifier", "kubernetes-admin"));
Expand Down

0 comments on commit 50b1fe4

Please sign in to comment.