-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #364 from cliveseldon/engine_cache_fix
Fix URICache bug in engine
- Loading branch information
Showing
2 changed files
with
47 additions
and
4 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
36 changes: 36 additions & 0 deletions
36
engine/src/test/java/io/seldon/engine/service/UriCacheTest.java
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,36 @@ | ||
package io.seldon.engine.service; | ||
|
||
import org.junit.Test; | ||
import org.junit.Assert; | ||
import io.seldon.protos.DeploymentProtos.Endpoint; | ||
|
||
|
||
public class UriCacheTest { | ||
|
||
@Test | ||
public void testUri() | ||
{ | ||
Endpoint endpointA = Endpoint.newBuilder().setServiceHost("hostA").setServicePort(1000).build(); | ||
Endpoint endpointA2 = Endpoint.newBuilder().setServiceHost("hostA").setServicePort(1000).build(); | ||
Endpoint endpointB = Endpoint.newBuilder().setServiceHost("hostB").setServicePort(1000).build(); | ||
final String predictPath = "/predict"; | ||
final String predictPath2 = "/predict"; | ||
final String feedbackPath = "/feedback"; | ||
|
||
final String key1 = InternalPredictionService.getUriKey(endpointA, predictPath); | ||
final String key2 = InternalPredictionService.getUriKey(endpointB, predictPath); | ||
final String key3 = InternalPredictionService.getUriKey(endpointA, feedbackPath); | ||
|
||
Assert.assertNotEquals(key1, key2); | ||
Assert.assertNotEquals(key1, key3); | ||
|
||
final String key4 = InternalPredictionService.getUriKey(endpointA2, predictPath); | ||
|
||
Assert.assertEquals(key1, key4); | ||
|
||
final String key5 = InternalPredictionService.getUriKey(endpointA, predictPath2); | ||
|
||
Assert.assertEquals(key1, key5); | ||
} | ||
|
||
} |