Skip to content

Commit

Permalink
chore: remove failing hostname tests that are no longer relevant
Browse files Browse the repository at this point in the history
  • Loading branch information
sighphyre committed Nov 29, 2023
1 parent e73b7ed commit 86dec9c
Showing 1 changed file with 0 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,39 +71,6 @@ public void should_be_disabled_if_hostname_not_in_list() {
assertFalse(engine.isEnabled("test"));
}

@Test
public void should_be_enabled_for_hostName() {
String hostName = "my-super-host";
System.setProperty("hostname", hostName);
// TODO when creating the context, somehow it has to read the hostname. Implementation from SDK strategy https://github.com/Unleash/unleash-client-java/blob/061277bd31293170e28deac4ec750add3a03374b/src/main/java/io/getunleash/strategy/ApplicationHostnameStrategy.java#L18-L28

Map<String, String> params = new HashMap<>();
params.put("hostNames", "MegaHost," + hostName + ",MiniHost, happyHost");

stateHandler.setState(new FeatureToggle(
"test",
true,
ImmutableList.of(new ActivationStrategy("applicationHostname", params))
));
assertTrue(engine.isEnabled("test"));
}

@Test
public void should_handle_weird_casing() {
String hostName = "my-super-host";
System.setProperty("hostname", hostName);

Map<String, String> params = new HashMap<>();

params.put("hostNames", "MegaHost," + hostName.toUpperCase() + ",MiniHost, happyHost");
stateHandler.setState(new FeatureToggle(
"test",
true,
ImmutableList.of(new ActivationStrategy("applicationHostname", params))
));
assertTrue(engine.isEnabled("test"));
}

@Test
public void so_close_but_no_cigar() {
String hostName = "my-super-host";
Expand Down Expand Up @@ -135,21 +102,6 @@ public void should_be_enabled_for_InetAddress() throws UnknownHostException {
assertTrue(engine.isEnabled("test"));
}

@Test
public void should_be_enabled_for_dashed_host() throws UnknownHostException {
String hostName = "super-wiEred-host";
System.setProperty("hostname", hostName);

Map<String, String> params = new HashMap<>();
params.put("hostNames", "MegaHost," + hostName + ",MiniHost, happyHost");
stateHandler.setState(new FeatureToggle(
"test",
true,
ImmutableList.of(new ActivationStrategy("applicationHostname", params))
));
assertTrue(engine.isEnabled("test"));
}

@Test
public void null_test() {
stateHandler.setState(new FeatureToggle(
Expand Down

0 comments on commit 86dec9c

Please sign in to comment.